0

I know this might be a duplicate question but I wasn't able to find any solution. I'm working on a tool with the help of this package which is actually a platform to convert a geojson file to mbtiles with the help of tippecanoe. The problem is actually not about conversion because it works successfully but the problem is with zoom levels in the Mapbox studio.

I need 22 zoom level which is stated with -z22 parameter. But even though I did state, it automatically defines 15 zoom level. Mbtiles looks like this after the operation below:

enter image description here

I'm developing this with JavaScript and my converter currently works with these parameters:

tippecanoe(
        [inputGeojsonPath],
        {
          "maximum-zoom": 22,
          "full-detail": 10,
          "low-detail": 10,
          simplification: 10,
          layer: "buildings",
          output: outputMbtilesPath,
          description: "Building footprints in the municipality of Hobbiton.",
          force: true,
          "drop-densest-as-needed": true,
          "extend-zooms-if-still-dropping": true,
          pk: true,
          pf: true,
        },
        { echo: true }
      );

Also, command version of it goes like this:

tippecanoe --maximum-zoom=22 --full-detail=10 --low-detail=11 --simplification=10 --layer=buildings --output=/tmp/sample.mbtiles --description='Building footprints in the municipality of Hobbiton.' --force --drop-densest-as-needed --extend-zooms-if-still-dropping -pk -pf /tmp/sample.geojson

Are there any workarounds or suggestions that you can give? Is there anybody that had the same issue and solved it? I really need exact zoom extent level 22.

1 Answer 1

1

After trying to solve the issue programmatically, I found another successful workaround to get the required zoom level. Instead of npm packages, you can use the docker image for tippecanoe. Then with a simple dockerfile, you can get the output file from docker volumes.

Dockerfile

# Use the base image
FROM ingmapping/tippecanoe

# Create a directory for input and output data
# RUN mkdir /data_tiles

# Set the working directory
WORKDIR /data_tiles

# Copy the input.geojson from the host to the container
COPY input.geojson /data_tiles/input.geojson

# Run tippecanoe to generate the mbtiles in a tmp folder
RUN tippecanoe -o /tmp/input.mbtiles -z22 /data_tiles/input.geojson

# Copy the generated mbtiles from tmp to the output folder
RUN mv /tmp/input.mbtiles /data_tiles/input.mbtiles

# Define the output folder outside of the container
VOLUME ["/output"]

# Define the entry point script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

#!/bin/bash

# Copy the mbtiles to the output folder
cp /data_tiles/input.mbtiles /output

And project folder structure looks like this:

enter image description here

After successfully executing your dockerfile, you can simply get your output file manually from docker volumes:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.