geodesk-py icon indicating copy to clipboard operation
geodesk-py copied to clipboard

Query features by ID

Open clarisma opened this issue 1 year ago • 1 comments

Allow access to features by ID:

n = features.node(123)
w = features.way(123)
r = features.relation(123)

Challenges:

  • GOLs currently do not have an ID index, so queries would be relatively slow
  • However, performance could be increased significantly using "spatial hinting" (user supplies a coordinate or bbox that overlaps with the desired feature)

clarisma avatar Dec 06 '23 16:12 clarisma

In case anyone else stumbles across this feature request in search for a solution, one possible workaround is: next(f for f in my_features.ways if f.id == 123)

It doesn't use an index so it may be slow but it will return the way 123 in one line, if it exists.

osmuser63783 avatar Aug 05 '24 23:08 osmuser63783