private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            // There are 3 kinds of authentication for Google Maps as below:
            //  1. ApiKey + UriSigningSecret
            //  2. ApiKey
            //  3.ClientId + PrivateKey
            var             apiKey           = "AIzaSyApIWa5nx0KknyLQp4pNaTpz13a4w2kLZE";
            var             uriSigningSecret = "6CVKqVDeZNfZjARYA5CaKYPT1Eg=";
            GoogleMapsLayer worldLayer       = new GoogleMapsLayer();

            worldLayer.ClientId   = "gme-valmontindustries";
            worldLayer.PrivateKey = "-J7YzyRJpepGq9HwRM3LGXyDM04=";

            LayerOverlay worldOverlay = new LayerOverlay();

            //worldOverlay.TileType = TileType.SingleTile;
            worldOverlay.Layers.Add("WorldLayer", worldLayer);

            ShapeFileFeatureLayer shapeLayer = new ShapeFileFeatureLayer(SampleHelper.Get("USStates_3857.shp"));
            AreaStyle             areaStyle  = new AreaStyle();

            areaStyle.FillBrush  = new GeoSolidBrush(GeoColor.FromArgb(125, 233, 232, 214));
            areaStyle.OutlinePen = new GeoPen(GeoColor.FromArgb(255, 118, 138, 69), 1);
            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = areaStyle;
            shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            worldOverlay.Layers.Add(shapeLayer);

            mapView.ZoomLevelSet = new GoogleMapsZoomLevelSet();
            mapView.Overlays.Add("WorldOverlay", worldOverlay);
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.CurrentExtent = new RectangleShape(-10000000, 10000000, 10000000, -10000000);
            mapView.Refresh();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit      = GeographyUnit.Meter;
            Map1.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);

            Map1.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            PopupOverlay popupOverlay = new PopupOverlay();

            Map1.Overlays.Add(popupOverlay);

            ShapeFileFeatureLayer majorCitiesShapeLayer = new ShapeFileFeatureLayer(SampleHelper.Get("MajorCities_3857.shp"));

            majorCitiesShapeLayer.Open();
            Collection <Feature> features = majorCitiesShapeLayer.QueryTools.GetAllFeatures(ReturningColumnsType.AllColumns);

            foreach (Feature feature in features)
            {
                Popup popup = new Popup(feature.GetShape().GetCenterPoint());
                popup.Content = feature.ColumnValues["AREANAME"];
                popupOverlay.Popups.Add(popup);
            }
            majorCitiesShapeLayer.Close();

            Map1.CurrentExtent = popupOverlay.GetBoundingBox();
            Map1.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.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();
        }
Beispiel #6
0
        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;

            // 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();
        }
        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 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 mapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit      = GeographyUnit.Meter;
            mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.MapTools.MouseCoordinate.IsEnabled = true;
            mapView.CurrentExtent = new RectangleShape(-14070784, 6240993, -7458406, 2154936);
            mapView.MaximumScale  = 36911986.875;

            // 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 shapeFileFeatureLayer = new ShapeFileFeatureLayer(SampleHelper.Get("cities_e_3857.shp"));

            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(new HeatStyle(10, 75, DistanceUnit.Kilometer));
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(shapeFileFeatureLayer);
            layerOverlay.OverlayCanvas.Opacity = .8f;
            mapView.Overlays.Add(layerOverlay);

            mapView.Refresh();
        }
        private void mapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit = GeographyUnit.Meter;

            LayerOverlay        layerOverlay = new LayerOverlay();
            UsgsDemFeatureLayer layer        = new UsgsDemFeatureLayer(SampleHelper.Get("mobile-e.dem"));

            layer.DrawingQuality = DrawingQuality.HighSpeed;

            layer.Open();
            DataTable informations = CreateInformationTable((UsgsDemFeatureSource)layer.FeatureSource);

            informationDataGrid.ItemsSource = informations.DefaultView;

            ClassBreakStyle classBreakStyle = new ClassBreakStyle();

            classBreakStyle.ColumnName = layer.DataValueColumnName;
            Collection <GeoColor> colors = GeoColor.GetColorsInQualityFamily(GeoColors.Blue, 100);
            double cellValue             = (layer.MaxElevation - layer.MinElevation) / 100;

            for (int i = 0; i < colors.Count; i++)
            {
                classBreakStyle.ClassBreaks.Add(new ClassBreak(layer.MinElevation + cellValue * i, new AreaStyle(new GeoSolidBrush(colors[i]))));
            }

            layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(classBreakStyle);
            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            layerOverlay.Layers.Add(layer);
            mapView.Overlays.Add(layerOverlay);

            mapView.CurrentExtent = layer.GetBoundingBox();
            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();
        }
