/// <summary> /// Raises the OnLoad event. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // initialize mapcss interpreter. var mapCSSInterpreter = new MapCSSInterpreter( new FileInfo(@"D:\Dropbox\Dropbox\SharpSoftware\Projects\Eurostation ReLive\Server_Dropbox\OSM\static\default.mapcss").OpenRead(), new MapCSSDictionaryImageSource()); // initialize map. var map = new OsmSharp.UI.Map.Map(); //// initialize router. //_router = Router.CreateLiveFrom(new OsmSharp.Osm.PBF.Streams.PBFOsmStreamSource( // new FileInfo(@"kempen.osm.pbf").OpenRead()), new OsmRoutingInterpreter()); var scene = new Scene2D(new OsmSharp.Math.Geo.Projections.WebMercator(), new List <float>(new float[] { 16, 14, 12, 10 })); var target = new StyleOsmStreamSceneTarget( mapCSSInterpreter, scene, new WebMercator()); var source = new XmlOsmStreamSource( new FileInfo(@"D:\Dropbox\Dropbox\SharpSoftware\Projects\Eurostation ReLive\Server_Dropbox\OSM\relive_mechelen\mechelen_new.osm").OpenRead()); var progress = new OsmStreamFilterProgress(); progress.RegisterSource(source); target.RegisterSource(progress); target.Pull(); //var merger = new Scene2DObjectMerger(); //scene = merger.BuildMergedScene(scene); map.AddLayer(new LayerScene(scene)); //var dataSource = MemoryDataSource.CreateFromXmlStream( // new FileInfo(@"D:\Dropbox\Dropbox\SharpSoftware\Projects\Eurostation ReLive\Server_Dropbox\OSM\relive_mechelen\mechelen_new.osm").OpenRead()); //map.AddLayer(new LayerOsm(dataSource, mapCSSInterpreter, map.Projection)); //var layerTile = new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg", 200); //layerTile.MinZoom = 12; //layerTile.MaxZoom = 13; //map.AddLayer(layerTile); //map.AddLayer(new LayerScene( // Scene2D.Deserialize(new FileInfo(@"default.map").OpenRead(), // true))); // initialize route/points layer. _layerRoute = new LayerRoute(new OsmSharp.Math.Geo.Projections.WebMercator()); map.AddLayer(_layerRoute); _layerPrimitives = new LayerPrimitives(new OsmSharp.Math.Geo.Projections.WebMercator()); map.AddLayer(_layerPrimitives); // set control properties. this.mapControl1.Map = map; this.mapControl1.MapCenter = new GeoCoordinate(51.0167, 4.4914); // wechel this.mapControl1.MapZoom = 14; this.mapControl1.MapMouseClick += mapControl1_MapMouseClick; this.mapControl1.MapMouseMove += mapControl1_MapMouseMove; }
/// <summary> /// Raises the OnLoad event. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // initialize mapcss interpreter. var mapCSSInterpreter = new MapCSSInterpreter( new FileInfo(@"default.mapcss").OpenRead(), new MapCSSDictionaryImageSource()); // initialize map. var map = new OsmSharp.UI.Map.Map(); //// initialize router. //_router = Router.CreateLiveFrom(new OsmSharp.Osm.PBF.Streams.PBFOsmStreamSource( // new FileInfo(@"kempen.osm.pbf").OpenRead()), new OsmRoutingInterpreter()); //Scene2D scene = new Scene2D(new OsmSharp.Math.Geo.Projections.WebMercator(), new List<float>(new float[] { // 16, 14, 12, 10 })); //StyleOsmStreamSceneTarget target = new StyleOsmStreamSceneTarget( // mapCSSInterpreter, scene, new WebMercator()); //FileInfo testFile = new FileInfo(@"kempen.osm.pbf"); //Stream stream = testFile.OpenRead(); //OsmStreamSource source = new PBFOsmStreamSource(stream); //OsmStreamFilterProgress progress = new OsmStreamFilterProgress(source); //target.RegisterSource(progress); //target.Pull(); //var merger = new Scene2DObjectMerger(); //scene = merger.BuildMergedScene(scene); //map.AddLayer(new LayerScene(scene)); //var dataSource = MemoryDataSource.CreateFromPBFStream( // new FileInfo(@"kempen-big.osm.pbf").OpenRead()); //map.AddLayer(new LayerOsm(dataSource, mapCSSInterpreter, map.Projection)); map.AddLayer(new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg", 200)); //map.AddLayer(new LayerScene( // Scene2D.Deserialize(new FileInfo(@"default.map").OpenRead(), // true))); // initialize route/points layer. _layerRoute = new LayerRoute(new OsmSharp.Math.Geo.Projections.WebMercator()); map.AddLayer(_layerRoute); _layerPrimitives = new LayerPrimitives(new OsmSharp.Math.Geo.Projections.WebMercator()); map.AddLayer(_layerPrimitives); // set control properties. this.mapControl1.Map = map; this.mapControl1.MapCenter = new GeoCoordinate(51.26371, 4.7854); // wechel this.mapControl1.MapZoom = 14; this.mapControl1.MapMouseClick += mapControl1_MapMouseClick; }
private void frmMain_Load(object sender, EventArgs e) { var mapCSSInterpreter = new MapCSSInterpreter(new FileInfo(@"dark_roads.mapcss").OpenRead(), new MapCSSDictionaryImageSource()); // initialize map. var map = new OsmSharp.UI.Map.Map(); //// initialize router. try { _router = Router.CreateLiveFrom(new OsmSharp.Osm.PBF.Streams.PBFOsmStreamSource(new FileInfo(@"C:\Users\smccloud\Documents\GitHub\OsmSharp.Service.Tiles\OsmSharp.Service.Tiles.SelfHost\bin\Debug\stcloud.osm.pbf").OpenRead()), new OsmRoutingInterpreter()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } try { var layerTile = new LayerTile(@"http://localhost:1234/tiles_stcloud/{z}/{x}/{y}.png"); map.AddLayer(layerTile); _layerRoute = new LayerRoute(new OsmSharp.Math.Geo.Projections.WebMercator()); map.AddLayer(_layerRoute); _layerPrimitives = new LayerPrimitives(new OsmSharp.Math.Geo.Projections.WebMercator()); map.AddLayer(_layerPrimitives); // set control properties. this.mapControl1.Map = map; this.mapControl1.MapCenter = new GeoCoordinate(45.5233, -94.14905); this.mapControl1.MapZoom = 14; this.mapControl1.Refresh(); this.mapControl1.MapMouseClick += mapControl1_MapMouseClick; this.mapControl1.MapMouseMove += mapControl1_MapMouseMove; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { this.Close(); } }
/// <summary> /// Raises the OnLoad event. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // initialize map. var map = new OsmSharp.UI.Map.Map(); //map.AddLayer(new LayerOsm(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(@"")); map.AddLayer( new LayerScene( Scene2DLayered.Deserialize( new FileInfo(@"kempen-big.osm.pbf.scene.layered").OpenRead(), true))); // set control properties. this.mapControl1.Map = map; this.mapControl1.MapCenter = new GeoCoordinate(51.26371, 4.7854); // wechel this.mapControl1.MapZoom = 19; }
/// <summary> /// Raises the OnLoad event. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // initialize mapcss interpreter. var mapCSSInterpreter = new MapCSSInterpreter( new FileInfo(@"dark_roads.mapcss").OpenRead(), new MapCSSDictionaryImageSource()); // initialize map. var map = new OsmSharp.UI.Map.Map(); //Scene2D scene = new Scene2D(new OsmSharp.Math.Geo.Projections.WebMercator(), new List<float>(new float[] { // 16, 14, 12, 10 })); //StyleOsmStreamSceneTarget target = new StyleOsmStreamSceneTarget( // mapCSSInterpreter, scene, new WebMercator()); //FileInfo testFile = new FileInfo(@"kempen.osm.pbf"); //Stream stream = testFile.OpenRead(); //OsmStreamSource source = new PBFOsmStreamSource(stream); //OsmStreamFilterProgress progress = new OsmStreamFilterProgress(source); //target.RegisterSource(progress); //target.Pull(); //var merger = new Scene2DObjectMerger(); //scene = merger.BuildMergedScene(scene); //map.AddLayer(new LayerScene(scene)); var dataSource = MemoryDataSource.CreateFromPBFStream( new FileInfo(@"kempen.osm.pbf").OpenRead()); map.AddLayer(new LayerOsm(dataSource, mapCSSInterpreter, map.Projection)); ////map.AddLayer(new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/osm/{0}/{1}/{2}.png")); //map.AddLayer(new LayerScene( // Scene2D.Deserialize(new FileInfo(@"kempen-big.osm.pbf.scene.layered").OpenRead(), // true))); // set control properties. this.mapControl1.Map = map; this.mapControl1.MapCenter = new GeoCoordinate(51.26371, 4.7854); // wechel this.mapControl1.MapZoom = 16; }
private void button_Click(object sender, RoutedEventArgs e) { //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\\opencyclemap.mapcss"), imageSource); var source = new XmlOsmStreamSource(File.OpenRead("data\\test.osm")); var testLayer = new LayerOsm(MemoryDataSource.CreateFrom(source), mapCssInterpreter, new WebMercator()); // map.AddLayer(testLayer); map.AddLayerTile(@"http://b.tile.openstreetmap.org/{z}/{x}/{y}.png"); // map.BackColor = SimpleColor.FromKnownColor(OsmSharp.UI.KnownColor.Black).Value; MapControl.SuspendNotifyMapViewChanged(); // set control properties. MapControl.MapZoom = 14; MapControl.Map = map; MapControl.MapCenter = testLayer.Envelope.Center; // MapControl.MapCenter = new GeoCoordinate(51.2667, 4.7914); // wechel var l = new MapLayerWrapper(new WebMercator()); //l.AddPoint(testLayer.Envelope.Center, 20, SimpleColor.FromKnownColor(OsmSharp.UI.KnownColor.Black).Value); MapControl.AddLayer(l, 100); MapControl.ResumeNotifyMapViewChanged(); }
/// <summary> /// Raises the OnLoad event. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // initialize mapcss interpreter. var mapCSSInterpreter = new MapCSSInterpreter( new FileInfo(@"dark_roads.mapcss").OpenRead(), new MapCSSDictionaryImageSource()); // initialize map. var map = new OsmSharp.UI.Map.Map(); //// initialize router. //_router = Router.CreateFrom(new OsmSharp.Osm.PBF.Streams.PBFOsmStreamSource( // new FileInfo(@"kempen.osm.pbf").OpenRead()), new OsmRoutingInterpreter()); //var scene = new Scene2D(new OsmSharp.Math.Geo.Projections.WebMercator(), new List<float>(new float[] { // 16, 14, 12, 10 })); //var target = new StyleOsmStreamSceneTarget( // mapCSSInterpreter, scene, new WebMercator()); //var source = new PBFOsmStreamSource( // new FileInfo(@"kempen.osm.pbf").OpenRead()); //var progress = new OsmStreamFilterProgress(); //progress.RegisterSource(source); //target.RegisterSource(progress); //target.Pull(); ////var merger = new Scene2DObjectMerger(); ////scene = merger.BuildMergedScene(scene); //map.AddLayer(new LayerScene(scene)); //var dataSource = MemoryDataSource.CreateFromXmlStream( // new FileInfo(@"D:\Dropbox\Dropbox\SharpSoftware\Projects\Eurostation ReLive\Server_Dropbox\OSM\relive_mechelen\mechelen_new.osm").OpenRead()); //map.AddLayer(new LayerOsm(dataSource, mapCSSInterpreter, map.Projection)); var layerTile = new LayerTile(@"http://*****:*****@"default.map").OpenRead(), // true))); // initialize route/points layer. _layerRoute = new LayerRoute(new OsmSharp.Math.Geo.Projections.WebMercator()); map.AddLayer(_layerRoute); _layerPrimitives = new LayerPrimitives(new OsmSharp.Math.Geo.Projections.WebMercator()); map.AddLayer(_layerPrimitives); // set control properties. this.mapControl1.Map = map; this.mapControl1.MapCenter = new GeoCoordinate(51.262, 4.7880); // wechel this.mapControl1.MapZoom = 14; this.mapControl1.MapMouseClick += mapControl1_MapMouseClick; this.mapControl1.MapMouseMove += mapControl1_MapMouseMove; }