Permalink
Browse files

Blog post

  • Loading branch information...
1 parent d40e206 commit 4793279b668676ef49ab753d838ca83f007c9651 @sipemu committed Apr 23, 2012
Showing with 10 additions and 4 deletions.
  1. +1 −1 _config.yml
  2. +9 −3 _posts/2012-04-16-mapping-with-osmar-and-the-overpass-api.md
View
@@ -105,7 +105,7 @@ JB :
# Set 'provider' to false to turn sharing off globally.
#
sharing :
- provider : false
+ provider : tweet
# Settings for all other include helpers can be defined by creating
# a hash with key named for the given helper. ex:
@@ -5,21 +5,27 @@ description: ""
category:
tags: [R, osmar, openstreetmap]
---
-In the R-package [osmar](http://osmar.r-forge.r-project.org/) one can just use the standard api. By the following workaround one gets an osmar object from the overpass api:
+In the R-package [osmar](http://osmar.r-forge.r-project.org/) one can just use the standard api, which may be a disadvantage, if you want filter the data before downloading it. By the following workaround one gets an osmar object from the overpass api:
{% highlight r %}
url <- "http://www.overpass-api.de/api/xapi?way[bbox=9.10,48.70,9.12,48.80][@meta]"
response <- getURL(url, .encoding = "UTF-8")
resp <- xmlParse(response)
stgt_box <- as_osmar(resp)
{% endhighlight %}
+
+For filtering e.g. all streets in an area, you just have to modify the url as
+{% highlight r %}
+url <- "http://www.overpass-api.de/api/xapi?way[bbox=9.10,48.70,9.12,48.80][highway=*][@meta]"
+{% endhighlight %}
+
Advantage of the overpass api:
* You can filter with the api, e.g. you can get just the buildings of the bbox.
* You save time, especially in the XML parsing step
-* You can querie on larger areas as by the standard api (bounded by 0.25 degree)
+* You can querie on larger areas as by the standard api that is bounded by boxes with max size of 0.25 degree
Help for this api can be found on [openstreetmap](http://wiki.openstreetmap.org/wiki/Databases_and_data_access_APIs) and for the filter e.g. on the [wiki](http://wiki.openstreetmap.org/wiki/Nominatim/Special_Phrases/DE) of OSM.
-By this you can do e.g. plots like
+By this you can do e.g. plots like this one:
<img alt="" src="../../media/images/2012/04/stuttgart_strassennetz.jpg" width="500" height="354" />
{% include JB/setup %}

0 comments on commit 4793279

Please sign in to comment.