Beispiel #13
0
        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(-18473122, 20037508, -3992891, -711306);

            // 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);

            InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();

            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillBrush        = new GeoSolidBrush(GeoColor.FromArgb(100, GeoColors.Green));
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColors.Green;
            inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.Open();
            Feature feature = worldLayer.QueryTools.GetFeatureById("135", new string[0]);

            worldLayer.Close();

            inMemoryLayer.InternalFeatures.Add("135", feature);

            LayerOverlay inMemoryOverlay = new LayerOverlay();

            inMemoryOverlay.TileType = TileType.SingleTile;
            inMemoryOverlay.Layers.Add("InMemoryFeatureLayer", inMemoryLayer);
            mapView.Overlays.Add("InMemoryOverlay", inMemoryOverlay);


            mapView.Refresh();
        }
Beispiel #15
0
        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)
        {
            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;

            // 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 shapeFileFeatureLayer = new ShapeFileFeatureLayer(SampleHelper.Get("FriscoSchools.shp"));

            // CustomColumnFetch event is raised every time the layer is fetching a column which doesn't exist.
            // In this example as "textColumn" does not exist in the shape file, CustomColumnFetch event
            // will be raised so give us a way to programmatically filling it in.
            shapeFileFeatureLayer.FeatureSource.CustomColumnFetch += FeatureSource_CustomColumnFetch;

            // Use a font glyph to render a point.
            // This font in the sample can be downloaded at https://thinkgeo.com/map-icons-webfont.
            GeoFont         geoFont   = new GeoFont(SampleHelper.Get("vectormap-icons.ttf"), 20);
            CustomTextStyle textStyle = new CustomTextStyle("textColumn", geoFont, GeoBrushes.Yellow);

            // "textColumn" doesn't exist in the shape file, this is why CustomColumnFetch is raised.
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle);
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay layerOverlay = new LayerOverlay()
            {
                TileType = TileType.SingleTile
            };

            layerOverlay.Layers.Add(shapeFileFeatureLayer);
            mapView.Overlays.Add(layerOverlay);

            mapView.CurrentExtent = new RectangleShape(-10786168.329407, 3921665.511929, -10765014.955587, 3907241.059012);
        }
Beispiel #18
0
        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;
            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();
        }
Beispiel #20
0
        private void RadioButton_Checked(object sender, RoutedEventArgs e)
        {
            if (CheckBoxDisableRasterCache != null && thinkGeoMBTilesFeatureLayer != null)
            {
                Uri    styleJsonUri = thinkGeoMBTilesFeatureLayer.StyleJsonUri;
                string senderName   = (sender as RadioButton).Name;
                if (senderName == "RadioButtonLight")
                {
                    styleJsonUri = new Uri(SampleHelper.Get("thinkgeo-world-streets-light.json"), UriKind.Relative);
                }
                else if (senderName == "RadioButtionDark")
                {
                    styleJsonUri = new Uri(SampleHelper.Get("thinkgeo-world-streets-dark.json"), UriKind.Relative);
                }
                else if (senderName == "RadioButtionMuteblue")
                {
                    styleJsonUri = new Uri(SampleHelper.Get("mutedblue.json"), UriKind.Relative);
                }

                layerOverlay.Layers.Clear();
                thinkGeoMBTilesFeatureLayer = new ThinkGeoMBTilesLayer(SampleHelper.Get("tiles_Frisco.mbtiles"),
                                                                       styleJsonUri);
                UpdateTileCache(CheckBoxDisableRasterCache.IsChecked.Value);
                layerOverlay.Layers.Add(thinkGeoMBTilesFeatureLayer);
                Map.Refresh();
            }
        }
