Пример #1
0
        public void AddLayerOsm(Stream stream, Stream cssStream)
        {
            if (stream == null)
            {
                return;
            }

            // Create the MapCSS image source, which is used as image source for areas of the map
            var imageSource = new MapCSSDictionaryImageSource();

            // Load mapcss style interpreter.
            var mapCSSInterpreter = new MapCSSInterpreter(cssStream, imageSource);

            // Load data from pbf file into a memory data source
            var input = new PBFOsmStreamSource(stream);
            //var filter = new OsmStreamFilterBoundingBox(mapView.MapBoundingBox);
            //filter.RegisterSource(input);
            //var source = MemoryDataSource.CreateFromPBFStream(input);
            var source = MemoryDataSource.CreateFrom(input);

            //var source = new MemoryDataSource();

            // If there is allready a layer with map, close it
            if (layerMap != null)
            {
                layerMap.Close();
            }

            tileUrl = "";

            // Add new map layer
            layerMap = map?.AddLayerOsm(source, mapCSSInterpreter);
        }
Пример #2
0
        public void AddLayerOsm(Stream stream)
        {
            if (stream == null)
            {
                return;
            }

            // Get assembly
            var assembly = typeof(OsmMap).GetTypeInfo().Assembly;

            // Create the MapCSS image source, which is used as image source for areas of the map
            var imageSource = new MapCSSDictionaryImageSource();

            // Load mapcss style interpreter.
            var mapCSSInterpreter = new MapCSSInterpreter(assembly.GetManifestResourceStream("OsmSharp.Forms.MapCSS.Default.mapcss"), imageSource);

            // Load data from pbf file into a memory data source
            var source = MemoryDataSource.CreateFromPBFStream(stream);

            // If there is allready a layer with map, close it
            if (layerMap != null)
            {
                layerMap.Close();
            }

            tileUrl = "";

            // Add new map layer
            layerMap = map?.AddLayerOsm(source, mapCSSInterpreter);
        }
Пример #3
0
        /// <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(
                new FileInfo(@"C:\Users\xivk\Dropbox\SharpSoftware\Projects\Westtour WOI\wvl.mapcss").OpenRead(),
                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\gent.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 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(@"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(
            //        Scene2DLayered.Deserialize(new FileInfo(@"c:\OSM\bin\wvl.map").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.MapCenter = new GeoCoordinate(51.22105, 2.93419); // oostende spoor.
            this.mapControl1.MapCenter = new GeoCoordinate(51.156803, 2.958887); // gistel
            //this.mapControl1.MapCenter = new GeoCoordinate(51.05608, 3.72139); // gent
            //this.mapControl1.Center = new GeoCoordinate(50.9969, 4.1201);
            this.mapControl1.MapZoom = 19;
        }
