protomaps / go-pmtiles

Single-file executable tool for working with PMTiles archives
BSD 3-Clause "New" or "Revised" License
350 stars 48 forks source link

convert Error parsing mbtiles #128

Closed inspirity closed 6 months ago

inspirity commented 7 months ago

I tried to convert some mbtiles into pmtiles and had this issue.

Failed to convert MBTiles to header JSON, strconv.ParseFloat: parsing " -24.42318646": invalid syntax

It appears that the issue is caused by the leading space in the Float.

bdon commented 7 months ago

MBTiles specifies the formatting of the bounds string: https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md#content

Can you fix your program generating MBTiles?

inspirity commented 6 months ago

Thank you for your quick response.

I found the issue in the metadata.center value of the dB. The coordinates had a space after the comma. Once I removed the space the conversion worked perfectly.

With this workaround I can use third party mbtiles, thank you!

bdon commented 6 months ago

Please adjust the software that generates the MBTiles to have values that conform to the spec, without spaces.

Otherwise we need to handle an arbitrary amount of variations, like multiple spaces, newlines, etc in string values.

inspirity commented 6 months ago

You are absolutely right. But I'm not the producer of the charts. Those are openCPN charts for sailors.

https://chartlocker.brucebalan.com/

I have no clue which Tool they use to produce the mbtiles. I will contact them and trying to figure out. I