Beispiel #21
0
        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();
        }
Beispiel #22
0
        private void LoadAMapFromStreams_StreamLoading(object sender, StreamLoadingEventArgs e)
        {
            string fileName = System.IO.Path.GetFileName(e.AlternateStreamName);
            string ext      = Path.GetExtension(fileName);

            fileName = SampleHelper.Get(fileName, DataFormat.Shapefile);
            fileName = Path.ChangeExtension(fileName, ext);

            e.AlternateStream = new FileStream(fileName, (FileMode)e.FileMode, (FileAccess)e.ReadWriteMode);
        }
Beispiel #23
0
        public DisplayThinkGeoMBTilesMaps()
        {
            layerOverlay = new LayerOverlay();
            var styleJsonUri = new Uri(SampleHelper.Get("thinkgeo-world-streets-light.json"), UriKind.Relative);

            thinkGeoMBTilesFeatureLayer = new ThinkGeoMBTilesLayer(SampleHelper.Get("tiles_Frisco.mbtiles"), styleJsonUri);
            tmpBitmapTileCache          = null;

            InitializeComponent();
        }
 private void RadioButton_Checked(object sender, RoutedEventArgs e)
 {
     if (IsLoaded && Map.Overlays.Contains("ThinkGeoCloudVectorMapsOverlay"))
     {
         var overlay = (ThinkGeoCloudVectorMapsOverlay)Map.Overlays["ThinkGeoCloudVectorMapsOverlay"];
         overlay.MapType = (ThinkGeoCloudVectorMapsMapType)Enum.Parse(typeof(ThinkGeoCloudVectorMapsMapType),
                                                                      (sender as RadioButton).Content.ToString());
         if (overlay.MapType == ThinkGeoCloudVectorMapsMapType.CustomizedByStyleJson)
         {
             overlay.StyleJsonUri = new Uri(SampleHelper.Get("mutedblue.json"), UriKind.Relative);
         }
         Map.Refresh();
     }
 }
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit = GeographyUnit.DecimalDegree;
            mapView.CurrentExtent = new RectangleShape(-180, 90, 180, -90);

            EcwRasterLayer ecwImageLayer = new EcwRasterLayer(SampleHelper.Get("World.ecw"));
            ecwImageLayer.UpperThreshold = double.MaxValue;
            ecwImageLayer.LowerThreshold = 0;

            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("EcwImageLayer", ecwImageLayer);
            mapView.Overlays.Add(staticOverlay);

            mapView.Refresh();
        }
Beispiel #26
0
        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.DecimalDegree;
            mapView.CurrentExtent = new RectangleShape(-118.098, 84.3, 118.098, -84.3);

            MrSidRasterLayer sidImageLayer = new MrSidRasterLayer(SampleHelper.Get("world.sid"));

            sidImageLayer.UpperThreshold = double.MaxValue;
            sidImageLayer.LowerThreshold = 0;

            LayerOverlay staticOverlay = new LayerOverlay();

            staticOverlay.Layers.Add("SidImageLayer", sidImageLayer);
            mapView.Overlays.Add(staticOverlay);

            mapView.Refresh();
        }
Beispiel #27
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit = GeographyUnit.DecimalDegree;
            LayerOverlay staticOverlay = new LayerOverlay();
            //GeoTiffRasterLayer layer = new GeoTiffRasterLayer(SampleHelper.Get("World.tif"));

            UnmanagedGeoTiffRasterLayer layer = new UnmanagedGeoTiffRasterLayer(SampleHelper.Get("World.tif"));

            staticOverlay.Layers.Add(layer);
            mapView.Overlays.Add(staticOverlay);

            layer.Open();
            RectangleShape extent = layer.GetBoundingBox();

            mapView.CurrentExtent = extent;
            mapView.Refresh();
        }
        private void btnGetEnvelope_Click(object sender, RoutedEventArgs e)
        {
            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.Open();
            RectangleShape usBoundingBox = worldLayer.QueryTools.GetFeatureById("137", new string[0]).GetBoundingBox();

            worldLayer.Close();

            InMemoryFeatureLayer boundingBoxLayer = (InMemoryFeatureLayer)mapView.FindFeatureLayer("BoundingBoxLayer");

            if (!boundingBoxLayer.InternalFeatures.Contains("BoundingBox"))
            {
                boundingBoxLayer.InternalFeatures.Add("BoundingBox", new Feature(usBoundingBox.GetWellKnownBinary(), "BoundingBox"));
            }

            mapView.Overlays["BoundingBoxOverlay"].Refresh();
        }
