protomaps / go-pmtiles

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

Failed strconv.ParseFloat: parsing " 34.30084411" #81

Closed freeExec closed 11 months ago

freeExec commented 1 year ago

When trying to convert mbtiles an error occurs:

main.go:159: Failed to convert xxx.mbtiles, Failed to convert MBTiles to header JSON, strconv.ParseFloat: parsing " 34.30084411": invalid syntax

The thing is that in the metadata the value for center was 28.33709717, 34.30084411, 18, i.e. contained spaces between values.

bdon commented 1 year ago

The MBTiles specification describes center as:

center (string of comma-separated numbers): The longitude, latitude, and zoom level of the default view of the map. Example: -122.1906,37.7599,11

Can you correct your MBTiles directly, or the process that creates that tileset metadata?

freeExec commented 1 year ago

Yes, I had to resort to sqlite to change the values. But I would like to simplify my life.

bdon commented 1 year ago

I am suggesting that pmtiles convert is working as intended - I'd prefer to reject data that does not conform to the MBTiles specification, otherwise we need to make all the parsing lenient against extra spaces, tabs, etc everywhere.

bdon commented 11 months ago

Please re-open if the suggested fix doesn't work for you, thanks!