versatiles-org / versatiles-rs

VersaTiles - A toolbox for converting, checking and serving map tiles in various formats.
https://versatiles.org
MIT License
57 stars 2 forks source link

Issue with Geofabrik tiles #17

Closed ThomasG77 closed 1 year ago

ThomasG77 commented 1 year ago

I've tried using versatiles 0.2.14 latest version with tiles provided at https://blog.geofabrik.de/?p=589 and got some issues.

They are mentioned at https://gist.github.com/ThomasG77/7d99b7d79138bda9a2dfb092728da54c I can open dedicated issues more focused if you confirm you have the same issues as in the gist recipe.

MichaelKreil commented 1 year ago

I am currently reviewing and testing the code of version 0.2.14 and have already found a lot of bugs. I might have a release candidate in the next few days. But it is a good idea to use the mbtiles from the GeoFactory for testing! When I think that versatiles is stable enough and can handle other mbtiles without problems, I'll come back to your issue.

MichaelKreil commented 1 year ago

I believe I have fixed the issue. There were two problems that I identified:

  1. The tar file from Geofabrik contains tiles with the file extension ".pbf," but they are actually gzipped and should have the extension ".pbf.gz." To address this, I have introduced a new argument called "--override-input-compression" which allows you to manually override the compression type and set it to "gzip."

  2. The files within the tar archive are organized as z/y/x, whereas they should be organized as z/x/y. To resolve this, I have added another new argument called "--swap-xy."

Version 0.5.0 implements these two arguments.

To test the solution directly with the tar file:

versatiles serve -s ./frontend.br.tar -p 8080 test.tar --override-input-compression gzip --swap-xy

Or you can convert the tar file to the faster versatiles format:

versatiles convert test.tar test.versatiles --override-input-compression gzip --swap-xy
versatiles serve -s ./frontend.br.tar -p 8080 test.versatiles