clarisma / geodesk-py

Fast and storage-efficient spatial database engine for OpenStreetMap data
https://docs.geodesk.com/python
GNU Lesser General Public License v3.0
36 stars 0 forks source link

`Features.within()` segfaults for empty/invalid areas #28

Closed osmuser63783 closed 8 months ago

osmuser63783 commented 8 months ago
from geodesk import *
planet = Features("/mnt/raid1/geodesk/planet-new.gol")
islands = planet("a[place=island,islet]")
for outer_island in islands:
    inner_islands = islands.within(outer_island)
Segmentation fault (core dumped)

This appears to be related to passing a multipolygon to "within": it does not happen when I limit the outer islands to be ways only (islands = planet("a[place=island,islet]").ways).

I am running geodesk 0.1.0. My "planet" was created using gol-tool 0.1.9.

clarisma commented 8 months ago

I haven't been able to reproduce this (with a recent planet and one from a year ago). Could you please add this print statement and tell me at which feature the crash occurs?

for outer_island in islands:
   print(f"Checking island: {outer_island}")
   inner_islands = islands.within(outer_island)

Thanks!

osmuser63783 commented 8 months ago

It happens with https://openstreetmap.org/relation/15441662 and also with https://openstreetmap.org/relation/15763992.

These are multipolygon relations that have relations as members, which they shouldn't... what fun!

By the way, I tried #18 again and it's not working, even though I'm sure I built a new GOL file. I'm going to build a new one and report back, just to be sure.

The PBF file I used was https://planet.openstreetmap.org/pbf/planet-231120.osm.pbf

clarisma commented 8 months ago

Thanks, very helpful, this narrows down the issue. The crash occurs during filter construction whenever an area is empty/invalid.

osmuser63783 commented 8 months ago

Can confirm this is still an issue with 0.1.2 and a new GOL, whereas #18 is fixed.