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

New geometries module - Work In Progress #542

Merged
merged 90 commits into from
Aug 24, 2020

Conversation

AtelierLibre
Copy link
Contributor

@AtelierLibre AtelierLibre commented Jul 29, 2020

Resolves #478

Work in progress on a new geometries module that combines the capabilities of the existing pois and footprints modules and introduces conversion of ways to LineStrings or Polygons as appropriate.

Example:

# New geometries module
MK = ox.gdf_from_point((52.0430,-0.7590), dist=1000, tags={'highway':True, 'landuse':True, 'building':True})

# Presentation code
MK.to_crs(epsg=27700, inplace=True)

fig,ax = plt.subplots(figsize=(16,16))
MK[MK['landuse'].notna()].plot(ax=ax, column='landuse', cmap='tab20b', legend=True)
MK[MK['highway'].notna()].plot(ax=ax, color='white')
MK[MK['building'].notna()].plot(ax=ax, color='dimgrey', zorder=3)
ax.set_facecolor('darkgrey')
ax.axes.xaxis.set_visible(False)
ax.axes.yaxis.set_visible(False)

MK

AtelierLibre and others added 30 commits June 24, 2020 21:59
merge latest version of gboeing osmnx master
Merge single dictionary into geometry
@AtelierLibre
Copy link
Contributor Author

@gboeing I think this is getting to the stage where it could do with some thorough testing. I've been doing some myself (and will keep doing more) but it's a bit random and limited in scope so help with that would be much appreciated.

I have generally tried to stay away from the graph module but to get gdf_from_xml() to work I had to make some changes to the _OSMContentHandler. I don't think they should affect graph_from_xml() but might be worth keeping an eye on that. On a related note, I think moving _overpass_json_from_file() and _OSMContentHandler from graph to downloader would help to make clear that they are shared with geometries.

Let me know what you think/what's the best way forward.

@gboeing
Copy link
Owner

gboeing commented Aug 14, 2020

Fantastic. Thank you. I'm grateful for all the hard work you've put in. Perhaps we should merge this PR into a feature branch here, when you're comfortable with it as a "first draft"? And then start some coordinated testing?

On a related note, I think moving _overpass_json_from_file() and _OSMContentHandler from graph to downloader would help to make clear that they are shared with geometries.

I think that's fine.

I think this is getting to the stage where it could do with some thorough testing.

Certainly. Let's do something like this. I'll work up a big processing batch to start downloading geometries all over the world, passing in various tag combos. My goal will be to look for exceptions: do we find anything that breaks the code. I'll aim for several thousand requests sampled across urban areas worldwide.

In the meantime, it may be most efficient if your testing focuses on validation... inspecting if individual queries conform to expectations, given the data on OSM. @xgerrmann would you have any appetite for validation-style testing too?

@AtelierLibre
Copy link
Contributor Author

No problem, it's nice to have the opportunity to contribute, and it will be good to check that it all works as expected.

Perhaps we should merge this PR into a feature branch here, when you're comfortable with it as a "first draft"? And then start some coordinated testing?

That sounds good. I think that makes a lot of sense. I'll keep going with some smaller scale tests for a couple more days and then assuming the outputs are as expected it will be great to scale it up and check the robustness.

@AtelierLibre
Copy link
Contributor Author

I have been working on a few tests which are in notebooks here:

https://github.com/AtelierLibre/osmnx_tests/tree/master/notebooks

The notebooks are a bit rough but the results are standing up so far. I'll do a few more and then we can broaden it out.

@AtelierLibre
Copy link
Contributor Author

@gboeing I've run through quite a few tests and documented them in the notebooks linked to above. It's seeming pretty robust.

The comparisons with overpass-turbo.eu were particularly helpful as they give something external to benchmark against in terms of numbers. I haven't got to the bottom of the discrepancy with the boundary polygon from the nominatim api compared to the boundary polygon through the overpass api on the final example in that notebook.

The XMLs have thrown up a few errors mainly because it doesn't seem guaranteed that they are complete (unlike the responses from the overpass api as far as I have found). I've added in a few try: except: to catch those that have come up so far.

Let me know if there is anything else you think is worth checking, otherwise I think it probably makes sense to start some wider scale testing now.

@gboeing gboeing changed the base branch from master to geometries August 24, 2020 18:16
@gboeing
Copy link
Owner

gboeing commented Aug 24, 2020

Ok. I'm going to merge this into a geometries feature branch. Testing and additional development can continue there.

@gboeing gboeing merged commit 153a6ef into gboeing:geometries Aug 24, 2020
@gboeing gboeing mentioned this pull request Aug 24, 2020
@gboeing
Copy link
Owner

gboeing commented Aug 24, 2020

See #549

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

Successfully merging this pull request may close these issues.

Are the pois module and footprints module redundant?
4 participants