/// <summary> /// Raises the OnLoad event. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // create the MapCSS image source. var imageSource = new MapCSSDictionaryImageSource(); imageSource.Add("styles/default/parking.png", Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.WinForms.UI.Sample.images.parking.png")); imageSource.Add("styles/default/bus.png", Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.WinForms.UI.Sample.images.bus.png")); imageSource.Add("styles/default/postbox.png", Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.WinForms.UI.Sample.images.postbox.png")); // load mapcss style interpreter. var mapCSSInterpreter = new MapCSSInterpreter( Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.WinForms.UI.Sample.test.mapcss"), imageSource); // initialize the data source. var dataSource = MemoryDataSource.CreateFromXmlStream(new FileInfo(@"c:\OSM\bin\wechel.osm").OpenRead()); //var dataSource = MemoryDataSource.CreateFromPBFStream(new FileInfo(@"c:\OSM\bin\wvl.osm.pbf").OpenRead()); //var dataSource = MemoryDataSource.CreateFromPBFStream(new FileInfo(@"c:\OSM\bin\lebbeke.osm.pbf").OpenRead()); //Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.WinForms.UI.Sample.test.osm")); // initialize map. var map = new OsmSharp.UI.Map.Map(); //map.AddLayer(new OsmLayer(dataSource, mapCSSInterpreter, map.Projection)); //map.AddLayer(new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/osm/{0}/{1}/{2}.png")); //map.AddLayer(new LayerMBTile(@"C:\Users\xivk\Documents\Nostalgeo.mbtiles")); map.AddLayer( new LayerScene( Scene2DLayered.Deserialize(new FileInfo(@"c:\OSM\bin\kempen.osm.pbf.scene.layered").OpenRead(), true))); //map.AddLayer( // new LayerScene( // Scene2DSimple.Deserialize(new FileInfo(@"c:\OSM\bin\wvl.osm.pbf.scene.simple").OpenRead(), true))); //this.InitializeRouting(map); //// create gpx layer. //var gpxLayer = new LayerGpx(map.Projection); //gpxLayer.AddGpx( // Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.WinForms.UI.Sample.test.gpx")); //map.AddLayer(gpxLayer); // set control properties. this.mapControl1.Map = map; this.mapControl1.Center = new GeoCoordinate(51.26371, 4.7854); //51.26371&lon=4.7854 // wechel.osm //this.mapControl1.Center = new GeoCoordinate(50.88672, 3.23899); // lendelede //this.mapControl1.Center = new GeoCoordinate(50.9523195, 3.0997436); //this.mapControl1.Center = new GeoCoordinate(51.156803, 2.958887); //50.9969&lon=4.1201 //this.mapControl1.Center = new GeoCoordinate(50.9969, 4.1201); this.mapControl1.ZoomLevel = 16; }