private static async Task <VectorTile> baseTileToVector(object baseTile) { var tile = baseTile as Mapbox.VectorTile.VectorTile; var result = new VectorTile(); foreach (var lyrName in tile.LayerNames()) { Mapbox.VectorTile.VectorTileLayer lyr = tile.GetLayer(lyrName); var vectorLayer = new VectorTileLayer(); vectorLayer.Name = lyrName; for (int i = 0; i < lyr.FeatureCount(); i++) { Mapbox.VectorTile.VectorTileFeature feat = lyr.GetFeature(i); var vectorFeature = new VectorTileFeature(); vectorFeature.Extent = 1; vectorFeature.GeometryType = convertGeometryType(feat.GeometryType); vectorFeature.Attributes = feat.GetProperties(); var vectorGeometry = new List <List <Point> >(); foreach (var points in feat.Geometry <int>()) { var vectorPoints = new List <Point>(); foreach (var coordinate in points) { var dX = (double)coordinate.X / (double)lyr.Extent; var dY = (double)coordinate.Y / (double)lyr.Extent; vectorPoints.Add(new Point(dX, dY)); //var newX = Utils.ConvertRange(dX, extent.Left, extent.Right, 0, vectorFeature.Extent); //var newY = Utils.ConvertRange(dY, extent.Top, extent.Bottom, 0, vectorFeature.Extent); //vectorPoints.Add(new Point(newX, newY)); } vectorGeometry.Add(vectorPoints); } vectorFeature.Geometry = vectorGeometry; vectorLayer.Features.Add(vectorFeature); } result.Layers.Add(vectorLayer); } return(result); }