mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 02:41:09 +00:00
Fixes units in Python writer default bounds (#311)
When there are no user-provided bounds provided in the writer (as in: min/max_lat/lng_e7 properties) the writer mistakenly defaults to -180,-90,180,90 for these properties.e1228f5df1/python/pmtiles/tile.py (L277-L283)But these properties need to be multiplied by 10000000 as seen e.g. in this examples and as indicated by the "_e7"e1228f5df1/python/examples/create_raster_example.py (L29-L32)Without this fix we were seeing pmtiles with bounds around null island, because the order of magnitude was wrong.
This commit is contained in:
@@ -274,13 +274,13 @@ def serialize_header(h):
|
||||
write_uint8(h["tile_type"].value)
|
||||
write_uint8(h["min_zoom"])
|
||||
write_uint8(h["max_zoom"])
|
||||
min_lon_e7 = h.get("min_lon_e7",-180)
|
||||
min_lon_e7 = h.get("min_lon_e7", int(-180 * 10000000))
|
||||
write_int32(min_lon_e7)
|
||||
min_lat_e7 = h.get("min_lat_e7",-90)
|
||||
min_lat_e7 = h.get("min_lat_e7", int(-90 * 10000000))
|
||||
write_int32(min_lat_e7)
|
||||
max_lon_e7 = h.get("max_lon_e7",180)
|
||||
max_lon_e7 = h.get("max_lon_e7", int(180 * 10000000))
|
||||
write_int32(max_lon_e7)
|
||||
max_lat_e7 = h.get("max_lat_e7",90)
|
||||
max_lat_e7 = h.get("max_lat_e7", int(90 * 10000000))
|
||||
write_int32(max_lat_e7)
|
||||
write_uint8(h.get("center_zoom",h["min_zoom"]))
|
||||
write_int32(h.get("center_lon_e7", round((min_lon_e7 + max_lon_e7) / 2)))
|
||||
|
||||
Reference in New Issue
Block a user