protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayMapView); TabFeatureLayer tabFeatureLayer = new TabFeatureLayer(SampleHelper.GetDataPath(@"Tab/HoustonMuniBdySamp_Boundary.tab")); tabFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), GeoColor.SimpleColors.Green); tabFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; tabFeatureLayer.Open(); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(tabFeatureLayer); WorldMapKitOverlay worldMapKitOverlay = new WorldMapKitOverlay(); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.MapUnit = GeographyUnit.DecimalDegree; androidMap.CurrentExtent = tabFeatureLayer.GetBoundingBox(); androidMap.Overlays.Add(worldMapKitOverlay); androidMap.Overlays.Add(layerOverlay); SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType()); }
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(); }
protected override void BuildIndexCore(FeatureLayer featureLayer) { var uri = LayerPlugin.GetUri(featureLayer); if (uri != null) { TabFeatureLayer.BuildIndexFile(uri.LocalPath, BuildIndexMode.DoNotRebuild); } }
private void WpfMap_Loaded(object sender, RoutedEventArgs e) { wpfMap1.MapUnit = GeographyUnit.DecimalDegree; wpfMap1.CurrentExtent = new RectangleShape(-96.51477, 30.759543, -94.355788, 28.910652); WorldMapKitWmsWpfOverlay worldMapKitOverlay = new WorldMapKitWmsWpfOverlay(); wpfMap1.Overlays.Add(worldMapKitOverlay); TabFeatureLayer worldLayer = new TabFeatureLayer(@"..\..\SampleData\Data\HoustonMuniBdySamp_Boundary.TAB"); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), GeoColor.SimpleColors.Green); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.TileType = TileType.SingleTile; staticOverlay.Layers.Add("WorldLayer", worldLayer); wpfMap1.Overlays.Add(staticOverlay); wpfMap1.Refresh(); }
/// <summary> /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the TAB 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. 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 cityboundaryOverlay = new LayerOverlay(); mapView.Overlays.Add(cityboundaryOverlay); // Create the new layer and set the projection as the data is in srid 2276 and our background is srid 3857 (spherical mercator). TabFeatureLayer cityBoundaryLayer = new TabFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Tab/City_ETJ.tab")); cityBoundaryLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Add the layer to the overlay we created earlier. cityboundaryOverlay.Layers.Add("City Boundary", cityBoundaryLayer); // Set this so we can use our own styles as opposed to the styles in the file. cityBoundaryLayer.StylingType = TabStylingType.StandardStyling; // Create an Area style on zoom level 1 and then apply it to all zoom levels up to 20. cityBoundaryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColors.Green), GeoColors.Green); cityBoundaryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Open the layer and set the map view current extent to the bounding box of the layer. cityBoundaryLayer.Open(); mapView.CurrentExtent = cityBoundaryLayer.GetBoundingBox(); // Refresh the map. mapView.Refresh(); }
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 cityboundaryOverlay = new LayerOverlay(); mapView.Overlays.Add(cityboundaryOverlay); // Create the new layer and set the projection as the data is in srid 2276 and our background is srid 3857 (spherical mercator). TabFeatureLayer cityBoundaryLayer = new TabFeatureLayer(@"../../../Data/Tab/City_ETJ.tab"); cityBoundaryLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857); // Add the layer to the overlay we created earlier. cityboundaryOverlay.Layers.Add("City Boundary", cityBoundaryLayer); // Set this so we can use our own styles as opposed to the styles in the file. cityBoundaryLayer.StylingType = TabStylingType.StandardStyling; // Create an Area style on zoom level 1 and then apply it to all zoom levels up to 20. cityBoundaryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColors.Green), GeoColors.Green); cityBoundaryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Open the layer and set the map view current extent to the bounding box of the layer. cityBoundaryLayer.Open(); mapView.CurrentExtent = cityBoundaryLayer.GetBoundingBox(); // Refresh the map. mapView.Refresh(); }
private void LoadTabFileFeatureLayer_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.ThreadingMode = MapThreadingMode.SingleThreaded; WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay(); winformsMap1.Overlays.Add(worldMapKitDesktopOverlay); winformsMap1.CurrentExtent = new RectangleShape(-96.51477, 30.759543, -94.355788, 28.910652); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); TabFeatureLayer worldLayer = new TabFeatureLayer(Samples.RootDirectory + @"Data\HoustonMuniBdySamp_Boundary.TAB"); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), GeoColor.SimpleColors.Green); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("WorldLayer", worldLayer); winformsMap1.Overlays.Add(staticOverlay); winformsMap1.Refresh(); }
protected override FeatureLayer CreateFeatureLayerCore(ConfigureFeatureLayerParameters featureLayerStructureParameters) { string layerPath = LayerPluginHelper.GetLayerUriToSave(featureLayerStructureParameters.LayerUri, ExtensionFilter); if (string.IsNullOrEmpty(layerPath)) { return(null); } featureLayerStructureParameters.LayerUri = new Uri(layerPath); Collection <TabDbfColumn> tabDbfColumns = new Collection <TabDbfColumn>(); foreach (var column in featureLayerStructureParameters.AddedColumns) { var columnLenght = column.MaxLength; var decimalLength = 0; switch (column.TypeName.ToUpperInvariant()) { case "DOUBLE": columnLenght = columnLenght == 0 ? 10 : columnLenght; decimalLength = 4; break; case "DATE": case "DATETIME": columnLenght = columnLenght == 0 ? 10 : columnLenght; decimalLength = 0; break; case "INTEGER": case "INT": columnLenght = columnLenght == 0 ? 10 : columnLenght; decimalLength = 0; break; case "STRING": columnLenght = columnLenght == 0 ? 255 : columnLenght; decimalLength = 0; break; } tabDbfColumns.Add(new TabDbfColumn(column.ColumnName, (DbfColumnType)Enum.Parse(typeof(DbfColumnType), column.TypeName, true), columnLenght, decimalLength, false, false)); } TabFeatureLayer.CreateTabFile(featureLayerStructureParameters.LayerUri.OriginalString, tabDbfColumns, new Collection <Feature>(), OverwriteMode.Overwrite); TabFeatureLayer.BuildIndexFile(featureLayerStructureParameters.LayerUri.OriginalString); string prjPath = Path.ChangeExtension(featureLayerStructureParameters.LayerUri.OriginalString, "prj"); File.WriteAllText(prjPath, Proj4Projection.ConvertProj4ToPrj(featureLayerStructureParameters.Proj4ProjectionParametersString)); var resultLayer = new TabFeatureLayer(featureLayerStructureParameters.LayerUri.LocalPath, GeoFileReadWriteMode.ReadWrite); if (featureLayerStructureParameters.AddedFeatures.Count > 0) { resultLayer.Open(); resultLayer.EditTools.BeginTransaction(); foreach (var feature in featureLayerStructureParameters.AddedFeatures) { resultLayer.EditTools.Add(feature); } resultLayer.EditTools.CommitTransaction(); resultLayer.Close(); } return(resultLayer); }