OsmSharp / ui

The UI components.
http://osmsharp.com/
GNU General Public License v2.0
139 stars 91 forks source link

Questions: Will this render maps from osm.pbf #284

Open longlostbro opened 7 years ago

longlostbro commented 7 years ago

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();