PMTiles icon indicating copy to clipboard operation
PMTiles copied to clipboard

format may be missing in mbtiles_metadata

Open prusswan opened this issue 2 years ago • 5 comments

I had to modify the lines below to get the converter to work:

https://github.com/protomaps/PMTiles/blob/e1228f5df1a4ac852e0117dc08c8813089a5c8af/python/pmtiles/convert.py#L29

https://github.com/protomaps/PMTiles/blob/e1228f5df1a4ac852e0117dc08c8813089a5c8af/python/pmtiles/convert.py#L71

Suggestion: to allow a default format to be specified by the user, e.g.

def mbtiles_to_header_json(mbtiles_metadata, default_format=None):
    # ....
    tile_format = mbtiles_metadata.get("format", default_format)

Other changes may be needed for the command line option (I did not use that)

prusswan avatar Nov 29 '23 20:11 prusswan

format is a required key of the MBTiles specification so your program that creates MBTiles needs to create compliant metadata.

bdon avatar Dec 01 '23 08:12 bdon

I see your point. Unfortunately the tiles were not generated by me. I did a check and it seems that format was only introduced in 1.1: https://docs.safe.com/fme/html/FME-Form-Documentation/FME-ReadersWriters/mbtiles/mbtiles.htm

Would you be open to a pull request to support 1.0?

prusswan avatar Dec 01 '23 11:12 prusswan

Sure, since there is existing software generating old specs. Any reason you don't prefer to use https://github.com/protomaps/go-pmtiles for command line conversion?

bdon avatar Dec 02 '23 03:12 bdon

I might have tried that but if it leads to the same problem, I wouldn't be able to monkeypatch it like the way it can be done with Python.

On Sat, Dec 2, 2023, 11:41 AM Brandon Liu @.***> wrote:

Sure, since there is existing software generating old specs. Any reason you don't prefer to use https://github.com/protomaps/go-pmtiles for command line conversion?

— Reply to this email directly, view it on GitHub https://github.com/protomaps/PMTiles/issues/306#issuecomment-1837026009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFEBYUODVPVI5LVUOMN27TYHKPP5AVCNFSM6AAAAABAACKXQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGAZDMMBQHE . You are receiving this because you authored the thread.Message ID: @.***>

prusswan avatar Dec 02 '23 07:12 prusswan

FME supports reading and writing both version 1.0 and 1.1 .mbtiles files. When writing version 1.0 MBTiles data, the bounds and format metadata items will still be written to the metadata table. It looks like it does write 1.1 however? Are you using an older version of FME?

bdon avatar Dec 04 '23 09:12 bdon

I'm going to close this, because most up-to-date software creates MBTiles 1.1.

If you have a 1.0 .mbtiles, you can add the required column via the sqlite3 cli: insert into metadata (name, value) values ("format","pbf") etc.

If anyone can find an open source program that is still creating v1.0 we can work to update that software.

bdon avatar Sep 04 '24 05:09 bdon