protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayMapView); TinyGeoFeatureLayer tinyGeoFeatureLayer = new TinyGeoFeatureLayer(SampleHelper.GetDataPath(@"Frisco/Frisco.tgeo")); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel11.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGray, 1F, false); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel11.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level14; tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 3F, GeoColor.StandardColors.DarkGray, 5F, true); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 8F, GeoColor.StandardColors.DarkGray, 10F, true); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 10f, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; tinyGeoFeatureLayer.Open(); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(tinyGeoFeatureLayer); WorldMapKitOverlay worldMapKitOverlay = new WorldMapKitOverlay(); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.MapUnit = GeographyUnit.DecimalDegree; androidMap.Overlays.Add(worldMapKitOverlay); androidMap.Overlays.Add(layerOverlay); androidMap.CurrentExtent = tinyGeoFeatureLayer.GetBoundingBox(); SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType()); }
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 the background world maps using vector tiles requested from the ThinkGeo Cloud Service and add it to the map. 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 tinyGeoOverlay = new LayerOverlay(); mapView.Overlays.Add(tinyGeoOverlay); // Create the new layer and set the projection as the data is in srid 2276 and our background is srid 3857 (spherical mercator). TinyGeoFeatureLayer tinyGeoLayer = new TinyGeoFeatureLayer(@"../../../Data/TinyGeo/Zoning.tgeo"); tinyGeoLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Add the layer to the overlay we created earlier. tinyGeoOverlay.Layers.Add("Zoning", tinyGeoLayer); // Create an Area style on zoom level 1 and then apply it to all zoom levels up to 20. tinyGeoLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(GeoPens.Black, new GeoSolidBrush(new GeoColor(50, GeoColors.Blue))); tinyGeoLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Open the layer and set the map view current extent to the bounding box of the layer. tinyGeoLayer.Open(); mapView.CurrentExtent = tinyGeoLayer.GetBoundingBox(); // Refresh the map. mapView.Refresh(); }
private void mapView_Loaded(object sender, RoutedEventArgs e) { var tinyGeoFeatureLayer = new TinyGeoFeatureLayer(SampleHelper.Get("Frisco.tgeo")); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColors.Black, 1, true); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; tinyGeoFeatureLayer.Open(); var currentExtent = tinyGeoFeatureLayer.GetBoundingBox(); tinyGeoFeatureLayer.Close(); var layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(tinyGeoFeatureLayer); mapView.Overlays.Add(layerOverlay); mapView.MapUnit = GeographyUnit.DecimalDegree; mapView.CurrentExtent = currentExtent; mapView.Refresh(); }
/// <summary> /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the TinyGeo 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 the background world maps using vector tiles requested from the ThinkGeo Cloud Service and add it to the map. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light); thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector"); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Create a new overlay that will hold our new layer and add it to the map. LayerOverlay tinyGeoOverlay = new LayerOverlay(); mapView.Overlays.Add(tinyGeoOverlay); // Create the new layer and set the projection as the data is in srid 2276 and our background is srid 3857 (spherical mercator). TinyGeoFeatureLayer tinyGeoLayer = new TinyGeoFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/TinyGeo/Zoning.tgeo")); tinyGeoLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Add the layer to the overlay we created earlier. tinyGeoOverlay.Layers.Add("Zoning", tinyGeoLayer); // Create an Area style on zoom level 1 and then apply it to all zoom levels up to 20. tinyGeoLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(GeoPens.Black, new GeoSolidBrush(new GeoColor(50, GeoColors.Blue))); tinyGeoLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Open the layer and set the map view current extent to the bounding box of the layer. tinyGeoLayer.Open(); mapView.CurrentExtent = tinyGeoLayer.GetBoundingBox(); // Refresh the map. mapView.Refresh(); }