Comments (3)
Yeah, it should be entirely possible in current state, and it'd be great to have an example in the vignette. Relations are stored either in osm_multipolygons
or osm_multilinestrings
, depending on their nature, but all relational data should be accessible from there. It'd be great if you could flesh out a nice example in the vignette, and report here on how it goes.
from osmdata.
You can't specifically search for relations, but nor can you specifically search for ways. Relations will simply be returned either as osm_multilinestrings
or osm_multipolygons
objects, and ways will be returned either as osm_lines
or osm_polygons
. Specifically getting relations just requires knowing, for example, what they're called. Here's your canonical example:
> q <- opq ('greater london uk')
> q1 <- add_feature (q, key="name", value="London.Cycle.Network.Route.9", exact=FALSE)
> osmdata_sf (q1)
Object of class 'osmdata' with:
$bbox : 51.2867602,-0.510375,51.6918741,0.3340155
$overpass_call : The call submitted to the overpass API
$timestamp : [ Mon Feb 27 16:55:41 2017 ]
$osm_points : 'sf' Simple Features Collection with 1006 points
$osm_lines : 'sf' Simple Features Collection with 246 linestrings
$osm_polygons : 'sf' Simple Features Collection with 0 polygons
$osm_multilines : 'sf' Simple Features Collection with 3 multilinestrings
$osm_multipolygons : 'sf' Simple Features Collection with 0 multipolygons
The osm_lines
contain all of the individual components which make up the route, while the osm_multilines
are the actual relations. There are three of them because
> d <- osmdata_sf (q1)
> d1$osm_multilines$name
1429834-(no role) 1429834-backward
London Cycle Network Route 9 London Cycle Network Route 9
1429834-forward
London Cycle Network Route 9
Levels: London Cycle Network Route 9
... and that serves to support Edzer's thoughts on factors - without the factors that key information would be much harder to extract.
Now note this:
> q1 <- add_feature (q, key="name", value="London.Cycle.Network.route.9", exact=FALSE)
> osmdata_sf (q1)
... returns no data, because queries are still case sensitive even with exact=FALSE
. The only way (at present) to make a truly case-insensitive query would be the standard overpass way:
> q1 <- add_feature (q, key="name", value="[Ll]ondon.[Cc]ycle.[Nn]etwork.[Rr]oute.9",
exact=FALSE)
It'd be pretty easy to modify add_feature
, so exact=FALSE
also automatically added the relevant case options immediately following all spaces or periods, but note that that would remove any ability not to specify that, which is a bit of a negative side effect. What do you think?
from osmdata.
Will add that to the vignette - great work, can't wait to test this.
from osmdata.
Related Issues (20)
- [BUG] failing `osmdata_data_frame tests HOT 1
- Deprecate ``nodes_only` in `opq` function HOT 1
- Release osmdata 0.2 HOT 12
- [FEATURE] Parse latitude and longitude in results from `out * center;` queries
- command "osmdata::available_tags(feature = 'addr:postcode')" gives not the expected output HOT 3
- Release osmdata 0.2.2 HOT 7
- RStudio is unable to find proj.db file when using trim_osmdata() HOT 2
- [FEATURE] <feature request> HOT 3
- [BUG] getbb returns HTTP Error 405 from Nominatim HOT 1
- kicked off CRAN HOT 1
- Fix pkg man entry
- [BUG] getbb returns HTTP Error 502 from Nominatim HOT 5
- [available_tags] <some available values missing for a tag> HOT 3
- How to join sc object together ? HOT 2
- populate osm_id with an actual unique reference HOT 5
- Error in overpass_query HOT 15
- Error in rcpp_osmdata_sf HOT 2
- [FEATURE] Implement missing search criteria
- [FEATURE] getbb with 'sf_polygon' format HOT 1
- upcoming PROJ/reproj breaks tests HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osmdata.