Công nghệ GIS Mẹo vặt WebGIS

Clip MBTiles with BoundingBox

Table of Content

Clip MBTiles with BoundingBox

Ví dụ

Tình hình là mình muốn cắt Mbtiles theo mask cơ, cơ mà tìm không ra, chỉ tìm được cắt theo bbox thôi. Tạm thời note lại vậy.

tilelive-copy \
    --minzoom=0 --maxzoom=14 \
    --bounds="5.9559,45.818,10.4921,47.8084" \
    planet.mbtiles my-extract-for-switzerland.mbtiles

Tham khảo

Preparation8

  1. Download the planet file
  2. Install tilelive and MBTiles support.
npm install -g @mapbox/tilelive @mapbox/mbtiles

Choose your Bounding Box8

  1. Visit boundingbox.klokantech.com and drag a rectangle around your desired area.
  2. Copy the bounding box in CSV format

Choose Bounding Box

Create Extract8

To create an extract, use the tilelive-copy utility. It takes a bounding box and a MBTiles file as input and creates an extract clipped to the bounding box.

Replace the bounding box in the following command with your bounding box.

tilelive-copy\
    --minzoom=0 --maxzoom=14\
    --bounds="5.9559,45.818,10.4921,47.8084"\
    planet.mbtiles my-extract-for-switzerland.mbtiles

It was ultimately a version problem. With NodeJS V 9.11.1 64 bit everything was possible without problems.

So:

  • Install NodeJS V 9.11.1 64 Bit
  • install npm
  • npm install -g @mapbox/tilelive @mapbox/mbtiles

and its works:

tilelive-copy --bounds="5.9559,45.818,10.4921,47.8084" 18.mbtiles switzerland_18.mbtiles

Nguồn

  1. https://openmaptiles.org/docs/generate/create-custom-extract/
  2. https://gis.stackexchange.com/questions/378014/clip-mbtiles-with-boundingbox
  3. https://github.com/mapbox/tilelive

Leave a Reply

Your email address will not be published. Required fields are marked *