private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); mapView.CurrentExtent = new RectangleShape(-19747615, 17926782, -5857338, 1637456); mapView.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColors.ShallowOcean); AdministrationShapeFileLayer worldLayer = new AdministrationShapeFileLayer(SampleHelper.Get("Countries02_3857.shp"), SecurityLevel.AverageUsageLevel1); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69)); AdministrationShapeFileLayer statesLayer = new AdministrationShapeFileLayer(SampleHelper.Get("USStates_3857.shp"), SecurityLevel.AverageUsageLevel2); statesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 156, 155, 154), 2); statesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.LineJoin = DrawingLineJoin.Round; statesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add("WorldLayer", worldLayer); worldOverlay.Layers.Add("StatesLayer", statesLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.CurrentExtent = new RectangleShape(-20037508, 17821912, -2226390, -2273031); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldLayer.Name = "Countries02"; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69)); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer statesLayer = new ShapeFileFeatureLayer(SampleHelper.Get("USStates_3857.shp")); statesLayer.Name = "USStates"; statesLayer.ZoomLevelSet.ZoomLevel04.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 156, 155, 154), 2); statesLayer.ZoomLevelSet.ZoomLevel04.DefaultAreaStyle.OutlinePen.LineJoin = DrawingLineJoin.Round; statesLayer.ZoomLevelSet.ZoomLevel04.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer citiesLayer = new ShapeFileFeatureLayer(SampleHelper.Get("MajorCities_3857.shp")); citiesLayer.Name = "MajorCities"; citiesLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = PointStyle.CreateCompoundCircleStyle(GeoColors.White, 10F, GeoColors.Black, 1F, GeoColors.Black, 7F); citiesLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = TextStyle.CreateSimpleTextStyle("areaname", "Arial", 10, DrawingFontStyles.Regular, GeoColors.Black, 0, -8); citiesLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.ShallowOcean))); worldOverlay.Layers.Add("WorldLayer", worldLayer); worldOverlay.Layers.Add("StatesLayer", statesLayer); worldOverlay.Layers.Add("CitiesLayer", citiesLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); mapView.Refresh(); }
private void mapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.CurrentExtent = new RectangleShape(-11523306.58264589, 4293803.999343073, -9676587.989535574, 2828659.049312506); ShapeFileFeatureLayer statesLayer = new ShapeFileFeatureLayer(SampleHelper.Get("USStates_3857.shp")); statesLayer.Name = "USStates"; statesLayer.ZoomLevelSet.ZoomLevel04.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 156, 155, 154), 2); statesLayer.ZoomLevelSet.ZoomLevel04.DefaultAreaStyle.OutlinePen.LineJoin = DrawingLineJoin.Round; statesLayer.ZoomLevelSet.ZoomLevel04.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer citiesLayer = new ShapeFileFeatureLayer(SampleHelper.Get("MajorCities_3857.shp")); citiesLayer.Name = "MajorCities"; citiesLayer.ZoomLevelSet.ZoomLevel04.DefaultPointStyle = new PointStyle(new GeoFont(SampleHelper.Get("vectormap-icons.ttf"), 20, DrawingFontStyles.Regular), "\ue0b5", new GeoSolidBrush(GeoColors.Red)); citiesLayer.ZoomLevelSet.ZoomLevel05.DefaultPointStyle = new PointStyle(new GeoFont(SampleHelper.Get("vectormap-icons.ttf"), 25, DrawingFontStyles.Regular), "\ue05c", new GeoSolidBrush(GeoColors.Orange)); citiesLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = new PointStyle(new GeoFont(SampleHelper.Get("vectormap-icons.ttf"), 28, DrawingFontStyles.Regular), "\ue078", new GeoSolidBrush(GeoColors.Green)); citiesLayer.ZoomLevelSet.ZoomLevel07.DefaultPointStyle = new PointStyle(new GeoFont(SampleHelper.Get("vectormap-icons.ttf"), 30, DrawingFontStyles.Regular), "\ue035", new GeoSolidBrush(GeoColors.DarkBlue)); citiesLayer.ZoomLevelSet.ZoomLevel08.DefaultPointStyle = new PointStyle(new GeoFont(SampleHelper.Get("vectormap-icons.ttf"), 34, DrawingFontStyles.Regular), "\ue02e", new GeoSolidBrush(GeoColors.Blue)); citiesLayer.ZoomLevelSet.ZoomLevel09.DefaultPointStyle = new PointStyle(new GeoFont(SampleHelper.Get("vectormap-icons.ttf"), 36, DrawingFontStyles.Regular), "\ue06f", new GeoSolidBrush(GeoColors.Purple)); citiesLayer.ZoomLevelSet.ZoomLevel10.DefaultPointStyle = new PointStyle(new GeoFont(SampleHelper.Get("vectormap-icons.ttf"), 40, DrawingFontStyles.Regular), "\ue084", new GeoSolidBrush(GeoColors.Red)); LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.ShallowOcean))); worldOverlay.Layers.Add("StatesLayer", statesLayer); worldOverlay.Layers.Add("CitiesLayer", citiesLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; // If want to know more srids, please refer Projections.rtf in Documentation folder. ProjectionConverter proj4Projection = new ProjectionConverter(3857, 2163); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69)); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.FeatureSource.ProjectionConverter = proj4Projection; worldLayer.Open(); mapView.CurrentExtent = worldLayer.GetBoundingBox(); worldLayer.Close(); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.TileType = TileType.SingleTile; staticOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.DeepOcean))); staticOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add(staticOverlay); mapView.Refresh(); }
/// <summary> /// Adds a ClassBreakStyle to the housingUnitsLayer that changes colors based on the numerical value of the H_UNITS column as they fall within the range of a ClassBreak /// </summary> private static void AddClassBreakStyle(ShapeFileFeatureLayer layer, LegendAdornmentLayer legend) { // Create the ClassBreakStyle based on the H_UNITS numerical column var housingUnitsStyle = new ClassBreakStyle("H_UNITS"); var classBreakIntervals = new double[] { 0, 1000, 2000, 3000, 4000, 5000 }; var colors = GeoColor.GetColorsInHueFamily(GeoColors.Red, classBreakIntervals.Count()).Reverse().ToList(); // Create ClassBreaks for each of the classBreakIntervals for (var i = 0; i < classBreakIntervals.Count(); i++) { // Create the classBreak using one of the intervals and colors defined above var classBreak = new ClassBreak(classBreakIntervals[i], AreaStyle.CreateSimpleAreaStyle(new GeoColor(192, colors[i]), GeoColors.White)); // Add the classBreak to the housingUnitsStyle ClassBreaks collection housingUnitsStyle.ClassBreaks.Add(classBreak); // Add a LegendItem to the legend adornment to represent the classBreak var legendItem = new LegendItem() { ImageStyle = classBreak.DefaultAreaStyle, TextStyle = new TextStyle($@">{classBreak.Value} units", new GeoFont("Verdana", 10), GeoBrushes.Black) }; legend.LegendItems.Add(legendItem); } // Add and apply the ClassBreakStyle to the housingUnitsLayer layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(housingUnitsStyle); layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); mapView.CurrentExtent = new RectangleShape(-14283508, 20037508, 14676953, -9263005); // 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); 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; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.TileType = TileType.SingleTile; staticOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add(staticOverlay); PopupOverlay popupOverlay = new PopupOverlay(); mapView.Overlays.Add("PopupOverlay", popupOverlay); mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69)); ShapeFileFeatureLayer statesLayer = new ShapeFileFeatureLayer(SampleHelper.Get("USStates_3857.shp")); statesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 156, 155, 154), 2); statesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.LineJoin = DrawingLineJoin.Round; statesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer majorCitiesShapeLayer = new ShapeFileFeatureLayer(SampleHelper.Get("MajorCities_3857.shp")); majorCitiesShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateCompoundCircleStyle(GeoColors.White, 10F, GeoColors.Black, 1F, GeoColors.Black, 7F); majorCitiesShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyle.CreateSimpleTextStyle("AREANAME", "Arial", 10, DrawingFontStyles.Regular, GeoColors.Black, 0, -8); majorCitiesShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.TextPlacement = TextPlacement.AutoPlacement; majorCitiesShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.ShallowOcean))); staticOverlay.Layers.Add("WorldLayer", worldLayer); staticOverlay.Layers.Add("StatesLayer", statesLayer); staticOverlay.Layers.Add("MajorCitiesShapeLayer", majorCitiesShapeLayer); mapView.Overlays.Add(staticOverlay); mapView.CurrentExtent = new RectangleShape(-14070784, 6240993, -7458406, 2154936); mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); mapView.CurrentExtent = new RectangleShape(-17336118, 20037508, 11623981, -16888303); LayerOverlay worldOverlay = new LayerOverlay(); mapView.Overlays.Add("WorldOverlay", worldOverlay); BackgroundLayer backgroundLayer = new BackgroundLayer(new GeoSolidBrush(GeoColors.DeepOcean)); worldOverlay.Layers.Add(backgroundLayer); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69)); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldOverlay.Layers.Add("WorldLayer", worldLayer); // If you want to use file cache which saves images to the disk; // When loading back the same tileView, we'll find from the disk first. // Turn the cache on enhance the performance a lot; // if your map image is static, we recommend to turn the cache on. // It's off by default. FileRasterTileCache bitmapTileCache = new FileRasterTileCache(); bitmapTileCache.CacheDirectory = Path.Combine(Path.GetTempPath(), "ThinkGeo", "TileCaches", "UsingTileCache-Wpf"); bitmapTileCache.CacheId = "World02CachedTiles"; bitmapTileCache.TileAccessMode = TileAccessMode.ReadOnly; bitmapTileCache.ImageFormat = RasterTileFormat.Png; worldOverlay.TileCache = bitmapTileCache; mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); // 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); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green)); InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer(); highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColors.DarkGreen)); LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); LayerOverlay highlightOverlay = new LayerOverlay(); highlightOverlay.TileType = TileType.SingleTile; highlightOverlay.Layers.Add("HighlightLayer", highlightLayer); mapView.Overlays.Add("HighlightOverlay", highlightOverlay); mapView.CurrentExtent = new RectangleShape(-19740642, 20037508, 9219819, -20037508); mapView.Refresh(); }
/// <summary> /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the cityLimits and bufferLayer layers into a grouped LayerOverlay and display them on the map. /// </summary> 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); // Project cityLimits layer to Spherical Mercator to match the map projection cityLimits.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 the bufferLayer bufferLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Green), GeoColors.DimGray); bufferLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add cityLimits to a LayerOverlay layerOverlay.Layers.Add(cityLimits); // Add bufferLayer to the layerOverlay layerOverlay.Layers.Add(bufferLayer); // 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); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.DecimalDegree; LayerOverlay layerOverlay = new LayerOverlay(); shapeFileLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02.shp")); shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColors.Black, 1), new GeoSolidBrush(GeoColors.LightSkyBlue)); shapeFileLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; shapeFileLayer.Open(); layerOverlay.Layers.Add(shapeFileLayer); fourColorLayer = new InMemoryFeatureLayer(); ValueStyle valueStyle = new ValueStyle { ColumnName = "Color" }; valueStyle.ValueItems.Add(new ValueItem("1", AreaStyle.CreateSimpleAreaStyle(GeoColors.LightGreen))); valueStyle.ValueItems.Add(new ValueItem("2", AreaStyle.CreateSimpleAreaStyle(GeoColors.LightSkyBlue))); valueStyle.ValueItems.Add(new ValueItem("3", AreaStyle.CreateSimpleAreaStyle(GeoColors.Yellow))); valueStyle.ValueItems.Add(new ValueItem("4", AreaStyle.CreateSimpleAreaStyle(GeoColors.LightPink))); fourColorLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle); fourColorLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add(fourColorLayer); mapView.Overlays.Add(layerOverlay); mapView.CurrentExtent = new RectangleShape(-174, 117, 180, -120); mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.DecimalDegree; mapView.CurrentExtent = new RectangleShape(-177.39584350585937, 83.113876342773437, -52.617362976074219, 14.550546646118164); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldLayer.Open(); ProjectionConverter project = new ProjectionConverter(3857, 4326); project.Open(); Feature feature = project.ConvertToExternalProjection(worldLayer.QueryTools.GetFeatureById("135", new string[0])); project.Close(); areaBaseShape = (AreaBaseShape)feature.GetShape(); worldLayer.Close(); InMemoryFeatureLayer simplificationLayer = new InMemoryFeatureLayer(); simplificationLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; simplificationLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69)); simplificationLayer.InternalFeatures.Add(feature); LayerOverlay simplificationOverlay = new LayerOverlay(); simplificationOverlay.TileType = TileType.SingleTile; simplificationOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.DeepOcean))); simplificationOverlay.Layers.Add("SimplificationLayer", simplificationLayer); mapView.Overlays.Add("SimplificationOverlay", simplificationOverlay); cmbSimplificationType.SelectedIndex = 0; cmbTolerance.SelectedIndex = 0; mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); mapView.CurrentExtent = new RectangleShape(-14833496, 20037508, 14126965, -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); ShapeFileFeatureLayer worldShapeLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green)); worldShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer worldLabelLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp")); worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyle.CreateSimpleTextStyle("DynamicPopulation", "Arial", 10, DrawingFontStyles.Regular, GeoColors.Red, 0, -12); worldLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLabelLayer.FeatureSource.CustomColumnFetch += new EventHandler <CustomColumnFetchEventArgs>(FeatureSource_CustomColumnFetch); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.TileType = TileType.SingleTile; staticOverlay.Layers.Add("WorldShapeLayer", worldShapeLayer); staticOverlay.Layers.Add("WorldLabelLayer", worldLabelLayer); mapView.Overlays.Add(staticOverlay); mapView.Refresh(); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); mapView.CurrentExtent = new RectangleShape(-10018754, 20037508, 10018754, -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); 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; LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); InMemoryFeatureLayer pointsLayer = new InMemoryFeatureLayer(); pointsLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Circle, 10, new GeoSolidBrush(GeoColor.GetRandomGeoColor(RandomColorType.All))); pointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay pointsOverlay = new LayerOverlay(); pointsOverlay.TileType = TileType.SingleTile; pointsOverlay.Layers.Add("PointsLayer", pointsLayer); mapView.Overlays.Add("PointsOverlay", pointsOverlay); mapView.Refresh(); }
private void AddLegendLayer() { LegendItem title = new LegendItem(); title.TextStyle = new TextStyle("Map Legend", new GeoFont("Arial", 10, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColors.Black)); LegendItem legendItem1 = new LegendItem(); legendItem1.ImageStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(170, GeoColors.Green))); legendItem1.TextStyle = new TextStyle("Population > 70 million", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black)); LegendItem legendItem2 = new LegendItem(); legendItem2.ImageStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.Green); legendItem2.TextStyle = new TextStyle("Population < 70 million", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black)); LegendAdornmentLayer legendAdornmentLayer = new LegendAdornmentLayer(); legendAdornmentLayer.Height = 100; legendAdornmentLayer.Title = title; legendAdornmentLayer.LegendItems.Add(legendItem1); legendAdornmentLayer.LegendItems.Add(legendItem2); LegendPrinterLayer legendPrinterLayer = new LegendPrinterLayer(legendAdornmentLayer); legendPrinterLayer.SetPosition(2, 1, -2.9, 3.9, PrintingUnit.Inch); legendPrinterLayer.BackgroundMask = AreaStyle.CreateSimpleAreaStyle(new GeoColor(255, 230, 230, 230), GeoColors.Black, 1); PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"]; printerInteractiveOverlay.PrinterLayers.Add("LegendPrinterLayer", legendPrinterLayer); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); mapView.CurrentExtent = new RectangleShape(-10743975, 3601560, -10503638, 3364279); // 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); TabFeatureLayer worldLayer = new TabFeatureLayer(SampleHelper.Get("HoustonMuniBdySamp_Boundary.TAB")); worldLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(4326, 3857); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColors.Green), GeoColors.Green); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.TileType = TileType.SingleTile; staticOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add(staticOverlay); mapView.Refresh(); }
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 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))"; }
/// <summary> /// Use the ProjectionConverter class to reproject features in a ShapeFileFeatureLayer /// </summary> private void ReprojectFeaturesFromShapefile() { // Create a feature layer to hold the Frisco subdivisions data ShapeFileFeatureLayer subdivisionsLayer = new ShapeFileFeatureLayer(@"../../../Data/Shapefile/Subdivisions.shp"); // Create a new ProjectionConverter to convert between Texas North Central (2276) and Spherical Mercator (3857) ProjectionConverter projectionConverter = new ProjectionConverter(2276, 3857); subdivisionsLayer.FeatureSource.ProjectionConverter = projectionConverter; // Add a style to use to draw the Frisco subdivions polygons subdivisionsLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(50, GeoColors.MediumPurple), GeoColors.MediumPurple, 2); // Apply the styles across all zoom levels subdivisionsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Get the overlay we prepared from the MapView, and add the subdivisions ShapeFileFeatureLayer to it LayerOverlay subdivisionsOverlay = (LayerOverlay)mapView.Overlays["Frisco Subdivisions Overlay"]; subdivisionsOverlay.Layers.Clear(); subdivisionsOverlay.Layers.Add("Frisco Subdivisions", subdivisionsLayer); // Set the map to the extent of the subdivisions features and refresh the map subdivisionsLayer.Open(); mapView.CurrentExtent = subdivisionsLayer.GetBoundingBox(); subdivisionsLayer.Close(); 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(); }
private void AddMapLayer() { // Create the MapPrinterLayer and set the position MapPrinterLayer mapPrinterLayer = new MapPrinterLayer(); mapPrinterLayer.MapUnit = GeographyUnit.Meter; mapPrinterLayer.MapExtent = new RectangleShape(-20026376.39, 20048966.10, 20026376.39, -20048966.10); mapPrinterLayer.BackgroundMask = new AreaStyle(new GeoPen(GeoColors.Black, 1)); mapPrinterLayer.Open(); // Set the maps position slightly below the pages center and 8 inches wide and 7 inches tall RectangleShape pageBoundingbox = GetPageBoundingBox(PrintingUnit.Inch); mapPrinterLayer.SetPosition(8, 7, pageBoundingbox.GetCenterPoint().X, pageBoundingbox.GetCenterPoint().Y + 1, PrintingUnit.Inch); // Setup the intial extent and ensure they snap to the default ZoomLevel ZoomLevelSet zoomLevelSet = new ZoomLevelSet(); mapPrinterLayer.MapExtent = MapUtil.ZoomToScale(zoomLevelSet.ZoomLevel03.Scale, new RectangleShape(-20026376.39, 20048966.10, 20026376.39, -20048966.10), mapPrinterLayer.MapUnit, (float)mapPrinterLayer.GetBoundingBox().Width, (float)mapPrinterLayer.GetBoundingBox().Height); // This ThinkGeo Cloud test key is exclusively for demonstration purposes and is limited to requesting base map // tiles only. Do not use it in your own applications, as it may be restricted or disabled without prior notice. // Please visit https://cloud.thinkgeo.com to create a free key for your own use. //ThinkGeoCloudRasterMapsLayer worldMapKitLayer = new ThinkGeoCloudRasterMapsLayer("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~"); //worldMapKitLayer.TileCache = null; //mapPrinterLayer.Layers.Add(worldMapKitLayer); ShapeFileFeatureLayer backgroundLayer = new ShapeFileFeatureLayer(@"data/Countries02_3857.shp", FileAccess.Read); backgroundLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; backgroundLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.White, GeoColors.Black); mapPrinterLayer.Layers.Add(backgroundLayer); // Setup the Countries mapping layer ShapeFileFeatureLayer shapefileFeatureLayer = new ShapeFileFeatureLayer(@"data/Countries02_3857.shp", FileAccess.Read); shapefileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; //Create the class break style for countries less than 70 million ClassBreakStyle classBreakStyle = new ClassBreakStyle("POP_CNTRY"); // Create the style and class break for countries with greater and 70 million AreaStyle hatchAreaStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(100, GeoColors.Green))); classBreakStyle.ClassBreaks.Add(new ClassBreak(70000000, hatchAreaStyle)); // Add the class break style to the layer shapefileFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(classBreakStyle); // Add the new country layer to the MapPrinterLayer mapPrinterLayer.Layers.Add(shapefileFeatureLayer); // Add the MapPrinterLayer to the PrinterInteractiveOverlay PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"]; printerInteractiveOverlay.PrinterLayers.Add("MapLayer", mapPrinterLayer); }
/// <summary> /// Set up the map with the ThinkGeo Cloud Maps overlay and a feature layer containing Frisco zoning data /// </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 Unit to meters (used in Spherical Mercator) mapView.MapUnit = GeographyUnit.Meter; // Create a feature layer to hold the Frisco zoning data ShapeFileFeatureLayer zoningLayer = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/Zoning.shp")); // Convert the Frisco shapefile from its native projection to Spherical Mercator, to match the map ProjectionConverter projectionConverter = new ProjectionConverter(2276, 3857); zoningLayer.FeatureSource.ProjectionConverter = projectionConverter; // Add a style to use to draw the Frisco zoning polygons zoningLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; zoningLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(50, GeoColors.MediumPurple), GeoColors.MediumPurple, 2); // Create a layer to hold features found by the spatial query InMemoryFeatureLayer highlightedFeaturesLayer = new InMemoryFeatureLayer(); highlightedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(90, GeoColors.MidnightBlue), GeoColors.MidnightBlue); highlightedFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add each feature layer to it's own overlay // We do this so we can control and refresh/redraw each layer individually LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add("Frisco Zoning", zoningLayer); layerOverlay.Layers.Add("Highlighted Features", highlightedFeaturesLayer); // Add a MarkerOverlay to the map to display the selected point for the query SimpleMarkerOverlay queryFeatureMarkerOverlay = new SimpleMarkerOverlay(); mapView.Overlays.Add("Query Feature Marker Overlay", queryFeatureMarkerOverlay); mapView.Overlays.Add("Layer Overlay", layerOverlay); // Add a sample point to the map for the initial query PointShape sampleShape = new PointShape(-10779425.2690712, 3914970.73561765); GetFeaturesWithinDistance(sampleShape); // Set the map extent to the initial area mapView.CurrentExtent = new RectangleShape(-10781338.5834248, 3916678.62545891, -10777511.9547176, 3913262.84577639); mapView.Refresh(); }
/// <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> /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the cityLimits, westRegionLayer and differenceLayer /// 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); ShapeFileFeatureLayer cityLimits = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/FriscoCityLimits.shp")); InMemoryFeatureLayer westRegionLayer = new InMemoryFeatureLayer(); InMemoryFeatureLayer differenceLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project cityLimits layer to Spherical Mercator to match the map projection cityLimits.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 cityLimits layer westRegionLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Blue), GeoColors.DimGray); westRegionLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style the differenceLayer differenceLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(64, GeoColors.Green), GeoColors.DimGray); differenceLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add cityLimits to a LayerOverlay layerOverlay.Layers.Add("cityLimits", cityLimits); // Add cityLimits to a LayerOverlay layerOverlay.Layers.Add("westRegionLayer", westRegionLayer); // Add differenceLayer to the layerOverlay layerOverlay.Layers.Add("differenceLayer", differenceLayer); // 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); // Add west region area to westRegionLayer westRegionLayer.InternalFeatures.Add(new Feature("Polygon ((-10780139.10763415694236755 3918539.43726690439507365, -10780206.68015497177839279 3915600.03261143481358886, -10780088.42824354581534863 3914687.80358042707666755, -10780037.7488529346883297 3913978.2921118657104671, -10779767.4587696734815836 3913555.96385676926001906, -10779176.19921253807842731 3913336.35316411964595318, -10778635.61904601566493511 3913049.16995065379887819, -10778280.86331173405051231 3911934.22335720015689731, -10778263.970181530341506 3910684.13172211544588208, -10778382.22209295630455017 3910447.6278992616571486, -10778382.22209295630455017 3909569.1851286618039012, -10778263.970181530341506 3909113.07061315793544054, -10778280.86331173405051231 3907356.18507195776328444, -10785595.58868999965488911 3904045.13155200378969312, -10786034.81007529981434345 3904822.21554138045758009, -10786001.02381489239633083 3908150.16219153860583901, -10786051.70320550352334976 3908690.7423580614849925, -10785933.45129407569766045 3909315.78817560384050012, -10786001.02381489239633083 3911275.39127924991771579, -10785882.77190346457064152 3912204.5134404618293047, -10785832.09251285344362259 3914485.08601798117160797, -10785832.09251285344362259 3917728.56701711937785149, -10785426.65738796070218086 3918117.10901180794462562, -10785460.44364836812019348 3919012.44491261197254062, -10782233.85577943362295628 3918995.55178240826353431, -10781642.59622230008244514 3918623.90291792340576649, -10780139.10763415694236755 3918539.43726690439507365))")); mapView.Refresh(); }
private void InitBoundingBoxPreviewOverlay(MapView map) { boundingBoxPreviewLayer = new InMemoryFeatureLayer(); boundingBoxPreviewLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColors.Blue); boundingBoxPreviewLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay boundingBoxPreviewOverlay = new LayerOverlay(); boundingBoxPreviewOverlay.Layers.Add(boundingBoxPreviewLayer); boundingBoxPreviewOverlay.Open(); map.Overlays.Add(boundingBoxPreviewOverlayName, boundingBoxPreviewOverlay); }
/// <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 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"); InMemoryFeatureLayer westRegionLayer = new InMemoryFeatureLayer(); InMemoryFeatureLayer clipLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project cityLimits layer to Spherical Mercator to match the map projection cityLimits.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 cityLimits layer westRegionLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Blue), GeoColors.DimGray); westRegionLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style the clipLayer clipLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(64, GeoColors.Green), GeoColors.DimGray); clipLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add cityLimits to a LayerOverlay layerOverlay.Layers.Add("cityLimits", cityLimits); // Add cityLimits to a LayerOverlay layerOverlay.Layers.Add("westRegionLayer", westRegionLayer); // Add clipLayer to the layerOverlay layerOverlay.Layers.Add("clipLayer", clipLayer); // 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); // Add west region area to westRegionLayer westRegionLayer.InternalFeatures.Add(new Feature("Polygon ((-10780139.10763415694236755 3918539.43726690439507365, -10780206.68015497177839279 3915600.03261143481358886, -10780088.42824354581534863 3914687.80358042707666755, -10780037.7488529346883297 3913978.2921118657104671, -10779767.4587696734815836 3913555.96385676926001906, -10779176.19921253807842731 3913336.35316411964595318, -10778635.61904601566493511 3913049.16995065379887819, -10778280.86331173405051231 3911934.22335720015689731, -10778263.970181530341506 3910684.13172211544588208, -10778382.22209295630455017 3910447.6278992616571486, -10778382.22209295630455017 3909569.1851286618039012, -10778263.970181530341506 3909113.07061315793544054, -10778280.86331173405051231 3907356.18507195776328444, -10785595.58868999965488911 3904045.13155200378969312, -10786034.81007529981434345 3904822.21554138045758009, -10786001.02381489239633083 3908150.16219153860583901, -10786051.70320550352334976 3908690.7423580614849925, -10785933.45129407569766045 3909315.78817560384050012, -10786001.02381489239633083 3911275.39127924991771579, -10785882.77190346457064152 3912204.5134404618293047, -10785832.09251285344362259 3914485.08601798117160797, -10785832.09251285344362259 3917728.56701711937785149, -10785426.65738796070218086 3918117.10901180794462562, -10785460.44364836812019348 3919012.44491261197254062, -10782233.85577943362295628 3918995.55178240826353431, -10781642.59622230008244514 3918623.90291792340576649, -10780139.10763415694236755 3918539.43726690439507365))")); }
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> /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the censusHousing and centerPointLayer 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 censusHousing = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/Frisco 2010 Census Housing Units.shp")); InMemoryFeatureLayer centerPointLayer = new InMemoryFeatureLayer(); LayerOverlay layerOverlay = new LayerOverlay(); // Project censusHousing layer to Spherical Mercator to match the map projection censusHousing.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Style censusHousing layer censusHousing.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Orange), GeoColors.DimGray); censusHousing.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Style centerPointLayer centerPointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimpleCircleStyle(GeoColors.Green, 12, GeoColors.White, 4); centerPointLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(new GeoColor(64, GeoColors.Green), GeoColors.Black, 2); centerPointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Add censusHousing layer to a LayerOverlay layerOverlay.Layers.Add("censusHousing", censusHousing); // Add centerPointLayer to the layerOverlay layerOverlay.Layers.Add("centerPointLayer", centerPointLayer); // Set the map extent to the censusHousing layer bounding box censusHousing.Open(); mapView.CurrentExtent = censusHousing.GetBoundingBox(); censusHousing.Close(); // Add LayerOverlay to Map mapView.Overlays.Add("layerOverlay", layerOverlay); centroidCenter.IsChecked = true; mapView.Refresh(); }