Skip to main content

Vector Tiles Utilities

Project description

VTiles - Vector Tiles Utilities

Installation:

  • Using pip install (Windows/ Linux):

    pip install vtiles
    
  • Show information of installed vtiles:

    pip show vtiles
    
  • Install the latest vertion of vtiles:

    pip install vtiles --upgrade
    
  • Visit vtiles on PyPI

Usage:

MBTILES Utilities:

mbtilesinfo

  • Show MBTiles metadata info:
    > mbtilesinfo <file_path>
    
    Ex: > mbtilesinfo tiles.mbtiles

mbtiles2folder

  • Convert MBTiles file to folder: (support raster MBTiles (.png, .jpg, .webp) and vector MBTiles (.pbf))
    > mbtiles2folder -i <file_name.mbtiles> -o [output_folder (optional, current dir if not specified)] -flipy [TMS <--> XYZ tiling scheme (optional): 1 or 0, default is 0] -minzoom [optional, default is 0] -maxzoom [Maximum zoom level to export (optional, default is maxzoom from input MBTiles]
    
    Ex: > mbtiles2folder -i tiles.mbtiles -o tiles_folder -flipy 0 -minzoom 0 -maxzoom 6

folder2mbtiles

  • Convert a tiles folder to MBTiles file: (support raster tile (.png, .jpg, .webp) and vector tile (.pbf))

    > folder2mbtiles -i <input_folder> -o [file_name.mbtiles (optional)] -flipy [TMS <--> XYZ tiling scheme (optional): 1 or 0, default is 0]
    

    Ex: > folder2mbtiles -i tiles_folder -o tiles.mbtiles -flipy 0

    Without -o parameter: file_name.mbtiles has the same name with <input_folder> name at the current directory

mbtiles2geojson

  • Convert MBTiles to GeoJSON.
    > mbtiles2geojson -i <input file> -o <Output GeoJSON> -minzoom <minzoom> -maxzoom <maxzoom> -flipy [TMS <--> XYZ tiling scheme (optional): 1 or 0, default is 0] -l [List of layer names to convert, all layers if not specified]
    
    Ex: > mbtiles2geojson -i tiles.mbtils -o geojson.geojson -minzoom 0 - maxzoom 1 -flipy 0 -l water building

geoson2mbtiles

  • Convert geojson file to mbtiles (need tippecanoe to be installed)
    > geojson2mbtiles -i <input files> -z <maxzoom> -o <output> -t <tippecanoe path> --extra-args <drop-densest-as-needed or coalesce-densest-as-needed or extend-zooms-if-still-dropping>
    
    Ex: > geojson2mbtiles -i state.geojson district.geojson -z9 -o state_district.mbtiles -t /usr/local/bin/ --extra-args coalesce-densest-as-needed (on Linux)

folder2s3

  • Uplpad a vector/ raster tiles folder to Amazon S3 Bucket:

    > folder2s3 -i <input_folder> -format <'pbf', 'png', 'jpg', 'jpeg', 'webp', 'pbf', 'mvt'>
    

    Ex: > folder2s3 -i vectortiles_folder -format pbf

    Input S3 parameters:

      > S3 Bucket name: <Your S3 Bucket name (required)>
      > S3 Prefix: [Your S3 prefix (Optional. Press Enter to upload to the bucket root folder)]
      > AWS Access Key ID: <Your_Access_Key_ID (required)>
      > AWS Secret Access Key: <Your_Secrect_Access_Key (required)>
      > AWS Region: <AWS region (Optional. Press Enter to choose default region)>
    

mbtiles2s3

  • Uplpad a MBTiles file to Amazon S3 Bucket: Need to install aws cli and run aws configure to input credentials first
    > mbtiles2s3 <input file> <s3 bucket> -p (to see the uploading progress)
    
    Ex: > mbtiles2s3 tiles.mbtiles s3://mybucket -p

mbtiles2pbf

  • Extract a tile from MBTiles to PBF
      > mbtiles2pbf -i <input file> -z <zoom level> -x <tile column> -y <tile row> -o <output file>
    
    Ex: > mbtiles2pbf -i tiles.mbtils -z 2 -x 1 -y 2 -o pbf_212.pbf

pbfinfo

  • Show pbf metadata info
      > pbfinfo <input file>
    
    Ex: > pbfinfo pbf_file.pbf

pbf2geojson

  • Convert tile data from a BBF file, MBTiles file, or URL to GeoJSON
      > pbf2geojson -i <input pbf, MBTiles or URL> -o <output file> -z <tile zoom level> - x <tile column> -y <tile row>  -flipy [TMS <--> XYZ tiling scheme (optional): 1 or 0, default is 0] 
    
    Ex: > pbf2geojson -i pbf_file.pbf -o geojson_file.geojson -z 2 -x 1 -y 2

flipy

  • Convert TMS <--> XYZ tiling scheme for a tiles folder
      > flipy -i <input folder> -o <output folder>
    
    Ex: > flipy -i input_folder -o output_folder

mbtiles2pmtiles

  • Convert Convert MBTiles to PMTiles
      > flipy -i <input MBTiles> -o <output PMTiles> -z <max zoom level>
    
    Ex: > mbtiles2pmtiles -i mbtiles_file.mbtiles -o pmtiles_file.pmtiles -z 6

mbtilessplit

  • Split an MBTiles file by selected layers
      > mbtilessplit -i <input file> -o <output file> -l <list of layer names to be splitted>
    
    Ex: > mbtilessplit -i input_file.mbtiles -o splitted_file.mbtiles -l water (mbtilessplit also save remaining mbtiles layers to {input file}_remained.mbtiles)

mbtilesmerge

  • Merge multiple MBTiles files into a single MBTiles file
      > mbtilesmerge -i <input file list> -o <output file> -l <list of layer names to be splitted>
    
    Ex: > mbtilesmerge -i file_1.mbtiles file_2.mbtiles -o merged.mbtiles

mbtilescompress

  • Compress MBTiles file with GZIP
      > mbtilescompress -i <input file> -o <output file>
    
    Ex: > mbtilescompress -i mbtiles_file.mbtiles -o compressed.mbtiles

mbtilesdecompress

  • Decompress MBTiles file (either being compressed with GZIP or ZLIB)
      > mbtilesdecompress -i <input file> -o <output file>
    
    Ex: > mbtilesdecompress -i mbtiles_file.mbtiles -o decompressed.mbtiles

mbtilesfixmeta

  • Create or update metadata for an existing MBTiles file.
      > mbtilesfixmeta <input file>
    
    Ex: > mbtilesfixmeta mbtiles_file.mbtiles

MBTILES Server Utilities:

servefolder

  • Serve a raster tiles or vector tiles for the current folder, so clients can access to the tiles server via, for ex. htttp://localhost/8000/tiles/{z}/{x}/{y}.pbf.
      > servefolder
    

servembtiles

  • Serve raster tiles for the input MBTiles file, so clients can access to the tiles server via, for ex. htttp://localhost/8000/rastertiles/z/x/y.png.
      > servembtiles --serve -p <port> -f <input file>
    

servevectormbtiles

  • Serve vector tiles for the input MBTiles file, so clients can access to the tiles server via, for ex. htttp://localhost/8000/vectortiles/z/x/y.pbf.
      > servevectormbtiles --serve -p <port> -f <input file>
    

servepostgis

  • Serve MVT tiles from a PostgreSQL/PostGIS database, so clients can access to the tiles server via, for ex. htttp://localhost/8000/mvt/z/x/y.pbf.
      > servepostgis -config <YAML configuration file> 
    

servepmtiles

  • Serve MVT tiles from a PostgreSQL/PostGIS database, so clients can access to the tiles server via, for ex. htttp://localhost/8000/pmtiles/z/x/y.pbf.
      > servepostgis -i <PMTiles file> -port <port number> -host <host IP, default is localhost>
    

Other Utilities:

pmtilesinfo

  • Show PMTiles metadata.
      > pmtilesinfo <mbtiles file> Z [zoom level] X [tile column] Y [tile row]
    

pmtiles2folder

  • Convert PMTiles file to folder
    > pmtiles2folder -i <input file> -o <output_folder>
    

pmtiles2mbtiles

  • Convert PMTiles file to MBTiles file
    > pmtiles2mbtiles -i <input PMTiles> -o <output MBTiles>
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vtiles-1.0.1.tar.gz (102.4 kB view details)

Uploaded Source

Built Distribution

vtiles-1.0.1-py3-none-any.whl (136.3 kB view details)

Uploaded Python 3

File details

Details for the file vtiles-1.0.1.tar.gz.

File metadata

  • Download URL: vtiles-1.0.1.tar.gz
  • Upload date:
  • Size: 102.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for vtiles-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3a785e04704ae377c71ba8a6d4a32c7c32984a3d029868663c6518c087739ae7
MD5 06128d3c18fe1ada79e5931da4c21e27
BLAKE2b-256 be0975543762804db7dd5394f82d765a4ba8db6e8c12118c7169a5323fe0f952

See more details on using hashes here.

File details

Details for the file vtiles-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: vtiles-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 136.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for vtiles-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2f1cdf4ca6ae0715be0211c6e120f38a73ad49595b0a50770cbfa53a3debcc9
MD5 3f419f00bd2665bd21705e681669fb83
BLAKE2b-256 1e1ab3fc1629ca07b657d23e20dc37e2b1737705926787ca1f92ac8b52f999f2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page