Beispiel #29
0
        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 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;

            InMemoryFeatureLayer rectangleLayer = new InMemoryFeatureLayer();

            rectangleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(new GeoColor(50, 100, 100, 200)));
            rectangleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColors.DarkBlue;
            rectangleLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            rectangleLayer.InternalFeatures.Add("Rectangle", new Feature("POLYGON((-5565975 -2273031,-5565975 2273031,5565975 2273031,5565975 -2273031,-5565975 -2273031))", "Rectangle"));

            InMemoryFeatureLayer spatialQueryResultLayer = new InMemoryFeatureLayer();

            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(200, GeoColors.PastelRed)));
            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColors.Red;
            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay worldOverlay = new LayerOverlay();

            worldOverlay.Layers.Add("WorldLayer", worldLayer);
            mapView.Overlays.Add("WorldOverlay", worldOverlay);

            LayerOverlay spatialQueryResultOverlay = new LayerOverlay();

            spatialQueryResultOverlay.TileType = TileType.SingleTile;
            spatialQueryResultOverlay.Layers.Add("RectangleLayer", rectangleLayer);
            spatialQueryResultOverlay.Layers.Add("SpatialQueryResultLayer", spatialQueryResultLayer);
            mapView.Overlays.Add("SpatialQueryResultOverlay", spatialQueryResultOverlay);

            mapView.Refresh();
        }
        private void mapView_Loaded(object sender, RoutedEventArgs e)
        {
            //Load the well depth points and depth data from a text file into the dictionary
            //We cache this at the class level to prevent form loading it multiple times
            string wellDepthPointDataFilePath = SampleHelper.Get("GrayCountyIrrigationWellDepths.csv");
            Dictionary <PointShape, double> wellDepthPointData = GetWellDepthPointDataFromCSV(wellDepthPointDataFilePath);

            //Get the current extent since we use that to gerenate the grid.  Of course this is just for
            //the demo and in the real world you can use any extent you like
            RectangleShape currentDrawingExtent = MapUtil.GetDrawingExtent(mapView.CurrentExtent, (float)mapView.ActualWidth, (float)mapView.ActualHeight);

            //Calculate the cell size based on how many rows and columns you specified
            double cellSize = Math.Min(currentDrawingExtent.Width / 4, currentDrawingExtent.Height / 4);

            //Greate the grid definition based on the extent, cell size etc.
            GridDefinition gridDefinition = new GridDefinition(currentDrawingExtent, cellSize, -9999, wellDepthPointData);

            //Generate the grid based on Inverse Distance Weighted interpolation model.  You can define your own model if needed.
            GridCell[,] gridCellMatrix = GridFeatureSource.GenerateGridMatrix(gridDefinition, new InverseDistanceWeightedGridInterpolationModel(2, double.MaxValue));

            //Load a new GridFeatureLayer based on the current grid file
            InMemoryGridFeatureLayer gridFeatureLayer = new InMemoryGridFeatureLayer(gridCellMatrix);

            gridFeatureLayer.Open();
            var currentExtent = gridFeatureLayer.GetBoundingBox();

            gridFeatureLayer.Close();

            gridFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColors.Black);
            gridFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            //Add the grid layer, the grid cells, and the well points to the map
            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(gridFeatureLayer);

            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = currentExtent;
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.Overlays.Add(layerOverlay);
            mapView.Refresh();
        }