private void mapView1_CurrentScaleChanged(object sender, CurrentScaleChangedMapViewEventArgs e) { int zoom = MBTilesGenerator.GetZoom(this.mapView1.ZoomLevelSet, e.NewScale); StringBuilder sb = new StringBuilder(); sb.AppendLine($"Current Zoom: {zoom}"); MBTiles.Tile tile = MBTilesGenerator.GetFirstTile(txtMbtilesFilePathname.Text, zoom); if (tile != null) { foreach (MBTiles.TileLayer tileLayer in tile.Layers) { sb.AppendLine($"Layer: {tileLayer.Name}"); sb.AppendLine($"Version: {tileLayer.Version}"); sb.AppendLine($"There are {tileLayer.Keys.Count} columns in the data"); foreach (string key in tileLayer.Keys) { sb.AppendLine($"\t Column Name: {key}"); } } } txtMBTileInfo.Text = sb.ToString(); }
private async Task GenerateTiles() { if (cancellationTokenSource != null) { cancellationTokenSource.Cancel(); cancellationTokenSource.Dispose(); } cancellationTokenSource = new System.Threading.CancellationTokenSource(); List <string> attributes = new List <string>(); for (int i = 0; i < clbSelectedAttributes.CheckedItems.Count; ++i) { attributes.Add(clbSelectedAttributes.CheckedItems[i].ToString()); } OutputMessage("Processing Vector tiles..\n"); DateTime tick = DateTime.Now; ShapeFileFeatureSource.BuildIndexFile(this.txtInputShapeFile.Text, BuildIndexMode.DoNotRebuild); await MBTilesGenerator.Process(this.txtInputShapeFile.Text, this.txtMbtilesFilePathname.Text, cancellationTokenSource.Token, (int)(nudStartZoom.Value), (int)(nudEndZoom.Value), 512, attributes); OutputMessage("Processing Vector tiles complete. Elapsed time:" + DateTime.Now.Subtract(tick) + "\n"); }