Ejemplo n.º 1
0
        /// <summary>
        /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the ISOLine layer to the map
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // It is important to set the map unit first to either feet, meters or decimal degrees.
            mapView.MapUnit = GeographyUnit.Meter;

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            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);

            // Create a new overlay that will hold our new layer and add it to the map.
            LayerOverlay isoLineOverlay = new LayerOverlay();

            mapView.Overlays.Add("isoLineOverlay", isoLineOverlay);

            // Load a csv file with the mosquito data that we will use for the iso line.
            Dictionary <PointShape, double> csvPointData = GetDataFromCSV(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Csv/Frisco_Mosquitos.csv"));

            // Create the layer based on the method GetDynamicIsoLineLayer and pass in the points we loaded above and add it to the map.
            //  We then set the drawing quality high so we get a crisp rendering.
            var isoLineLayer = GetDynamicIsoLineLayer(csvPointData);

            isoLineOverlay.Layers.Add("IsoLineLayer", isoLineLayer);
            isoLineOverlay.DrawingQuality = DrawingQuality.HighQuality;

            // Create a layer that so we can get the current extent below to set the maps extend
            // We wont use it after so later in the code we will just close it.
            var mosquitosLayer = new ShapeFileFeatureSource(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/Frisco_Mosquitos.shp"));

            mosquitosLayer.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Open the layer and set the map view current extent to the bounding box of the layer scaled up just a bit then close the layer
            mosquitosLayer.Open();
            mapView.CurrentExtent = mosquitosLayer.GetBoundingBox();
            mosquitosLayer.Close();

            // Refresh the map.
            mapView.Refresh();
        }
Ejemplo n.º 2
0
        private void Form_Load(object sender, EventArgs e)
        {
            // It is important to set the map unit first to either feet, meters or decimal degrees.
            mapView.MapUnit = GeographyUnit.Meter;

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Create a new overlay that will hold our new layer and add it to the map.
            LayerOverlay isoLineOverlay = new LayerOverlay();

            mapView.Overlays.Add("isoLineOverlay", isoLineOverlay);

            // Load a csv file with the mosquito data that we will use for the iso line.
            Dictionary <PointShape, double> csvPointData = GetDataFromCSV(@"../../../data/Csv/Frisco_Mosquitos.csv");

            // Create the layer based on the method GetDynamicIsoLineLayer and pass in the points we loaded above and add it to the map.
            //  We then set the drawing quality high so we get a crisp rendering.
            var isoLineLayer = GetDynamicIsoLineLayer(csvPointData);

            isoLineOverlay.Layers.Add("IsoLineLayer", isoLineLayer);
            isoLineOverlay.DrawingQuality = DrawingQuality.HighQuality;

            // Create a layer that so we can get the current extent below to set the maps extend
            // We wont use it after so later in the code we will just close it.
            var mosquitosLayer = new ShapeFileFeatureSource(@"../../../data/Shapefile/Frisco_Mosquitos.shp");

            mosquitosLayer.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Open the layer and set the map view current extent to the bounding box of the layer scaled up just a bit then close the layer
            mosquitosLayer.Open();
            mapView.CurrentExtent = mosquitosLayer.GetBoundingBox();
            mosquitosLayer.Close();

            // Refresh the map.
            mapView.Refresh();
        }