MVT: Mapbox Vector Tiles — GDAL documentation

文章推薦指數: 80 %
投票人數:10人

The MVT driver can read and write Mapbox Vector Tile files, as standalone files, uncompressed or gzip-compressed (typical extensions are .pbf, .mvt, ... Download Programs Rasterdrivers Vectordrivers AmigoCloud ESRIArcObjects ARCGEN-Arc/InfoGenerate Arc/InfoBinaryCoverage Arc/InfoE00(ASCII)Coverage CAD–AutoCADDWG Carto Cloudant–Cloudant CouchDB-CouchDB/GeoCouch CommaSeparatedValue(.csv) CSW-OGCCSW(CatalogServicefortheWeb) DB2Spatial MicrostationDGN MicrostationDGNv8 DODS/OPeNDAP AutoCADDWG AutoCADDXF GoogleEarthEngineDataAPI EDIGEO Elasticsearch:GeographicallyEncodedObjectsforElasticsearch ESRIJSON/FeatureServicedriver ESRIFileGeodatabase(FileGDB) FlatGeobuf FMEObjectsGateway GeoConcepttextexport GeoJSON GeoJSONSeq:sequenceofGeoJSONfeatures GeomediaMDBdatabase GeoRSS:GeographicallyEncodedObjectsforRSSfeeds GMLAS-GeographyMarkupLanguage(GML)drivenbyapplicationschemas GML-GeographyMarkupLanguage GMTASCIIVectors(.gmt) GPKG–GeoPackagevector GPSBabel GPX-GPSExchangeFormat GRASSVectorFormat GTM-GPSTrackMaker IDB IdrisiVector(.VCT) “INTERLIS1”and“INTERLIS2”drivers INGRES JML:OpenJUMPJMLformat KML-KeyholeMarkupLanguage LIBKMLDriver(.kml.kmz) DutchKadasterLVBAG2.0Extract MapML AccessMDBdatabases Memory MapInfoTABandMIF/MID MongoDB MongoDBv3 MSSQLSpatial-MicrosoftSQLServerSpatialDatabase MVT:MapboxVectorTiles Drivercapabilities Connectionstrings metadata.json Openingoptions Creationissues Datasetcreationoptions Layerconfiguration Layercreationoptions Examples MySQL NAS-ALKIS NetCDF:NetworkCommonDataForm-Vector NGW–NextGISWeb UK.NTF OGCAPI-Features OracleSpatial ODBCRDBMS ODS-OpenDocumentSpreadsheet OGDIVectors ESRIFileGeodatabase(OpenFileGDB) OSM-OpenStreetMapXMLandPBF PDF–GeospatialPDF PDS-PlanetaryDataSystemsTABLE PostgreSQLSQLDump ESRIPersonalGeoDatabase PostgreSQL/PostGIS PLScenes(PlanetLabsScenes/CatalogAPI) IHOS-57(ENC) SDTS Selafinfiles ESRIShapefile/DBF NorwegianSOSIStandard SQLite/SpatialiteRDBMS SVG-ScalableVectorGraphics StorageandeXchangeFormat-SXF U.S.CensusTIGER/Line TopoJSONdriver VDV-VDV-451/VDV-452/INTRESTDataFormat VFK-CzechCadastralExchangeDataFormat VRT–VirtualFormat Walk-WalkSpatialData WAsP-WAsP.mapformat WFS-OGCWFSservice XLS-MSExcelformat XLSX-MSOfficeOpenXMLspreadsheet User API Tutorials Development Community Sponsors Howtocontribute? FAQ License GDAL GDALdocumentation» Vectordrivers» MVT:MapboxVectorTiles EditonGitHub Next Previous MVT:MapboxVectorTiles Newinversion2.3. Drivershortname MVT Builddependencies (requiresSQLiteandGEOSforwritesupport) TheMVTdrivercanreadandwriteMapboxVector Tilefiles,asstandalonefiles,uncompressedorgzip-compressed (typicalextensionsare.pbf,.mvt,.mvt.gz),oratilesetatagiven zoomlevelofsuchfiles.WritesupportrequiresGDALtobebuiltwith libsqlite3andGEOSsupport. MapboxVectorTilesstoredwithinaSQLitecontainerconformingtothe MBTilesformatarehandledbytheMBTiles driver. TilesetsofMVTfilescanforexamplebegeneratedby tippecanoeor tileserver-gl.The outputfilehierarchywillcontainametadata.json fileatitsrootand{z}/{x}/{y}.pbffileswiththetiles,wherezis thezoomleveland(x,y)thecoordinateofthetileinagivenzoom level.Theoriginofthetilingsystemisthetop-lefttile(XYZ convention).Forexample,forzoomlevels0and1: /metadata.json /0/ 0/ 0.pbf /1/ 0/ 0.pbf 1.pbf 1/ 0.pbf 1.pbf ThedriverwillassumebydefaultEPSG:3857(WebMercator)spatial referencesystemandZ/X/Ytilingstructure,ifopeningafilenamewith {Z}/{X}/{Y}.pbfor{Z}-{X}-{Y}.pbfname,orazoomlevelofatileset. Otherwiseintegercoordinateswillbereported. Note:Whenopeningazoomlevelofatileset,thedriverwillmakeno effortofstitchingtogethergeometriesforfeaturesthatoverlapseveral tiles. Drivercapabilities SupportsCreate() ThisdriversupportstheGDALDriver::Create()operation SupportsGeoreferencing Thisdriversupportsgeoreferencing SupportsVirtualIO ThisdriversupportsvirtualI/Ooperations(/vsimem/,etc.) Connectionstrings Thefollowingconnectionstringsaresupported: /path/to/some.pbf MVT:http[s]://path/to/some.pbf /path/to/{Z}:where{Z}isazoomlevelbetween0and30,tilesare in/path/to/{Z}/{X}/{Y}.pbffiles,and/path/to/metadata.jsonor /path/to.jsonshouldtypicallyexist. MVT:http[s]://path/to/{Z] TheMVT:prefixmaybeaddedbeforethefilenameordirectorynameto helpforcingidentificationofdatasetsinsomerarecaseswhere non-guidedidentificationwouldfail. metadata.json Thisfileistypicallygeneratedbytippecanoeandhasthefollowing content: { "name":"my_layername", "description":"my_layername", "version":"2", "minzoom":"0", "maxzoom":"0", "center":"2.500000,49.500000,0", "bounds":"2.000000,49.000000,3.000000,50.000000", "type":"overlay", "format":"pbf", "json":"{ \"vector_layers\":[{ \"id\":\"my_layername\", \"description\":\"\", \"minzoom\":0, \"maxzoom\":0, \"fields\":{ \"bool_false\":\"Boolean\", \"bool_true\":\"Boolean\", \"float_value\":\"Number\", \"pos_int_value\":\"Number\", \"pos_int64_value\":\"Number\", \"neg_int_value\":\"Number\", \"neg_int64_value\":\"Number\", \"pos_sint_value\":\"Number\", \"pos_sint64_value\":\"Number\", \"neg_sint_value\":\"Number\", \"neg_sint64_value\":\"Number\", \"real_value\":\"Number\", \"string_value\":\"String\", \"uint_value\":\"Number\", \"uint64_value\":\"Number\" } }], \"tilestats\":{ \"layerCount\":1, \"layers\":[ { \"layer\":\"my_layername\", \"count\":2, \"geometry\":\"Point\", \"attributeCount\":0, \"attributes\":[] } ] } }}" } TheMVTdriveronlyusesthe“json”keytoretrievethelayernames, theirfieldsandthegeometrytype,andthe“bounds”keyforthelayer extent. Ifthisfilecannotbefound,thelayerschemaisestablishedby scanningthefeaturesofthetile(s). Asanextension,OGRhandlesinreadingandwritingcustomtiling schemesbyusingthecrs,tile_origin_upper_left_x, tile_origin_upper_left_yandtile_dimension_zoom_0metadataitems. Forexample,fortheFinnishETRS-TM35FIN(EPSG:3067)tilingscheme: { "...":"...", "crs":"EPSG:3067", "tile_origin_upper_left_x":-548576.0, "tile_origin_upper_left_y":8388608.0, "tile_dimension_zoom_0":2097152.0, } Openingoptions Thefollowingopenoptionsareavailable: X=int_value:XcoordinateoftheEPSG:3857tile. Y=int_value:YcoordinateoftheEPSG:3857tile. Z=int_value:ZcoordinateoftheEPSG:3857tile. METADATA_FILE=filename:Filenameofametadata.json-likefile. Ifopeninga/path/to/{Z}/{X}/{Y}.pbffile,thedriverwillby defaulttrytofind/path/to/metadata.json.Settingthevaluetothe emptystringisawayofavoidthemetadata.jsonfiletobeused. CLIP=YES/NO:Whethertoclipgeometriesofvectorfeaturesto tileextent.Generatorsofvectortileswilltypicallycreate geometrieswithasmallbufferbeyondthetileextentsothat geometriesintersectingseveraltilescanbeunionedback.Defaults toYESsothatthatbufferisremovedandgeometriesareclipped exactlytothetileextent. TILE_EXTENSION=string:Fortilesets,extensionoftiles. Defaultstopbf. TILE_COUNT_TO_ESTABLISH_FEATURE_DEFN=int_value:Fortilesets withoutmetadatafile,maximumnumberoftilestousetoestablish thelayerschemas.Defaultsto1000. Creationissues TilesaregeneratedwithWebMercator(EPSG:3857)projectionbydefault (customtilingschemescanbedefinedwiththeTILING_SCHEMEoption). Severallayerscanbewritten.Itispossibletodecideatwhichzoom levelrangesagivenlayeriswritten. Partoftheconversionismulti-threadedbydefault,usingasmany threadsastherearecores.Thenumberofthreadsusedcanbecontrolled withtheGDAL_NUM_THREADSconfigurationoption. Datasetcreationoptions NAME=string:Tilesetname.Defaultstothebasenameofthe outputfile/directory.Usedtofillmetadatarecords. DESCRIPTION=string:Adescriptionofthetileset.Usedtofill metadatarecords. TYPE=overlay/baselayer:Layertype.Usedtofillmetadata records. FORMAT=DIRECTORY/MBTILES:Formatintowhichtilesarewritten. DIRECTORYmeansthattilesarewritteninahierarchylike out_dir/{z}/{x}/{y}.pbf.MBTILESisforaMBTILEScontainer.Defaults toDIRECTORY,unlesstheoutputfilenamehasa.mbtilesextension TILE_EXTENSION=string:Fortilesetsasdirectoriesoffiles, extensionoftiles.Defaultstopbf. MINZOOM=integer:Minimumzoomlevelatwhichtilesare generated.Defaultsto0. MAXZOOM=integer:Maximumzoomlevelatwhichtilesare generated.Defaultsto5.Maximumsupportedvalueis22 CONF=string:LayerconfigurationasaJSonserializedstring. Or,startingwithGDAL3.0.1,filenamecontainingtheconfigurationasJSon. SIMPLIFICATION=float:Simplificationfactorforlinearor polygonalgeometries.Theunitistheintegerunitoftilesafter quantificationofgeometrycoordinatestotilecoordinates.Applies toallzoomlevels,unlessSIMPLIFICATION_MAX_ZOOMisalsodefined. SIMPLIFICATION_MAX_ZOOM=float:Simplificationfactorforlinear orpolygonalgeometries,thatappliesonlyforthemaximumzoom level. EXTENT=positive_integer.Numberofunitsinatile.The greater,themoreaccurategeometrycoordinates(attheexpenseof tilebytesize).Defaultsto4096 BUFFER=positive_integer.Numberofunitsforgeometry buffering.Thisvaluecorrespondstoabufferaroundeachsideofa tileintowhichgeometriesarefetchedandclipped.Thisisusedfor properrenderingofgeometriesthatspreadovertileboundariesby somerenderingclients.Defaultsto80ifEXTENT=4096. COMPRESS=YES/NO.Whethertocompresstileswiththe Deflate/GZipalgorithm.DefaultstoYES.ShouldbelefttoYESfor FORMAT=MBTILES. TEMPORARY_DB=string.Filenamewithpathforthetemporary databaseusedfortilegeneration.Bydefault,thiswillbeafilein thesamedirectoryastheoutputfile/directory. MAX_SIZE=integer.Maximumsizeofatileinbytes(after compression).Defaultsto500000.Ifatileisgreaterthanthis threshold,featureswillbewrittenwithreducedprecision,or discarded. MAX_FEATURES=integer.Maximumnumberoffeaturespertile. Defaultsto200000. BOUNDS=min_long,min_lat,max_long,max_lat.Overridedefault valueforboundsmetadataitemwhichiscomputedfromtheextentof featureswritten. CENTER=long,lat,zoom_level.Overridedefaultvalueforcenter metadataitem,whichisthecenterofBOUNDSatminimumzoomlevel. TILING_SCHEME=crs,tile_origin_upper_left_x,tile_origin_upper_left_y, tile_dimension_zoom_0:DefineacustomtilingschemewithaCRS (typicallygivenasEPSG:XXXX),thecoordinatesoftheupper-left corneroftheupper-lefttile(0,0)intheCRS,andthedimensionof thetileatzoomlevel0.OnlyavailableforFORMAT=DIRECTORY.The standardWebMercatortilingschemewouldbedefinedby “EPSG:3857,-20037508.343,20037508.343,40075016.686”.Atilingscheme forWGS84geodeticcouldbe“EPSG:4326,-180,180,360”.Thetiling schemeforFinnishETRS-TM35FIN(EPSG:3067)is “EPSG:3067,-548576,8388608,2097152”.Whenusingsuchascustomtiling scheme,the‘crs’,‘tile_origin_upper_left_x’, ‘tile_origin_upper_left_y’and‘tile_dimension_zoom_0’entriesare addedtothemetadata.json,andarehonouredbytheOGRMVTreader. Layerconfiguration TheabovementionedCONFdatasetcreationoptioncanbesettoastring whosevalueisaJSonserializeddocumentsuchasthebelowone: { "boundaries_lod0":{ "target_name":"boundaries", "description":"Countryboundaries", "minzoom":0, "maxzoom":2 }, "boundaries_lod1":{ "target_name":"boundaries", "minzoom":3, "maxzoom":5 } } boundaries_lod0andboundaries_lod1arethenameoftheOGRlayers thatarecreatedintothetargetMVTdataset.TheyaremappedtotheMVT targetlayerboundaries. Itisalsopossibletogetthesamebehaviorwiththebelowlayer creationoptions,althoughthatisnotconvenientintheogr2ogruse case. Layercreationoptions MINZOOM=integer:Minimumzoomlevelatwhichtilesare generated.DefaultstothedatasetcreationoptionMINZOOMvalue. MAXZOOM=integer:Minimumzoomlevelatwhichtilesare generated.DefaultstothedatasetcreationoptionMAXZOOMvalue. Maximumsupportedvalueis22 NAME=string:Targetlayername.Defaultstothelayername,but canbeoverriddensothatseveralOGRlayersmaptoasingletarget MVTlayer.ThetypicalusecaseistohavedifferentOGRlayersfor mutuallyexclusivezoomlevelranges. DESCRIPTION=string:Adescriptionofthelayer. Examples ogrinfoMVT:https://free.tilehosting.com/data/v3/1-ootile_extension="pbf.pict?key=${YOUR_KEY}"--debugon-oometadata_file="https://free.tilehosting.com/data/v3.json?key=${YOUR_KEY}" ogr2ogr-fMVTmytilesetsource.gpkg-dscoMAXZOOM=10 SeeAlso: MapboxVectorTile Specification MBTilesdriver tippecanoe:Buildsvector tilesetsfromlarge(orsmall)collectionsofGeoJSON,Geobuf,orCSV features LinkstotoolsdealingwithMapboxVector Tiles



請為這篇文章評分?