ui icon indicating copy to clipboard operation
ui copied to clipboard

Questions: Will this render maps from osm.pbf

Open longlostbro opened this issue 9 years ago • 0 comments

Is it possible to render an entire map with roads, highways, land, water, pois and everything from an osm.pbf? I tried this example and it doesn't display anything on the map

        //initialize map.
        var map = new OsmSharp.UI.Map.Map(new WebMercator());

        // create the MapCSS image source.
        var imageSource = new MapCSSDictionaryImageSource();
        // initialize mapcss interpreter.
        var mapCssInterpreter = new MapCSSInterpreter(File.OpenRead(@"data\default.mapcss"), imageSource);
        
        var source = MemoryDataSource.CreateFromPBFStream(File.OpenRead(@"osm.pbf"));
        var testLayer = new LayerOsm(source, mapCssInterpreter,new WebMercator());
        map.AddLayer(testLayer);
        MapControl.SuspendNotifyMapViewChanged();

        //  set control properties.
        MapControl.MapZoom = 14;
        MapControl.Map = map;
        MapControl.MapCenter = testLayer.Envelope.Center;
        MapControl.ResumeNotifyMapViewChanged();

longlostbro avatar Nov 07 '16 17:11 longlostbro