Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using node cache to quickly find roads? #66

Open
retorquere opened this issue Jun 26, 2018 · 4 comments
Open

Using node cache to quickly find roads? #66

retorquere opened this issue Jun 26, 2018 · 4 comments

Comments

@retorquere
Copy link

I'm looking for an efficient (as possible) way to find ways that contain a given node. I started by just using a SimpleHandler to walk all of the pbf and make a cache that maps nodes to ways, but can https://github.com/osmcode/pyosmium/blob/master/examples/use_nodecache.py be used to make this more efficient?

@wiktorn
Copy link
Contributor

wiktorn commented Jun 26, 2018

NodeLocationsForWays is the reverse of what you need. Skimming through the libosmium code I found ObjectRelations which, as far as I understand, may create the node to way index.

Though I don't see this exposed in pyosmium.

@retorquere
Copy link
Author

OK, cool, then I'll just walk all the ways.

Should I walk the relations too to find the names, or do ways always have a name?

@wiktorn
Copy link
Contributor

wiktorn commented Jun 26, 2018

Depends on what names you plan to find. If you're looking for street names then usually they are on way level.

@lonvia
Copy link
Member

lonvia commented Jun 27, 2018

This needs indeed the osmium::index::MultiMap because a node may be in multiple ways. That class is not yet exposed to pyosmium. It would be interesting to have though together with the ObjectRelations handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants