osmdata | R package for downloading OpenStreetMap data | Map library
kandi X-RAY | osmdata Summary
kandi X-RAY | osmdata Summary
osmdata is an R package for accessing the data underlying OpenStreetMap (OSM), delivered via the Overpass API. (Other packages such as OpenStreetMap can be used to download raster tiles based on OSM data.) Overpass is a read-only API that extracts custom selected parts of OSM data. Data can be returned in a variety of formats, including as Simple Features (sf), Spatial (sp), or Silicate (sc) objects. The package is designed to allow access to small-to-medium-sized OSM datasets (see osmextract for an approach for reading-in bulk OSM data extracts).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of osmdata
osmdata Key Features
osmdata Examples and Code Snippets
Community Discussions
Trending Discussions on osmdata
QUESTION
I would like to use osmdata and get the other_tags as explicit columns.
Example code:
...ANSWER
Answered 2021-Jun-04 at 22:17We can use tidyverse methods to split and reshape the 'other_tags' column into two columns - select
the column of interest, with separate_rows
expand the data by splitting at the ,
, use separate
to create two columns 'key', 'value' from the 'other_tags', by splitting at the =>
and finally remove the double quotes with str_remove_all
in those columns
QUESTION
I am trying to plot a heatmap ontop of a geographical map to show the geographic distribution of a variable. The minimum working code, with absurd data, is the following:
...ANSWER
Answered 2021-May-06 at 20:53If I understood correctly the issue, it seems like the NA
in the raster are not completely transparent. See if in scale_fill_viridis_c
changing to na.value = NA
does what you're looking for.
QUESTION
How to define the bbox to download OSM data based on the extent of a spatial file? The following example returns an error message:
...the only allowed values are floats between -90.0 and 90.0
This shows that the bbox-values are out of allowed range. It also shows that the convertion between NAD27 and EPSG:3857 did not return the spatial data at place where it should be. With other spatial data I had similar problems. Eventhough within allowed range, the data didn't appear at the expected place. Downloaded OSM data appeared at a different place as the input spatial file.
...ANSWER
Answered 2021-Apr-21 at 07:38OSM works in lat-lon, which means EPSG:4326. You need to transform the coordinates accordingly. You also don't need raster::extent()
; sf::st_bbox()
will be sufficient in this use case.
Or in your context consider this code; as this is only a toy example I am not using the whole NC state, but a single county (otherwise errors on timeout may occur, which would be a separate kind of a problem - this question is about bounding boxes).
QUESTION
I've been using react-leaflet v3 in order to map the hospitals in a given radius. I have a component that retrieve that information from an endpoint, that's the Hospitals component in the following code:
...ANSWER
Answered 2021-Apr-04 at 16:11One option to consider is to bind a popup to marker click via Marker.bindPopup
method. In terms of react-leaflet
library, GeoJSON
component exposes onEachFeature
event which gets called on each feature and where popup could be initialized.
Here is a modified Hospitals
component which demonstrates how to bind a popup to marker click:
QUESTION
Im trying to reduce the amount of data and time a query to overpass server takes. Im only interested in ways and by using osmdata Package this is my current approach:
...ANSWER
Answered 2021-Mar-31 at 09:00As I wrote in the comment, I would suggest the following approach if you need to run several queries for OSM data that belong to the same geographical area.
First of all, load packages
QUESTION
Im calculating the shortest path between 2 points in sfnetwork my_sfn.
The calculated path consists of graph ids kept in variable paths and I and would like to get geometry (gps values) connected to those ids.
which is done with:
...ANSWER
Answered 2021-Mar-26 at 21:21I solved it by using the index in the last column in data.frame as index for the paths vector
QUESTION
Is it possible to reduce the run time of the following code?
My goal is to get an weighted igraph object from open street data area specified by a box boundary.
Currently im trying to use the overpass api so to offload the memory load so I dont have to keep big osm files in memory.
First I get a osm data specified by a bbox (only streets) as an xml structure
...ANSWER
Answered 2021-Mar-26 at 01:47It seems like getting the xml data into another format is taking a long time. Instead of using xml, asking overpass to return an sf
object and using that might be quicker. The sf
object can then be manipulated & used by the sfnetworks
package to get a network, while retaining the spatial aspects of the network. Weights can be added by functions from sfnetworks
(or tidygraph
) packages.
I think the code below focuses on taking care of the speed and the edge weight problems. Other problems, like finding the nearest nodes or edges, can be solved using the functions of the sf
package, but are not addressed. Otherwise this becomes more than a one-off SO question.
The speed might be able to be increased, at the cost of spatial accuracy, by using st_simplify
for the edges. One problem with this approach is that stnetworks places a node where each linestring meets another. The data returned often has a single roadway split into multiple linestrings. As an example, see two longer roads in yellow on the edges plot below. Probably a solvable problem, but may not be worthwhile in this case.
QUESTION
Completely new to R, forgive me -
I'm trying to use R to create some historic OSM data thats stored as a sf
(simple feature) within the R script. I'd like to export this data once called as a shapefile (or GEOJSON) readable by QGIS. The reason I am doing this is that it seems to me that extracting specific historic datasets via Rs osmdata
package is the most efficient way of creating data of specific segments of OSM historic data for a given period in its editing history (Let me know if anyone have a faster way of doing this for country-sized batches of data for different years.)
My current code, using a sample dataset, looks like this:
...ANSWER
Answered 2021-Jan-22 at 21:20I can not help you with the timeout on a historic datetime
; there may be a server side issue for all that I know (I get the same error, and your construction of the argument seems to follow documentation).
Regarding the other issues:
When working in the world of {sf}
I suggest to download your data via osmdata_sf()
call; it will be good for your sanity if you avoid mixing sf
and sp
worlds unless absolutely necessary.
The returned object will contain not only lines, but also points, polygons and (in your case empty) multi-type objects.
When working with cycle paths just select the osm_lines
object to a new variable; it will contain Sevilla bike paths with geometry of type linestring.
After checking it visually you can now save it as a ESRI Shapefile; note that this is an ancient file format, based on Ashton Tate dBase IV (a DOS program for Pete's sake :) and as such allows data column names of only limited number of characters, hence the warning.
QUESTION
I'm trying to just get non-na values returned from osmdata. For example, take email address. However, the below returns mostly missing emails. How can I set up the query so that it returns only non-missing values... value = "!null"
didn't work either.
ANSWER
Answered 2020-Sep-15 at 19:23The osmdata
package follows the same hierarchical structure as the Open Street Map data themselves. If you look into your data a bit further you'll see the following:
QUESTION
I am using the osmdata
package to bring the universities of Bogota, some of these are mapped as multipolygons
. However the plot comes out empty. Any idea how to fix it?
ANSWER
Answered 2020-Sep-11 at 17:08The solution is to make a transformation to the object's coordinate system. As it's shown in the following:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install osmdata
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page