private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; ShapeFileFeatureLayer austinStreetsShapeLayer = new ShapeFileFeatureLayer(SampleHelper.Get("austinstreets_3857.shp")); austinStreetsShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; austinStreetsShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(LineStyle.CreateSimpleLineStyle(GeoColors.White, 9.2F, GeoColors.DarkGray, 12.2F, true)); ShapeFileFeatureLayer austinStreetsLabelLayer = new ShapeFileFeatureLayer(SampleHelper.Get("austinstreets_3857.shp")); austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; TextStyle textStyle = TextStyle.CreateSimpleTextStyle("FENAME", "Arial", 9, DrawingFontStyles.Regular, GeoColors.Black, 0, 0); textStyle.TextLineSegmentRatio = double.MaxValue; textStyle.SplineType = SplineType.StandardSplining; austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle); LayerOverlay austinStreetsOverlay = new LayerOverlay(); austinStreetsOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)))); austinStreetsOverlay.Layers.Add("AustinStreetsShapeLayer", austinStreetsShapeLayer); austinStreetsOverlay.Layers.Add("AustinStreetsLabelLayer", austinStreetsLabelLayer); mapView.Overlays.Add("AustinStreetsOverlay", austinStreetsOverlay); mapView.CurrentExtent = new RectangleShape(-10874598, 3544465, -10872831, 3543004); mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.CurrentExtent = new RectangleShape(-10881016, 3541873, -10879054, 3540253); ShapeFileFeatureLayer roadLayer = new ShapeFileFeatureLayer(SampleHelper.Get("austinstreets_3857.shp")); roadLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; roadLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.White, 9.2F, GeoColors.DarkGray, 12.2F, true); LayerOverlay roadOverlay = new LayerOverlay(); roadOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)))); roadOverlay.Layers.Add("RoadLayer", roadLayer); mapView.Overlays.Add("RoadOverlay", roadOverlay); InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer(); highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.White, 9.2F, GeoColors.DarkGray, 12.2F, true); highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.InnerPen.Brush = new GeoSolidBrush(GeoColor.FromArgb(150, GeoColors.Blue)); highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay highlightOverlay = new LayerOverlay(); highlightOverlay.Layers.Add("HighlightLayer", highlightLayer); mapView.Overlays.Add("HighlightOverlay", highlightOverlay); PopupOverlay popupOverlay = new PopupOverlay(); mapView.Overlays.Add("PopupOverlay", popupOverlay); mapView.Refresh(); }
private void Form_Load(object sender, EventArgs e) { // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Set the map's unit of measurement to meters (Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Create a new feature layer to display the shapes we will be reprojecting InMemoryFeatureLayer reprojectedFeaturesLayer = new InMemoryFeatureLayer(); // Add a point, line, and polygon style to the layer. These styles control how the shapes will be drawn reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Star, 24, GeoBrushes.MediumPurple, GeoPens.Purple); reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.MediumPurple, 6, false); reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColors.MediumPurple), GeoColors.MediumPurple, 2); // Apply these styles on all zoom levels. This ensures our shapes will be visible on all zoom levels reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add the layer to an overlay LayerOverlay reprojectedFeaturesOverlay = new LayerOverlay(); reprojectedFeaturesOverlay.Layers.Add("Reprojected Features Layer", reprojectedFeaturesLayer); // Add the overlay to the map mapView.Overlays.Add("Reprojected Features Overlay", reprojectedFeaturesOverlay); // Set the map extent mapView.CurrentExtent = new RectangleShape(-10779751.80, 3915369.33, -10779407.60, 3915141.57); txtWkt.Text = "POINT(-96.834516 33.150083)\r\nLINESTRING(-96.83559 33.149, -96.835866046134 33.1508413556856, -96.835793626491 33.1508974965687, -96.8336008970734 33.1511063402186, -96.83356 33.15109, -96.83328 33.14922)\r\nPOLYGON((-96.83582 33.1508, -96.83578 33.15046, -96.83353 33.15068, -96.83358 33.15102, -96.83582 33.1508))"; }
private void MapView_Loaded(object sender, RoutedEventArgs e) { try { mapView.MapUnit = GeographyUnit.Meter; mapView.CurrentExtent = new RectangleShape(2149408.38465815, 246471.365609125, 2204046.63635703, 213231.081162168); PersonalGeoDatabaseFeatureLayer worldLayer = new PersonalGeoDatabaseFeatureLayer(SampleHelper.Get("wsb57.mdb")); worldLayer.EnableEmbeddedStyle = false; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.LightGray); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColor.FromArgb(255, 169, 195, 221), 2F, GeoColors.Black, 4F, false); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateCompoundPointStyle(PointSymbolType.Square, GeoColors.White, GeoColors.Black, 1F, 6F, PointSymbolType.Square, GeoColors.Maroon, GeoColors.Transparent, 0F, 2F); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.Open(); LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.DrawingExceptionMode = DrawingExceptionMode.DrawException; worldOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)))); worldOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); mapView.CurrentExtent = worldOverlay.GetBoundingBox(); mapView.Refresh(); } catch (FileNotFoundException ex) { string message = "You have to reference ThinkGeo.PersonalGeoDatabase.nupkg\r\n\r\n" + ex.Message; MessageBox.Show(message, "FileNotFound", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, (MessageBoxOptions)0); } }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; ShapeFileFeatureLayer austinStreetsShapeLayer = new ShapeFileFeatureLayer(SampleHelper.Get("austinstreets_3857.shp")); austinStreetsShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; austinStreetsShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(LineStyle.CreateSimpleLineStyle(GeoColors.White, 9.2F, GeoColors.DarkGray, 12.2F, true)); ShapeFileFeatureLayer austinStreetsLabelLayer = new ShapeFileFeatureLayer(SampleHelper.Get("austinstreets_3857.shp")); austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyle.CreateSimpleTextStyle("FENAME", "Arial", 9, DrawingFontStyles.Regular, GeoColors.Black, 0, 0)); austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)))); staticOverlay.Layers.Add("AustinStreetsShapeLayer", austinStreetsShapeLayer); staticOverlay.Layers.Add("AustinStreetsLabelLayer", austinStreetsLabelLayer); mapView.Overlays.Add(staticOverlay); mapView.CurrentExtent = new RectangleShape(-10881385, 3542247, -10880501, 3541517); mapView.Refresh(); }
private void mapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); mapView.CurrentExtent = new RectangleShape(-15495673, 20037508, 13458526, -20037508); // Create background world map with vector tile requested from ThinkGeo Cloud Service. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Setup the shapefile layer. ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green)); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Setup the mapshape layer. InMemoryFeatureLayer bitmapLayer = new InMemoryFeatureLayer(); bitmapLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Image; bitmapLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = new GeoImage(SampleHelper.Get("Prop Plane.png")); bitmapLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 1F, LineDashStyle.Dash, false); bitmapLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ProjectionConverter project = new ProjectionConverter(4326, 3857); project.Open(); PointShape planeShape = new PointShape(-95.2806, 38.9554); PointShape destinationPoint = new PointShape(36.04, 48.49); MultilineShape airLineShape = (MultilineShape)project.ConvertToExternalProjection(planeShape.GreatCircle(destinationPoint)); airLineShape.Id = "AirLine"; bitmapLayer.Open(); bitmapLayer.EditTools.BeginTransaction(); bitmapLayer.EditTools.Add(new Feature(project.ConvertToExternalProjection(planeShape).GetWellKnownBinary(), "Plane")); bitmapLayer.EditTools.Add(new Feature(airLineShape.GetWellKnownBinary(), "AirLine")); bitmapLayer.EditTools.CommitTransaction(); bitmapLayer.Close(); project.Close(); LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); LayerOverlay planeOverlay = new LayerOverlay(); planeOverlay.TileType = TileType.SingleTile; planeOverlay.Layers.Add("BitmapLayer", bitmapLayer); mapView.Overlays.Add("PlaneOverlay", planeOverlay); mapView.Refresh(); timer.Start(); }
/// <summary> /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the friscoParks, stadiumLayer, and /// shortestLineLayer layers into a grouped LayerOverlay and display it on the map. /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); ShapeFileFeatureLayer friscoParks = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/Parks.shp")); InMemoryFeatureLayer stadiumLayer = new InMemoryFeatureLayer(); InMemoryFeatureLayer shortestLineLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project friscoParks layer to Spherical Mercator to match the map projection friscoParks.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Style friscoParks layer friscoParks.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(64, GeoColors.Green), GeoColors.DimGray); friscoParks.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style stadiumLayer stadiumLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.Blue, 16, GeoColors.White, 4); stadiumLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style shortestLineLayer shortestLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 2, false); shortestLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add friscoParks layer to a LayerOverlay layerOverlay.Layers.Add("friscoParks", friscoParks); // Add stadiumLayer layer to a LayerOverlay layerOverlay.Layers.Add("stadiumLayer", stadiumLayer); // Add shortestLineLayer to the layerOverlay layerOverlay.Layers.Add("shortestLineLayer", shortestLineLayer); // Set the map extent mapView.CurrentExtent = new RectangleShape(-10782307.6877106, 3918904.87378907, -10774377.3460701, 3912073.31442403); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); // Add Toyota Stadium feature to stadiumLayer var stadium = new Feature(new PointShape(-10779651.500992451, 3915933.0023557912)); stadiumLayer.InternalFeatures.Add(stadium); mapView.Refresh(); }
/// <summary> /// Set up the map with the ThinkGeo Cloud Maps overlay, as well as a feature layer to display the route /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Set the map's unit of measurement to meters (Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Create a new feature layer to display the route InMemoryFeatureLayer routingLayer = new InMemoryFeatureLayer(); // Add styles to display the route and waypoints // Add a point, line, and text style to the layer. These styles control how the route will be drawn and labeled routingLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Star, 24, GeoBrushes.MediumPurple, GeoPens.Purple); routingLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.MediumPurple, 3, false); routingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyle.CreateMaskTextStyle("SequenceNumber", new GeoFont("Verdana", 20), GeoBrushes.White, AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(90, GeoColors.Black), GeoColors.Black, 2), 0, 0); routingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.TextPlacement = TextPlacement.Upper; routingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.YOffsetInPixel = -8; routingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.OverlappingRule = LabelOverlappingRule.AllowOverlapping; routingLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Create a feature layer to highlight selected features InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer(); // Add styles to display the highlighted route features highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.BrightYellow, 6, GeoColors.Black, 2, false); highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add the layers to an overlay, and add the overlay to the mapview LayerOverlay routingOverlay = new LayerOverlay(); routingOverlay.Layers.Add("Routing Layer", routingLayer); routingOverlay.Layers.Add("Highlight Layer", highlightLayer); mapView.Overlays.Add("Routing Overlay", routingOverlay); // Set the map extent to Frisco, TX mapView.CurrentExtent = new RectangleShape(-10782288.5963252, 3917613.16813763, -10777138.4036748, 3913574.08186237); // Initialize the RoutingCloudClient with our ThinkGeo Cloud Client credentials routingCloudClient = new RoutingCloudClient("FSDgWMuqGhZCmZnbnxh-Yl1HOaDQcQ6mMaZZ1VkQNYw~", "IoOZkBJie0K9pz10jTRmrUclX6UYssZBeed401oAfbxb9ufF1WVUvg~~"); // Run the routing request RouteWaypoints(); mapView.Refresh(); }
/// <summary> /// TODO: Update sample once API has been ported /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); ShapeFileFeatureLayer cityLimits = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/FriscoCityLimits.shp")); ShapeFileFeatureLayer adminBoundaries = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/FriscoMunBnd/FriscoAdminBoundaries.shp")); InMemoryFeatureLayer splitLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project cityLimits layer to Spherical Mercator to match the map projection cityLimits.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Project adminBoundaries layer to Spherical Mercator to match the map projection adminBoundaries.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Style cityLimits layer cityLimits.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Orange), GeoColors.DimGray); cityLimits.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style adminBoundaries layer adminBoundaries.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 2, false); adminBoundaries.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style the splitLayer splitLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Green), GeoColors.DimGray); splitLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add cityLimits to a LayerOverlay layerOverlay.Layers.Add("cityLimits", cityLimits); // Add splitLayer to the layerOverlay layerOverlay.Layers.Add("splitLayer", splitLayer); // Set the map extent to the cityLimits layer bounding box cityLimits.Open(); mapView.CurrentExtent = cityLimits.GetBoundingBox(); cityLimits.Close(); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); mapView.Refresh(); }
private void Form_Load(object sender, EventArgs e) { // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); ShapeFileFeatureLayer friscoParks = new ShapeFileFeatureLayer(@"../../../Data/Shapefile/Parks.shp"); InMemoryFeatureLayer stadiumLayer = new InMemoryFeatureLayer(); InMemoryFeatureLayer shortestLineLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project friscoParks layer to Spherical Mercator to match the map projection friscoParks.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Style friscoParks layer friscoParks.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(64, GeoColors.Green), GeoColors.DimGray); friscoParks.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style stadiumLayer stadiumLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.Blue, 16, GeoColors.White, 4); stadiumLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style shortestLineLayer shortestLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 2, false); shortestLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add friscoParks layer to a LayerOverlay layerOverlay.Layers.Add("friscoParks", friscoParks); // Add stadiumLayer layer to a LayerOverlay layerOverlay.Layers.Add("stadiumLayer", stadiumLayer); // Add shortestLineLayer to the layerOverlay layerOverlay.Layers.Add("shortestLineLayer", shortestLineLayer); // Set the map extent mapView.CurrentExtent = new RectangleShape(-10782307.6877106, 3918904.87378907, -10774377.3460701, 3912073.31442403); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); // Add Toyota Stadium feature to stadiumLayer var stadium = new Feature(new PointShape(-10779651.500992451, 3915933.0023557912)); stadiumLayer.InternalFeatures.Add(stadium); }
private LayerOverlay CreateHighlightLayerOverlay(Feature feature) { LayerOverlay highlightOverlay = new LayerOverlay(); InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer(); //GeoHatchBrush fillBrush = new GeoHatchBrush(GeoHatchStyle.Cross, GeoColor.FromArgb(100, 0, 255, 0)); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateHatchStyle(GeoHatchStyle.BackwardDiagonal, GeoColor.FromArgb(150, 254, 255, 39), GeoColors.Transparent); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColor.FromArgb(50, GeoColors.Green), 3, false); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; inMemoryFeatureLayer.InternalFeatures.Add(feature); highlightOverlay.Layers.Add(inMemoryFeatureLayer); return(highlightOverlay); }
private void Form_Load(object sender, EventArgs e) { // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); ShapeFileFeatureLayer cityLimits = new ShapeFileFeatureLayer(@"../../../Data/Shapefile/FriscoCityLimits.shp"); ShapeFileFeatureLayer adminBoundaries = new ShapeFileFeatureLayer(@"../../../Data/FriscoMunBnd/FriscoAdminBoundaries.shp"); InMemoryFeatureLayer splitLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project cityLimits layer to Spherical Mercator to match the map projection cityLimits.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Project adminBoundaries layer to Spherical Mercator to match the map projection adminBoundaries.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Style cityLimits layer cityLimits.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Orange), GeoColors.DimGray); cityLimits.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style adminBoundaries layer adminBoundaries.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 2, false); adminBoundaries.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style the splitLayer splitLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Green), GeoColors.DimGray); splitLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add cityLimits to a LayerOverlay layerOverlay.Layers.Add("cityLimits", cityLimits); // Add splitLayer to the layerOverlay layerOverlay.Layers.Add("splitLayer", splitLayer); // Set the map extent to the cityLimits layer bounding box cityLimits.Open(); mapView.CurrentExtent = cityLimits.GetBoundingBox(); cityLimits.Close(); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); }
/// <summary> /// Set up feature layers in the MapView to display the validated features /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Set the map's unit of measurement to Decimal Degree mapView.MapUnit = GeographyUnit.DecimalDegree; // Create an InMemoryFeatureLayer to hold the shapes to be validated // Add styles to display points, lines, and polygons on this layer in green InMemoryFeatureLayer validatedFeaturesLayer = new InMemoryFeatureLayer(); validatedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.Green, 12, GeoColors.Green); validatedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(50, GeoColors.Green), GeoColors.Green); validatedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Green, 3, false); validatedFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Create an InMemoryFeatureLayer to hold the shapes to perform the validation against // Add styles to display points, lines, and polygons on this layer in blue InMemoryFeatureLayer filterFeaturesLayer = new InMemoryFeatureLayer(); filterFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.Blue, 12, GeoColors.Blue); filterFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(50, GeoColors.Blue), GeoColors.Blue); filterFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Blue, 3, false); filterFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Create an InMemoryFeatureLayer to hold the resultf features from the validation API // Add styles to display points, lines, and polygons on this layer in red InMemoryFeatureLayer resultFeaturesLayer = new InMemoryFeatureLayer(); resultFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.Red, 12, GeoColors.Red); resultFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(50, GeoColors.Red), GeoColors.Red); resultFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 3, false); resultFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add the layers to an overlay, and add the overlay to the map LayerOverlay featuresOverlay = new LayerOverlay(); featuresOverlay.Layers.Add("Filter Features", filterFeaturesLayer); featuresOverlay.Layers.Add("Validated Features", validatedFeaturesLayer); featuresOverlay.Layers.Add("Result Features", resultFeaturesLayer); mapView.Overlays.Add("Features Overlay", featuresOverlay); rdoCheckIfPointsAreTouchingLines.IsChecked = true; mapView.Refresh(); }
/// <summary> /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the railway and subLineLayer layers into a /// grouped LayerOverlay and display them on the map. /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); InMemoryFeatureLayer railway = new InMemoryFeatureLayer(); InMemoryFeatureLayer subLineLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Add the rail line feature to the railway layer railway.InternalFeatures.Add(new Feature("LineString (-10776730.91861553490161896 3925750.69222266925498843, -10778989.31895966082811356 3915278.00731692276895046, -10781766.12723691388964653 3909228.15506267035380006, -10782065.98029803484678268 3907458.59967381786555052, -10781867.48601813986897469 3905465.21030976390466094)")); // Style railway layer railway.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 2, false); railway.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style the subLineLayer subLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Green, 2, false); subLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add railway to the layerOverlay layerOverlay.Layers.Add("railway", railway); // Add subLineLayer to the layerOverlay layerOverlay.Layers.Add("subLineLayer", subLineLayer); // Set the map extent to the railway layer bounding box railway.Open(); mapView.CurrentExtent = railway.GetBoundingBox(); railway.Close(); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); mapView.Refresh(); }
private void mapView_Loaded(object sender, RoutedEventArgs e) { var connectionString = @"Data Source=\\192.168.0.3\Internal Test Data\Sqlite\Mapping.sqlite"; var ne_road10m_linestring = new SqliteFeatureLayer(connectionString, "Segments", "geomID", "geom"); ne_road10m_linestring.Name = ne_road10m_linestring.TableName; ne_road10m_linestring.WhereClause = $"WHERE ReplicationState = 1"; ne_road10m_linestring.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(LineStyle.CreateSimpleLineStyle(GeoColors.Black, 2, true)); ne_road10m_linestring.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; var layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(ne_road10m_linestring); mapView.Overlays.Add(layerOverlay); mapView.MapUnit = GeographyUnit.Meter; mapView.CurrentExtent = new RectangleShape(-8336043.617221244, 5212990.090742311, -8328829.872716907, 5207266.868281254); mapView.Refresh(); }
/// <summary> /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the friscoTrails and selectedLineLayer layers /// into a grouped LayerOverlay and display it on the map. /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); ShapeFileFeatureLayer friscoTrails = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/Hike_Bike.shp")); InMemoryFeatureLayer selectedLineLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project friscoTrails layer to Spherical Mercator to match the map projection friscoTrails.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Style friscoTrails layer friscoTrails.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Orange, 2, false); friscoTrails.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style selectedLineLayer selectedLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Green, 2, false); selectedLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add friscoTrails layer to a LayerOverlay layerOverlay.Layers.Add("friscoTrails", friscoTrails); // Add selectedLineLayer to the layerOverlay layerOverlay.Layers.Add("selectedLineLayer", selectedLineLayer); // Set the map extent mapView.CurrentExtent = new RectangleShape(-10782307.6877106, 3918904.87378907, -10774377.3460701, 3912073.31442403); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); mapView.Refresh(); }
private void btnDisplay_Click(object sender, EventArgs e) { ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(txtInputShapeFile.Text); shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.LightYellow, GeoColors.Black); shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Black, 2, true); shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.Transparent, 7, GeoColors.Black); shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; shapeFileFeatureLayer.Open(); if (shapeFileFeatureLayer.Projection != null) { shapeFileFeatureLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(shapeFileFeatureLayer.Projection.ProjString, 3857); shapeFileFeatureLayer.FeatureSource.ProjectionConverter.Open(); } LayerOverlay shapeFileOverlay = (LayerOverlay)(mapView1.Overlays["shapeFileOverlay"]); shapeFileOverlay.TileBuffer = 0; shapeFileOverlay.Layers.Add(shapeFileFeatureLayer); ThinkGeoMBTilesLayer thinkGeoMBTilesLayer = new ThinkGeoMBTilesLayer(txtMbtilesFilePathname.Text, new Uri(@"./SimpleRenderer.json", UriKind.Relative)); LayerOverlay mbtilesOverlay = (LayerOverlay)(mapView1.Overlays["mbtilesOverlay"]); mbtilesOverlay.TileBuffer = 0; mbtilesOverlay.Layers.Add(thinkGeoMBTilesLayer); mapView1.MapUnit = GeographyUnit.Meter; shapeFileFeatureLayer.Open(); mapView1.CurrentExtent = shapeFileFeatureLayer.GetBoundingBox(); mapView1.Refresh(); ckbDisplayShapeFile.Enabled = true; ckbDisplayMbtiles.Enabled = true; string jsonFile = File.ReadAllText(@".\SimpleRenderer.json"); tbxJson.Text = jsonFile; }
private void mapView_Loaded(object sender, RoutedEventArgs e) { var tinyGeoFeatureLayer = new TinyGeoFeatureLayer(SampleHelper.Get("Frisco.tgeo")); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Black, 1, true); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; tinyGeoFeatureLayer.Open(); var currentExtent = tinyGeoFeatureLayer.GetBoundingBox(); tinyGeoFeatureLayer.Close(); var layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(tinyGeoFeatureLayer); mapView.Overlays.Add(layerOverlay); mapView.MapUnit = GeographyUnit.DecimalDegree; mapView.CurrentExtent = currentExtent; mapView.Refresh(); }
private void sampleFileListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { GpxFeatureLayer shapeLayer = new GpxFeatureLayer(SampleHelper.Get(sampleFileListBox.SelectedItem.ToString())); shapeLayer.FeatureSource.ProjectionConverter = projectionConverter; ValueStyle pointStyle = new ValueStyle(); pointStyle.ColumnName = "IsWayPoint"; pointStyle.ValueItems.Add(new ValueItem("0", PointStyle.CreateSimplePointStyle(PointSymbolType.Circle, GeoColors.Red, 4))); pointStyle.ValueItems.Add(new ValueItem("1", PointStyle.CreateSimplePointStyle(PointSymbolType.Circle, GeoColors.Green, 8))); LineStyle roadstyle = LineStyle.CreateSimpleLineStyle(GeoColors.Black, 1, true); shapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pointStyle); shapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(roadstyle); shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; GpxFeatureLayer textLayer = new GpxFeatureLayer(SampleHelper.Get(sampleFileListBox.SelectedItem.ToString())); textLayer.FeatureSource.ProjectionConverter = projectionConverter; TextStyle labelStyle = TextStyle.CreateSimpleTextStyle("name", "Arial", 8, DrawingFontStyles.Bold, GeoColors.Black); labelStyle.TextPlacement = TextPlacement.Upper; labelStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; labelStyle.YOffsetInPixel = 8; textLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(labelStyle); textLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; shapeLayer.Open(); mapView.CurrentExtent = (shapeLayer.GetBoundingBox()); var gpsOverlay = (LayerOverlay)mapView.Overlays["GPSOverlay"]; gpsOverlay.Layers.Clear(); gpsOverlay.Layers.Add(shapeLayer); gpsOverlay.Layers.Add(textLayer); mapView.Refresh(); }
private void Form_Load(object sender, EventArgs e) { // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); InMemoryFeatureLayer railway = new InMemoryFeatureLayer(); InMemoryFeatureLayer subLineLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Add the rail line feature to the railway layer railway.InternalFeatures.Add(new Feature("LineString (-10776730.91861553490161896 3925750.69222266925498843, -10778989.31895966082811356 3915278.00731692276895046, -10781766.12723691388964653 3909228.15506267035380006, -10782065.98029803484678268 3907458.59967381786555052, -10781867.48601813986897469 3905465.21030976390466094)")); // Style railway layer railway.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 2, false); railway.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style the subLineLayer subLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Green, 2, false); subLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add railway to the layerOverlay layerOverlay.Layers.Add("railway", railway); // Add subLineLayer to the layerOverlay layerOverlay.Layers.Add("subLineLayer", subLineLayer); // Set the map extent to the railway layer bounding box railway.Open(); mapView.CurrentExtent = railway.GetBoundingBox(); railway.Close(); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); }
/// <summary> /// Setup the map with the ThinkGeo Cloud Maps overlay to show a basic map /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Set the map extent mapView.CurrentExtent = new RectangleShape(-10786436, 3918518, -10769429, 3906002); LayerOverlay layerOverlay; InMemoryFeatureLayer featureLayer; // Create the layer that will store the drawn shapes featureLayer = new InMemoryFeatureLayer(); // Add styles for the layer featureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.Blue, 8, GeoColors.Black); featureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Blue, 4, true); featureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.Blue, GeoColors.Black); featureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add the layer to a LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add("featureLayer", featureLayer); // Add the LayerOverlay to the map mapView.Overlays.Add("layerOverlay", layerOverlay); // Update instructions instructions.Text = "Navigation Mode - The default map state. Allows you to pan and zoom the map with mouse controls."; mapView.Refresh(); }
/// <summary> /// Set up the map with the ThinkGeo Cloud Maps overlay and a feature layer for the reprojected features /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Set the map's unit of measurement to meters (Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Create a new feature layer to display the shapes we will be reprojecting InMemoryFeatureLayer reprojectedFeaturesLayer = new InMemoryFeatureLayer(); // Add a point, line, and polygon style to the layer. These styles control how the shapes will be drawn reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Star, 24, GeoBrushes.MediumPurple, GeoPens.Purple); reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.MediumPurple, 6, false); reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColors.MediumPurple), GeoColors.MediumPurple, 2); // Apply these styles on all zoom levels. This ensures our shapes will be visible on all zoom levels reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add the layer to an overlay LayerOverlay reprojectedFeaturesOverlay = new LayerOverlay(); reprojectedFeaturesOverlay.Layers.Add("Reprojected Features Layer", reprojectedFeaturesLayer); // Add the overlay to the map mapView.Overlays.Add("Reprojected Features Overlay", reprojectedFeaturesOverlay); // Set the map extent mapView.CurrentExtent = new RectangleShape(-10798419.605087, 3934270.12359632, -10759021.6785336, 3896039.57306867); // Initialize the ProjectionCloudClient with our ThinkGeo Cloud credentials projectionCloudClient = new ProjectionCloudClient("FSDgWMuqGhZCmZnbnxh-Yl1HOaDQcQ6mMaZZ1VkQNYw~", "IoOZkBJie0K9pz10jTRmrUclX6UYssZBeed401oAfbxb9ufF1WVUvg~~"); mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.DecimalDegree; mapView.CurrentExtent = new RectangleShape(-180, 90, 180, -90); string connectString = "OCI:system/[email protected]/orcl"; OracleFeatureLayer oracleLayer = new OracleFeatureLayer(connectString); oracleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 156, 155, 154), 1); oracleLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColor.FromArgb(255, 169, 195, 221), 2F, GeoColors.Black, 4F, false); oracleLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; oracleLayer.FeatureIdFieldName = "ID"; oracleLayer.ActiveLayer = "COUNTRY02"; oracleLayer.EnableEmbeddedStyle = false; LayerOverlay oracleOverlay = new LayerOverlay(); oracleOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.ShallowOcean))); oracleOverlay.Layers.Add("OracleLayer", oracleLayer); mapView.Overlays.Add("OracleOverlay", oracleOverlay); mapView.Refresh(); }
private void Form_Load(object sender, EventArgs e) { // Set the map's unit of measurement to meters(Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Add Cloud Maps as a background overlay var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); ShapeFileFeatureLayer friscoTrails = new ShapeFileFeatureLayer(@"../../../Data/Shapefile/Hike_Bike.shp"); InMemoryFeatureLayer selectedLineLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project friscoTrails layer to Spherical Mercator to match the map projection friscoTrails.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Style friscoTrails layer friscoTrails.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Orange, 2, false); friscoTrails.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style selectedLineLayer selectedLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Green, 2, false); selectedLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add friscoTrails layer to a LayerOverlay layerOverlay.Layers.Add("friscoTrails", friscoTrails); // Add selectedLineLayer to the layerOverlay layerOverlay.Layers.Add("selectedLineLayer", selectedLineLayer); // Set the map extent mapView.CurrentExtent = new RectangleShape(-10782307.6877106, 3918904.87378907, -10774377.3460701, 3912073.31442403); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); }
/// <summary> /// Set up the map with the ThinkGeo Cloud Maps overlay to show a basic map /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Set the map's unit of measurement to meters (Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Create a new feature layer to display the shapes we will be reprojecting InMemoryFeatureLayer reprojectedFeaturesLayer = new InMemoryFeatureLayer(); // Add a point, line, and polygon style to the layer. These styles control how the shapes will be drawn reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Star, 24, GeoBrushes.MediumPurple, GeoPens.Purple); reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.MediumPurple, 6, false); reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColors.MediumPurple), GeoColors.MediumPurple, 2); // Apply these styles on all zoom levels. This ensures our shapes will be visible on all zoom levels reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add the layer to an overlay LayerOverlay reprojectedFeaturesOverlay = new LayerOverlay(); reprojectedFeaturesOverlay.Layers.Add("Reprojected Features Layer", reprojectedFeaturesLayer); // Add the overlay to the map mapView.Overlays.Add("Reprojected Features Overlay", reprojectedFeaturesOverlay); // Set the map extent mapView.CurrentExtent = new RectangleShape(-10779751.80, 3915369.33, -10779407.60, 3915141.57); mapView.Refresh(); }
private void mapView_Loaded(object sender, RoutedEventArgs e) { //Add a base map (ThinkGeo's online World Map Kit). mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); // Please input your ThinkGeo Cloud Client ID / Client Secret to enable the background map. // Create background world map with vector tile requested from ThinkGeo Cloud Service. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); //Build up the test data. InMemoryFeatureLayer testData = setupTestData(); //Make test line red in color. testData.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Red, 6, false); //Make test point dark green in color. testData.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.DarkGreen, 12); //Apply the above styles to all zoom levels. testData.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; //Create a MapShapeLayer that we can style individually and which will hold the results of the shortest line and split lines. MapShapeLayer results = new MapShapeLayer(); //Add the test data and results layers to a new layer overlay so they will show on top of the base map. LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add("TestData", testData); layerOverlay.Layers.Add("Results", results); mapView.Overlays.Add("layerOverlay", layerOverlay); //Zoom into the test data area. mapView.CurrentExtent = testData.GetBoundingBox(); mapView.Refresh(); }
/// <summary> /// Set up the map with the ThinkGeo Cloud Maps overlay, as well as a feature layer to display the route /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Set the map's unit of measurement to meters (Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Create a new feature layer to display the route InMemoryFeatureLayer routingLayer = new InMemoryFeatureLayer(); // Add point, line, and text styles to display the waypoints, route, and labels for the route routingLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Star, 24, GeoBrushes.MediumPurple, GeoPens.Purple); routingLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.MediumPurple, 3, false); routingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyle.CreateMaskTextStyle("SequenceNumber", new GeoFont("Verdana", 20), GeoBrushes.White, AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(90, GeoColors.Black), GeoColors.Black, 2), 0, 0); routingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.TextPlacement = TextPlacement.Upper; routingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.YOffsetInPixel = -1; routingLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.OverlappingRule = LabelOverlappingRule.AllowOverlapping; routingLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Create a feature layer to highlight selected features InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer(); // Add styles to display the highlighted route features highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.BrightYellow, 6, GeoColors.Black, 2, false); highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add the layer to an overlay, and add the overlay to the mapview LayerOverlay routingOverlay = new LayerOverlay(); routingOverlay.Layers.Add("Routing Layer", routingLayer); routingOverlay.Layers.Add("Highlight Layer", highlightLayer); mapView.Overlays.Add("Routing Overlay", routingOverlay); // Create a set of preset waypoints to route through routingWaypoints = new Collection <PointShape>() { new PointShape(-10776986.85, 3908680.24), new PointShape(-10776836.12, 3912348.04), new PointShape(-10778917.01, 3909965.17), new PointShape(-10779631.80, 3915721.82), new PointShape(-10774900.61, 3912552.36) }; // Add the waypoints to the map to be displayed foreach (PointShape routingWaypoint in routingWaypoints) { routingLayer.InternalFeatures.Add(new Feature(routingWaypoint)); } // Set the map extent to Frisco, TX mapView.CurrentExtent = new RectangleShape(-10798419.605087, 3934270.12359632, -10759021.6785336, 3896039.57306867); // Initialize the RoutingCloudClient with our ThinkGeo Cloud Client credentials routingCloudClient = new RoutingCloudClient("FSDgWMuqGhZCmZnbnxh-Yl1HOaDQcQ6mMaZZ1VkQNYw~", "IoOZkBJie0K9pz10jTRmrUclX6UYssZBeed401oAfbxb9ufF1WVUvg~~"); // Run the routing request RouteWaypoints(); mapView.Refresh(); }
/// <summary> /// Set up the map with the ThinkGeo Cloud Maps overlay, as well as several feature layers to display the reverse geocoding search area and locations /// </summary> protected override void OnAppearing() { base.OnAppearing(); // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Set the map's unit of measurement to meters (Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Create a new feature layer to display the search radius of the reverse geocode and create a style for it InMemoryFeatureLayer searchRadiusFeatureLayer = new InMemoryFeatureLayer(); searchRadiusFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(new GeoColor(100, GeoColors.Blue)), new GeoSolidBrush(new GeoColor(10, GeoColors.Blue))); searchRadiusFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Cross, 20, GeoBrushes.Red); searchRadiusFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Create a new feature layer to display selected locations returned from the reverse geocode and create styles for it InMemoryFeatureLayer selectedResultItemFeatureLayer = new InMemoryFeatureLayer(); // Add a point, line, and polygon style to the layer. These styles control how the shapes will be drawn selectedResultItemFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Star, 24, GeoBrushes.MediumPurple, GeoPens.Purple); selectedResultItemFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.MediumPurple, 6, false); selectedResultItemFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColors.MediumPurple), GeoColors.MediumPurple, 2); selectedResultItemFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Create an overlay and add the feature layers to it LayerOverlay searchFeaturesOverlay = new LayerOverlay(); searchFeaturesOverlay.Layers.Add("Search Radius", searchRadiusFeatureLayer); searchFeaturesOverlay.Layers.Add("Result Feature Geometry", selectedResultItemFeatureLayer); // Create a popup overlay to display the best match PopupOverlay bestMatchPopupOverlay = new PopupOverlay(); // Add the overlays to the map mapView.Overlays.Add("Search Features Overlay", searchFeaturesOverlay); mapView.Overlays.Add("Best Match Popup Overlay", bestMatchPopupOverlay); // Set the map extent to Frisco, TX mapView.CurrentExtent = new RectangleShape(-10780022.026198, 3915814.54657467, -10779119.113802, 3914667.51342533); // Initialize the ReverseGeocodingCloudClient with our ThinkGeo Cloud credentials reverseGeocodingCloudClient = new ReverseGeocodingCloudClient("FSDgWMuqGhZCmZnbnxh-Yl1HOaDQcQ6mMaZZ1VkQNYw~", "IoOZkBJie0K9pz10jTRmrUclX6UYssZBeed401oAfbxb9ufF1WVUvg~~"); cboLocationCategories.SelectedIndex = 0; mapView.Refresh(); }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { //Get a reference to the results MapShapeLayer and clear it so we can display our new results. MapShapeLayer results = (MapShapeLayer)((LayerOverlay)mapView.Overlays["layerOverlay"]).Layers["Results"]; results.MapShapes.Clear(); //Get a reference to the test data layer. InMemoryFeatureLayer testDataLayer = (InMemoryFeatureLayer)((LayerOverlay)mapView.Overlays["layerOverlay"]).Layers["TestData"]; //Check to see if the test data has been edited. if (mapView.EditOverlay.EditShapesLayer.InternalFeatures.Count > 0) { //Loop through the edited test data and update the test data layer. testDataLayer.EditTools.BeginTransaction(); foreach (Feature feature in mapView.EditOverlay.EditShapesLayer.InternalFeatures) { testDataLayer.EditTools.Update(feature.CloneDeep()); } testDataLayer.EditTools.CommitTransaction(); //Clear out the EditOverlay since we are done editing. mapView.EditOverlay.EditShapesLayer.InternalFeatures.Clear(); //Since we are done editing, turn visibility back on the for the layer overlay so we can see our test data again. mapView.Overlays["layerOverlay"].IsVisible = true; } //Get the test point feature from the test data layer. Feature testPointFeature = testDataLayer.QueryTools.GetFeaturesByColumnValue("Name", "TestPoint", ReturningColumnsType.AllColumns)[0]; //Get the test line feature from the test data layer. Feature testLineFeature = testDataLayer.QueryTools.GetFeaturesByColumnValue("Name", "TestLine", ReturningColumnsType.AllColumns)[0]; //Take the test line feature and create a line shape so we can use line-specific APIs for finding the shortest line and line-on-line. LineShape testLine = new MultilineShape(testLineFeature.GetWellKnownText()).Lines[0]; //Calculate the shortest line between our test line and test point. LineShape shortestLineResult = testLine.GetShortestLineTo(testPointFeature.GetShape(), GeographyUnit.Meter).Lines[0]; //Take the result and create a MapShape so we can display the shortest line on the map in a blue color. MapShape shortestLine = new MapShape(new Feature(shortestLineResult)); shortestLine.ZoomLevels.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Blue, 4, false); shortestLine.ZoomLevels.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; results.MapShapes.Add("ShortestLine", shortestLine); string message = "Length of Blue Line is: " + shortestLineResult.GetLength(GeographyUnit.Meter, DistanceUnit.Kilometer).ToString() + " KM" + '\n'; //Split the test line from the left side based on where the shortest line touches it. LineBaseShape leftSideOfLineResult = testLine.GetLineOnALine(new PointShape(testLine.Vertices[0]), new PointShape(shortestLineResult.Vertices[0])); //Make sure the split was valid and the closest point wasn't at the beginning or end of the line. if (leftSideOfLineResult.Validate(ShapeValidationMode.Simple).IsValid) { MapShape leftSideOfLine = new MapShape(new Feature(leftSideOfLineResult)); leftSideOfLine.ZoomLevels.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Green, 2, false); leftSideOfLine.ZoomLevels.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; results.MapShapes.Add("LeftSideofLine", leftSideOfLine); message += "Length of Green Line is: " + leftSideOfLineResult.GetLength(GeographyUnit.Meter, DistanceUnit.Kilometer).ToString() + " KM" + '\n'; } //Split the test line from the right side based on where the shortest line touches it. LineBaseShape rightSideOfLineResult = testLine.GetLineOnALine(new PointShape(shortestLineResult.Vertices[0]), new PointShape(testLine.Vertices[testLine.Vertices.Count - 1])); //Make sure the split was valid and the closest point wasn't at the beginning or end of the line. if (rightSideOfLineResult.Validate(ShapeValidationMode.Simple).IsValid) { MapShape rightSideOfLine = new MapShape(new Feature(rightSideOfLineResult)); rightSideOfLine.ZoomLevels.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Yellow, 2, false); rightSideOfLine.ZoomLevels.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; results.MapShapes.Add("RightSideofLine", rightSideOfLine); message += "Length of Yellow Line is: " + rightSideOfLineResult.GetLength(GeographyUnit.Meter, DistanceUnit.Kilometer).ToString() + " KM" + '\n'; } //Display the length of each line in kilometers. message += "Length of Red Line is: " + testLine.GetLength(GeographyUnit.Meter, DistanceUnit.Kilometer).ToString() + " KM"; mapView.Refresh(); MessageBox.Show(message, "Results"); }