Пример #4
0
        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();
        }
        public void Scene2DSimpleSerializeDeserializeTest()
        {
            // create the MapCSS image source.
            var imageSource = new MapCSSDictionaryImageSource();

            // load mapcss style interpreter.
            var mapCSSInterpreter = new MapCSSInterpreter(
                Assembly.GetExecutingAssembly().GetManifestResourceStream(
                    "OsmSharp.UI.Test.Unittests.Data.MapCSS.test.mapcss"),
                imageSource);

            // initialize the data source.
            var xmlSource = new XmlOsmStreamSource(
                Assembly.GetExecutingAssembly().GetManifestResourceStream(
                    "OsmSharp.UI.Test.Unittests.Data.test.osm"));
            IEnumerable <OsmGeo> dataSource = xmlSource;
            MemoryDataSource     source     = MemoryDataSource.CreateFrom(xmlSource);

            // get data.
            var scene            = new Scene2DSimple();
            var projection       = new WebMercator();
            GeoCoordinateBox box = null;

            foreach (var osmGeo in dataSource)
            {
                CompleteOsmGeo completeOsmGeo = null;
                switch (osmGeo.Type)
                {
                case OsmGeoType.Node:
                    completeOsmGeo = CompleteNode.CreateFrom(osmGeo as Node);
                    break;

                case OsmGeoType.Way:
                    completeOsmGeo = CompleteWay.CreateFrom(osmGeo as Way,
                                                            source);
                    break;

                case OsmGeoType.Relation:
                    completeOsmGeo = CompleteRelation.CreateFrom(osmGeo as Relation,
                                                                 source);
                    break;
                }

                // update box.
                if (completeOsmGeo != null)
                {
                    if (box == null)
                    {
                        box = completeOsmGeo.BoundingBox;
                    }
                    else if (completeOsmGeo.BoundingBox != null)
                    {
                        box = box + completeOsmGeo.BoundingBox;
                    }
                }

                // translate each object into scene object.
                mapCSSInterpreter.Translate(scene, projection, source, osmGeo as OsmGeo);
            }

            // create the stream.
            var stream = new MemoryStream();

            scene.Serialize(stream, false);

            // deserialize the stream.
            IScene2DPrimitivesSource sceneSource = Scene2DSimple.Deserialize(stream, false);

            if (box != null)
            {
                // query both and get the same results.
                int counter = 100;
                var rand    = new Random();
                while (counter > 0)
                {
                    var queryBox = new GeoCoordinateBox(
                        box.GenerateRandomIn(rand),
                        box.GenerateRandomIn(rand));
                    var    zoomFactor = (float)projection.ToZoomFactor(15);
                    View2D testView   = View2D.CreateFromBounds(
                        projection.LatitudeToY(queryBox.MaxLat),
                        projection.LongitudeToX(queryBox.MinLon),
                        projection.LatitudeToY(queryBox.MinLat),
                        projection.LongitudeToX(queryBox.MaxLon));
                    var testScene = new Scene2DSimple();
                    sceneSource.Get(testScene, testView, zoomFactor);

//                    var resultIndex = new HashSet<Scene2DPrimitive>(testScene.Get(testView, zoomFactor));
//                    var resultReference = new HashSet<Scene2DPrimitive>(scene.Get(testView, zoomFactor));

                    //Assert.AreEqual(resultReference.Count, resultIndex.Count);
                    //foreach (var data in resultIndex)
                    //{
                    //    Assert.IsTrue(resultReference.Contains(data));
                    //}
                    //foreach (var data in resultReference)
                    //{
                    //    Assert.IsTrue(resultIndex.Contains(data));
                    //}
                    counter--;
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Raises the create event.
        /// </summary>
        /// <param name="bundle">Bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            OsmSharp.Logging.Log.Enable();

//			OsmSharp.IO.Output.OutputStreamHost.RegisterOutputStream (
//				new OsmSharp.Android.UI.IO.Output.ConsoleOutputStream ());

            // create the MapCSS image source.
            var imageSource = new MapCSSDictionaryImageSource();

            imageSource.Add("styles/default/parking.png",
                            Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.images.parking.png"));
            imageSource.Add("styles/default/bus.png",
                            Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.images.bus.png"));
            imageSource.Add("styles/default/postbox.png",
                            Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.images.postbox.png"));

//			// load mapcss style interpreter.
//			var mapCSSInterpreter = new MapCSSInterpreter(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.mapcss"),
//				imageSource);

            // initialize the data source.
            //var dataSource = new MemoryDataSource();
//			var source = new XmlOsmStreamReader(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.osm"));
//			var source = new PBFOsmStreamReader(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.osm.pbf"));
//			dataSource.PullFromSource(source);

            // initialize map.
            var map = new Map();

            //map.AddLayer(new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/osm/{0}/{1}/{2}.png"));
            //map.AddLayer(new OsmLayer(dataSource, mapCSSInterpreter));
//			map.AddLayer(new LayerScene(Scene2DSimple.Deserialize(
//							Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.osm.pbf.scene.simple"), true)));
            map.AddLayer(
                new LayerScene(
                    Scene2DLayered.Deserialize(
                        Assembly.GetExecutingAssembly().GetManifestResourceStream(@"OsmSharp.Android.UI.Sample.wvl.map"), true)));

//			var routingSerializer = new V2RoutingDataSourceLiveEdgeSerializer(true);
//			var graphSerialized = routingSerializer.Deserialize(
//				//Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.osm.pbf.routing.3"));
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.pbf.routing.4"));
////
////			var graphLayer = new LayerDynamicGraphLiveEdge(graphSerialized, mapCSSInterpreter);
////			map.AddLayer(graphLayer);
//
//			// calculate route.
//			Router router = Router.CreateLiveFrom(
//				graphSerialized,
//				new OsmRoutingInterpreter());

            var routingSerializer = new OsmSharp.Routing.CH.Serialization.Sorted.CHEdgeDataDataSourceSerializer(false);
            var graphDeserialized = routingSerializer.Deserialize(
                Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.routing"), true);

            _router = Router.CreateCHFrom(
                graphDeserialized, new CHRouter(),
                new OsmRoutingInterpreter());
            GeoCoordinate point1       = new GeoCoordinate(51.158075, 2.961545);
            GeoCoordinate point2       = new GeoCoordinate(51.190503, 3.004793);
            RouterPoint   routerPoint1 = _router.Resolve(Vehicle.Car, point1);
            RouterPoint   routerPoint2 = _router.Resolve(Vehicle.Car, point2);
            Route         route1       = _router.Calculate(Vehicle.Car, routerPoint1, routerPoint2);
            RouteTracker  routeTracker = new RouteTracker(route1, new OsmRoutingInterpreter());

            _enumerator = route1.GetRouteEnumerable(20).GetEnumerator();

            _routeLayer = new LayerRoute(map.Projection);
            _routeLayer.AddRoute(route1, SimpleColor.FromKnownColor(KnownColor.Blue).Value);
            map.AddLayer(_routeLayer);

//			// create gpx layer.
//			LayerGpx gpxLayer = new LayerGpx(map.Projection);
//			gpxLayer.AddGpx(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.gpx"));
//			map.AddLayer(gpxLayer);

//			// set control properties.
//			var mapView = new MapView(this);
//			mapView.MapMaxZoomLevel = 20;
//			mapView.MapMinZoomLevel = 12;
//			//var mapView = new MapGLView (this);
//			mapView.Map = map;
//			//mapView.Center = new GeoCoordinate(51.158075, 2.961545); // gistel
//			//mapView.MapCenter = new GeoCoordinate (50.88672, 3.23899);
//			mapView.MapCenter = new GeoCoordinate(51.26337, 4.78739);
//			//mapView.Center = new GeoCoordinate(51.156803, 2.958887);
//			mapView.MapZoomLevel = 15;

//			var mapView = new OpenGLRenderer2D(
//				this, null);

//            _mapView = new MapView<MapGLView>(this, new MapGLView(this));

            _mapView = new MapView(this, new MapViewSurface(this));
            //_mapView = new MapView(this, new MapViewGLSurface(this));
            _mapView.Map = map;

            (_mapView as IMapView).AutoInvalidate = true;
            _mapView.MapMaxZoomLevel = 20;
            _mapView.MapMinZoomLevel = 12;
            _mapView.MapTilt         = 0;
            //var mapView = new MapGLView (this);
            _mapView.MapCenter = new GeoCoordinate(51.158075, 2.961545); // gistel
            //mapView.MapCenter = new GeoCoordinate (50.88672, 3.23899);
            //mapLayout.MapCenter = new GeoCoordinate(51.26337, 4.78739);
            //mapView.Center = new GeoCoordinate(51.156803, 2.958887);
            _mapView.MapZoom = 17;
            //MapViewAnimator mapViewAnimator = new MapViewAnimator(mapLayout);
            //_mapView.MapTapEvent += delegate(GeoCoordinate geoCoordinate)
            //{
            //    _mapView.ZoomToMarkers();
            //    //_mapView.AddMarker(geoCoordinate).Click += new EventHandler(MainActivity_Click);
            //    //mapViewAnimator.Stop();
            //    //mapViewAnimator.Start(geoCoordinate, 15, new TimeSpan(0, 0, 2));
            //};

            //Create the user interface in code
            var layout = new RelativeLayout(this);

            layout.AddView(_mapView);

            _mapView.AddMarker(new GeoCoordinate(51.1612, 2.9795));
            _mapView.AddMarker(new GeoCoordinate(51.1447, 2.9483));

            //_mapView.ZoomToMarkers();

            _routeTrackerAnimator = new RouteTrackerAnimator(_mapView, routeTracker, 5);

            Timer timer = new Timer(250);

            timer.Elapsed += new ElapsedEventHandler(TimerHandler);
            timer.Start();

            SetContentView(layout);
        }
Пример #7
0
        /// <summary>
        /// Raises the create event.
        /// </summary>
        /// <param name="bundle">Bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

//			OsmSharp.IO.Output.OutputStreamHost.RegisterOutputStream (
//				new OsmSharp.Android.UI.IO.Output.ConsoleOutputStream ());

            // create the MapCSS image source.
            var imageSource = new MapCSSDictionaryImageSource();

            imageSource.Add("styles/default/parking.png",
                            Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.images.parking.png"));
            imageSource.Add("styles/default/bus.png",
                            Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.images.bus.png"));
            imageSource.Add("styles/default/postbox.png",
                            Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.images.postbox.png"));

//			// load mapcss style interpreter.
//			var mapCSSInterpreter = new MapCSSInterpreter(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.mapcss"),
//				imageSource);

            // initialize the data source.
            //var dataSource = new MemoryDataSource();
//			var source = new XmlOsmStreamReader(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.osm"));
//			var source = new PBFOsmStreamReader(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.osm.pbf"));
//			dataSource.PullFromSource(source);

            // initialize map.
            var map = new Map();

            //map.AddLayer(new LayerTile(@"http://otile1.mqcdn.com/tiles/1.0.0/osm/{0}/{1}/{2}.png"));
            //map.AddLayer(new OsmLayer(dataSource, mapCSSInterpreter));
//			map.AddLayer(new LayerScene(Scene2DSimple.Deserialize(
//							Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.osm.pbf.scene.simple"), true)));
            map.AddLayer(
                new LayerScene(
                    Scene2DLayered.Deserialize(
                        Assembly.GetExecutingAssembly().GetManifestResourceStream(@"OsmSharp.Android.UI.Sample.wvl.map"), true)));

//			var routingSerializer = new V2RoutingDataSourceLiveEdgeSerializer(true);
//			var graphSerialized = routingSerializer.Deserialize(
//				//Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.osm.pbf.routing.3"));
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.pbf.routing.4"));
////
////			var graphLayer = new LayerDynamicGraphLiveEdge(graphSerialized, mapCSSInterpreter);
////			map.AddLayer(graphLayer);
//
//			// calculate route.
//			Router router = Router.CreateLiveFrom(
//				graphSerialized,
//				new OsmRoutingInterpreter());

//			var routingSerializer = new OsmSharp.Routing.CH.Serialization.Sorted.CHEdgeDataDataSourceSerializer(false);
//			var graphDeserialized = routingSerializer.Deserialize(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.wvl.osm.pbf.routing.ch"), true);
////
//			_router = Router.CreateCHFrom(
//				graphDeserialized, new CHRouter(graphDeserialized),
//				new OsmRoutingInterpreter());

//
//			//GeoCoordinate point1 = new GeoCoordinate(51.158075, 2.961545);
//			//GeoCoordinate point2 = new GeoCoordinate(51.190503, 3.004793);
//			//GeoCoordinate point3 = new GeoCoordinate(51.175967, 2.93733);
//			GeoCoordinate point1 = new GeoCoordinate (50.885726, 3.253426);
//			//GeoCoordinate point2 = new GeoCoordinate (50.88602, 3.218149);
//			GeoCoordinate point2 = new GeoCoordinate (51.1515, 2.9563);
//			GeoCoordinate point3 = new GeoCoordinate(51.34643, 3.28837);
//
//			OsmSharpRoute route1 = router.Calculate(Vehicle.Car,
//			                                       router.Resolve(Vehicle.Car, point1),
//			                                       router.Resolve(Vehicle.Car, point2));
//
//			OsmSharpRoute route2 = router.Calculate(Vehicle.Car,
//			                                       router.Resolve(Vehicle.Car, point1),
//			                                       router.Resolve(Vehicle.Car, point3));
//
//			OsmSharpRoute route3 = router.Calculate(Vehicle.Car,
//			                                        router.Resolve(Vehicle.Car, point2),
//			                                        router.Resolve(Vehicle.Car, point3));
////
////			OsmSharpRoute route = router.Calculate(Vehicle.Car,
////			                                       router.Resolve(Vehicle.Car, new GeoCoordinate(51.15136, 3.19462)),
////			                                       router.Resolve(Vehicle.Car, new GeoCoordinate(51.075023, 3.096632)));
//////			route = router.Calculate(Vehicle.Car,
//////			                         router.Resolve(Vehicle.Car, new GeoCoordinate(51.075023, 3.096632)),
//////			                         router.Resolve(Vehicle.Car, new GeoCoordinate(51.15136, 3.19462)));
////			route = router.Calculate(Vehicle.Car,
////			                         router.Resolve(Vehicle.Car, new GeoCoordinate(51.15136, 3.19462)),
////			                         router.Resolve(Vehicle.Car, new GeoCoordinate(51.075023, 3.096632)));
            _routeLayer = new LayerOsmSharpRoute(map.Projection);
//			osmSharpLayer.AddRoute (route1, SimpleColor.FromKnownColor(KnownColor.Blue).Value);
//			osmSharpLayer.AddRoute (route2, SimpleColor.FromKnownColor(KnownColor.Red).Value);
//			osmSharpLayer.AddRoute (route3, SimpleColor.FromKnownColor(KnownColor.YellowGreen).Value);
            map.AddLayer(_routeLayer);

//			// create gpx layer.
//			LayerGpx gpxLayer = new LayerGpx(map.Projection);
//			gpxLayer.AddGpx(
//				Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Android.UI.Sample.test.gpx"));
//			map.AddLayer(gpxLayer);

//			// set control properties.
//			var mapView = new MapView(this);
//			mapView.MapMaxZoomLevel = 20;
//			mapView.MapMinZoomLevel = 12;
//			//var mapView = new MapGLView (this);
//			mapView.Map = map;
//			//mapView.Center = new GeoCoordinate(51.158075, 2.961545); // gistel
//			//mapView.MapCenter = new GeoCoordinate (50.88672, 3.23899);
//			mapView.MapCenter = new GeoCoordinate(51.26337, 4.78739);
//			//mapView.Center = new GeoCoordinate(51.156803, 2.958887);
//			mapView.MapZoomLevel = 15;

//			var mapView = new OpenGLRenderer2D(
//				this, null);

            //var mapGLView = new MapGLView(this);

            var mapLayout = new MapView(this);

            mapLayout.Map = map;

            mapLayout.MapMaxZoomLevel = 20;
            mapLayout.MapMinZoomLevel = 12;
            //var mapView = new MapGLView (this);
            mapLayout.MapCenter = new GeoCoordinate(51.158075, 2.961545);             // gistel
            //mapView.MapCenter = new GeoCoordinate (50.88672, 3.23899);
            //mapLayout.MapCenter = new GeoCoordinate(51.26337, 4.78739);
            //mapView.Center = new GeoCoordinate(51.156803, 2.958887);
            mapLayout.MapZoomLevel = 15;
            mapLayout.MapTapEvent += delegate(GeoCoordinate geoCoordinate) {
                mapLayout.AddMarker(geoCoordinate).Click += new EventHandler(MapMarkerClicked);
            };

            //Create the user interface in code
            var layout = new RelativeLayout(this);

            //layout.Orientation = Orientation.Vertical;

            //layout.AddView(mapGLView);
            layout.AddView(mapLayout);

//			mapLayout.AddMarker (new GeoCoordinate (51.26337, 4.78739)).Click += new EventHandler (MapMarkerClicked);
//			mapLayout.AddMarker (new GeoCoordinate (51.26785, 4.78025)).Click += new EventHandler (MapMarkerClicked);

            SetContentView(layout);
        }