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

Add support for new classes in oe_get #97

Closed
3 of 4 tasks
agila5 opened this issue Jul 29, 2020 · 11 comments
Closed
3 of 4 tasks

Add support for new classes in oe_get #97

agila5 opened this issue Jul 29, 2020 · 11 comments
Assignees

Comments

@agila5
Copy link
Contributor

agila5 commented Jul 29, 2020

After #35

  • sf
  • sfc_POLYGON
  • sfc_LINESTRING
  • sp objects
@agila5 agila5 self-assigned this Jul 29, 2020
@agila5
Copy link
Contributor Author

agila5 commented Sep 30, 2020

See also #129 (comment) for spatial matching using something different from a sfc_POINT

@agila5
Copy link
Contributor Author

agila5 commented Oct 7, 2020

I plan to work on sfc_POLYGON and sfc_LINESTRING extensions during the weekend (for a new project). The main question here is: how to determine the matched geographical area when we are comparing a POLYGON with a LINESTRING or a POLYGON with a POLYGON? The problem is that a POLYGON or a LINESTRING could intersect two or more geographical areas determined by a provider.

The simplest solution should be "greatest overlapping area + a warning message", any other suggestion?

@Robinlovelace
Copy link
Member

Good thinking @agila5. I'm confident that this code will handle all sf/sfc classes, finding all zones that completely contain the geographic object, regardless of whether that's a line, polygon or point cloud:

https://github.com/ITSLeeds/osmextract/blob/3b927dd66f006c00d63e12424614696af1fede63/R/gf_find.R#L35-L50

The code should automatically select the smallest area that matches to avoid it downloading the world after every geographic query!

@agila5
Copy link
Contributor Author

agila5 commented Oct 7, 2020

Thanks, I will start from that code!

@Robinlovelace
Copy link
Member

I'm happy to give this a go...

@Robinlovelace
Copy link
Member

For now the following works : )

osm_luton = osmextract::oe_get(sf::st_centroid(region_luton))

@Robinlovelace
Copy link
Member

Would be great for this to work for polygons also, just tried this:

buildings = osmextract::oe_get(study_area, layer = "multipolygons")
Error: At the moment there is no support for matching objects of class sf. Feel free to open a new issue at github.com/itsleeds/osmextract

@agila5
Copy link
Contributor Author

agila5 commented Jan 14, 2021

Would be great for this to work for polygons also, just tried this:

The easy solution would be to take the centroid and then fall back to the sfc_POINT method, is that reasonable?

@Robinlovelace
Copy link
Member

Robinlovelace commented Jan 14, 2021

The easy solution would be to take the centroid and then fall back to the sfc_POINT method, is that reasonable?

I think even simpler than that would be an st_contains() that would work with any geometry type and also ensure that larger regions are selected, e.g. for roads that cross 2 regions. Are you up for giving it a go? Happy to take a look next week.

agila5 pushed a commit that referenced this issue Jan 17, 2021
Robinlovelace added a commit that referenced this issue Jan 17, 2021
@Robinlovelace
Copy link
Member

Done I think! Don't need to support the legacy sp class system IMO.

@agila5
Copy link
Contributor Author

agila5 commented Jan 18, 2021

Ok! Then, I will close :)

@agila5 agila5 closed this as completed Jan 18, 2021
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

No branches or pull requests

2 participants