onthegomap/planetiler

[BUG] Empty output when pbf file does not contain bounds

Closed this issue · 3 comments

Describe the bug
When planetiler processes a .osm.pbf file where bounds is not set (for example ones from http://download.openstreetmap.fr/extracts/) the output mbtiles file is empty.

To Reproduce
Steps to reproduce the behavior:

./quickstart-from-source.sh bermuda --osm-url=http://download.openstreetmap.fr/extracts/north-america/bermuda-latest.osm.pbf

In the logs you can see:

0:00:06 INF - Setting map bounds from input: Env[0.0 : 0.0, 0.0 : 0.0]

Expected behavior
This should either:

  1. fail fast with an error explaining the issue (require you to specify --bounds=...)
  2. default to planet bounds (will use 10-20gb of disk for oceans)
  3. or read all nodes in the input file to determine bounds
❯ osmium fileinfo ./data/sources/bermuda.osm.pbf                                                                              
File:
  Name: ./data/sources/bermuda.osm.pbf
  Format: PBF
  Compression: none
  Size: 1918338
Header:
  Bounding boxes:
  With history: no
  Options:
    generator=pyosmium-up-to-date/3.1.3
    osmosis_replication_base_url=http://download.openstreetmap.fr/replication/./north-america/bermuda/minute
    osmosis_replication_sequence_number=5078653
    osmosis_replication_timestamp=2022-05-29T01:19:29Z
    pbf_dense_nodes=true
    timestamp=2022-05-29T01:19:29Z

@msbarry about 2. You mean temporary disk usage? not mbtiles usage. I understand that it will "load" the whole planet oceans right?

For #2 the output mbtiles file will contain 10-20gb of ocean polygons since there's no bounding box to limit processing from the water polygon shapefile.

I'm leaning toward #3 - log a warning if osm.pbf bounds are empty and --bounds param is not specified then parse all of the nodes in the pbf file to determine the bounds. That should only take a few seconds to a minute, even on the planet.

@msbarry ok so yes i agree 3 seems best!