Code Monkey home page Code Monkey logo

osmdata's Introduction

osmdata

R build status codecov Project Status: Active CRAN_Status_Badge CRAN Downloads

status

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).

Installation

To install latest CRAN version:

install.packages ("osmdata")

Alternatively, install the development version with any one of the following options:

# install.packages("remotes")
remotes::install_git ("https://git.sr.ht/~mpadge/osmdata")
remotes::install_bitbucket ("mpadge/osmdata")
remotes::install_gitlab ("mpadge/osmdata")
remotes::install_github ("ropensci/osmdata")

To load the package and check the version:

library (osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
packageVersion ("osmdata")
#> [1] '0.2.2'

Usage

Overpass API queries can be built from a base query constructed with opq followed by add_osm_feature. The corresponding OSM objects are then downloaded and converted to Simple Feature (sf) objects with osmdata_sf(), Spatial (sp) objects with osmdata_sp() or Silicate (sc) objects with osmdata_sc(). For example,

x <- opq (bbox = c (-0.27, 51.47, -0.20, 51.50)) %>% # Chiswick Eyot in London, U.K.
    add_osm_feature (key = "name", value = "Thames", value_exact = FALSE) %>%
    osmdata_sf ()
x
#> Object of class 'osmdata' with:
#>                  $bbox : 51.47,-0.27,51.5,-0.2
#>         $overpass_call : The call submitted to the overpass API
#>                  $meta : metadata including timestamp and version numbers
#>            $osm_points : 'sf' Simple Features Collection with 24548 points
#>             $osm_lines : 'sf' Simple Features Collection with 2219 linestrings
#>          $osm_polygons : 'sf' Simple Features Collection with 33 polygons
#>        $osm_multilines : 'sf' Simple Features Collection with 6 multilinestrings
#>     $osm_multipolygons : 'sf' Simple Features Collection with 3 multipolygons

OSM data can also be downloaded in OSM XML format with osmdata_xml() and saved for use with other software.

osmdata_xml(q1, "data.osm")

Bounding Boxes

All osmdata queries begin with a bounding box defining the area of the query. The getbb() function can be used to extract bounding boxes for specified place names.

getbb ("astana kazakhstan")
#>        min      max
#> x 71.21797 71.78519
#> y 50.85761 51.35111

The next step is to convert that to an overpass query object with the opq() function:

q <- opq (getbb ("astana kazakhstan"))
q <- opq ("astana kazakhstan") # identical result

It is also possible to use bounding polygons rather than rectangular boxes:

b <- getbb ("bangalore", format_out = "polygon")
class (b)
#> [1] "matrix" "array"
head (b [[1]])
#> [1] 77.4601

Features

The next step is to define features of interest using the add_osm_feature() function. This function accepts key and value parameters specifying desired features in the OSM key-vale schema. Multiple add_osm_feature() calls may be combined as illustrated below, with the result being a logical AND operation, thus returning all amenities that are labelled both as restaurants and also as pubs:

q <- opq ("portsmouth usa") %>%
    add_osm_feature (key = "amenity", value = "restaurant") %>%
    add_osm_feature (key = "amenity", value = "pub") # There are none of these

Negation can also be specified by pre-pending an exclamation mark so that the following requests all amenities that are NOT labelled as restaurants and that are not labelled as pubs:

q <- opq ("portsmouth usa") %>%
    add_osm_feature (key = "amenity", value = "!restaurant") %>%
    add_osm_feature (key = "amenity", value = "!pub") # There are a lot of these

Additional arguments allow for more refined matching, such as the following request for all pubs with “irish” in the name:

q <- opq ("washington dc") %>%
    add_osm_feature (key = "amenity", value = "pub") %>%
    add_osm_feature (
        key = "name", value = "irish",
        value_exact = FALSE, match_case = FALSE
    )

Logical OR combinations can be constructed using the separate add_osm_features() function. The first of the above examples requests all features that are both restaurants AND pubs. The following query will request data on restaurants OR pubs:

q <- opq ("portsmouth usa") %>%
    add_osm_features (features = c (
        "\"amenity\"=\"restaurant\"",
        "\"amenity\"=\"pub\""
    ))

The vector of features contains key-value pairs separated by an overpass “filter” symbol such as =, !=, or ~. Each key and value must be enclosed in escape-delimited quotations as shown above.

Full lists of available features and corresponding tags are available in the functions ?available_features and ?available_tags.

Data Formats

An overpass query constructed with the opq() and add_osm_feature() functions is then sent to the overpass server to request data. These data may be returned in a variety of formats, currently including:

  1. XML data (downloaded locally) via osmdata_xml();
  2. Simple Features (sf) format via osmdata_sf();
  3. R Spatial (sp) format via osmdata_sp();
  4. Silicate (SC) format via osmdata_sc(); and
  5. data.frame format via osmdata_data_frame().

Additional Functionality

Data may also be trimmed to within a defined polygonal shape with the trim_osmdata() function. Full package functionality is described on the website

Citation

citation ("osmdata")
#> 
#> To cite osmdata in publications use:
#> 
#>   Mark Padgham, Bob Rudis, Robin Lovelace, Maëlle Salmon (2017).
#>   "osmdata." _Journal of Open Source Software_, *2*(14), 305.
#>   doi:10.21105/joss.00305 <https://doi.org/10.21105/joss.00305>,
#>   <https://joss.theoj.org/papers/10.21105/joss.00305>.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Article{,
#>     title = {osmdata},
#>     author = {{Mark Padgham} and {Bob Rudis} and {Robin Lovelace} and {Maëlle Salmon}},
#>     journal = {Journal of Open Source Software},
#>     year = {2017},
#>     volume = {2},
#>     number = {14},
#>     pages = {305},
#>     month = {jun},
#>     publisher = {The Open Journal},
#>     url = {https://joss.theoj.org/papers/10.21105/joss.00305},
#>     doi = {10.21105/joss.00305},
#>   }

Data licensing

All data that you access using osmdata is licensed under OpenStreetMap’s license, the Open Database Licence. Any derived data and products must also carry the same licence. You should make sure you understand that licence before publishing any derived datasets.

Other approaches

  • osmextract is an R package for downloading and importing compressed ‘extracts’ of OSM data covering large areas (e.g. all roads in a country). The package represents data in sf format only, and only allows a single “layer” (such as points, lines, or polygons) to be read at one time. It is nevertheless recommended over osmdata for large queries of single layers, or where relationships between layers are not important.

Code of Conduct

Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Contributors

All contributions to this project are gratefully acknowledged using the allcontributors package following the all-contributors specification. Contributions of any kind are welcome!

Code


mpadge

Robinlovelace

jmaspons

hrbrmstr

virgesmith

maelle

elipousson

espinielli

agila5

idshklein

anthonynorth

jeroen

neogeomat

ec-nebi

Tazinho

odeleongt

Mashin6

angela-li

rgzn

fzenoni

stragu

patperu

MHenderson

karthik

jlacko

JimShady

dpprdan

danstowell

ccamara

brry

Issue Authors


karpfen

sytpp

niklaas

RoyalTS

lrob

mem48

beingalink

yaakovfeldman

gregor-d

gregmacfarlane

legengliu

mtennekes

lbuk

prokulski

waholulu

ibarraespinosa

tbuckl

morellek

mdsumner

michielvandijk

loreabad6

slow-data

mroorda

MiKatt

alanlzl

PublicHealthDataGeek

mgageo

polettif

marcusyoung

barryrowlingson

ChrisWoodsSays

daluna1

khzannat26

gdkrmr

dipenpatel235

robitalec

nfruehADA

orlandombaa

changwoo-lee

maellecoursonnais

Suspicis

AlbertRapp

dmag-ir

FlxPo

vanhry

boiled-data

mlucassc

jedalong

mooibroekd

xiaofanliang

xtimbeau

joostschouppe

stalkerGH

RegularnaMatrica

Issue Contributors


sckott

nsfinkelstein

gawbul

edzer

MAnalytics

richardellison

cboettig

prise6

PaoloFrac

Dris101

TomBor

matkoniecz

urswilke

Robsteranium

assignUser

rsbivand

ropensci_footer

osmdata's People

Contributors

agila5 avatar angela-li avatar anthonynorth avatar brry avatar ccamara avatar danstowell avatar dpprdan avatar ec-nebi avatar elipousson avatar espinielli avatar fzenoni avatar hrbrmstr avatar idshklein avatar jeroen avatar jimshady avatar jlacko avatar jmaspons avatar karthik avatar maelle avatar mashin6 avatar mhenderson avatar mpadge avatar neogeomat avatar odeleongt avatar patperu avatar rgzn avatar robinlovelace avatar stragu avatar tazinho avatar virgesmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osmdata's Issues

opq cannot take QL queries

To my knowledge (very happy to be proven wrong).

QL could be an ideal language for representing complex queries in text I think: see QL Basics. Illustrative examples (I don't think we can currently do this - any thoughts):

  ["key"]            /* filter objects tagged with this key and any value */
  [!"key"]           /* filter objects not tagged with this key and any value */
  ["key"="value"]    /* filter objects tagged with this key and this value */
  ["key"!="value"]   /* filter objects tagged with this key but not this value */
  ["key"~"value"]    /* filter objects tagged with this key and a value matching a regular expression */
  ["key"!~"value"    /* filter objects tagged with this key but a value not matching a regular expression */
  [~"key"~"value"]   /* filter objects tagged with a key and a value matching regular expressions */
  [~"key"~"value",i] /* filter objects tagged with a key and a case-insensitive value matching regular expressions */

Questions:

  • Any ideas how that would be rewritten in:
    • PostgreSQL/PostGIS?
    • osmdata?
  • Would it be worth thinking about allowing osmdata to access data stored in a PostGIS db?
  • Thinking: it would be great to put some of these example in vignettes / examples. Good idea?

README fails

E.g. with

hs <- issue_query (q2)
Error: could not find function "issue_query"

pipes

This commit removed most dplyr deps, but has left this one. Once final types & classes are established, try to think of use-cases where pipes would not work anyway to see if this dep is really necessary.
cc @Robinlovelace

README

What does devtools::load_all (".", export_all=FALSE) do? Is it needed?

pkgdown

@mpadge could you go to settings and make sure that the GitHub pages source is set to “master branch /docs folder”.? Thanks!

Seemingly random crash on Windows

No idea what caused it, just reporting from newly installed version on R 3.3.3 on my Win desktop. Can anyone reproduce? Screenshot + code that caused it below:

image

authorship needs tidying

Thanks @Robinlovelace for the introduction and hello @masalmon - great to finally e-meet you back. These are two brief Qs I just emailed to you via Robin:

  1. You've got an Roxygen field here that says "@author Maelle Salmon". Are you okay with that line being removed, because:

    i. authorship for individual functions is not general R practice;

    ii. this raises difficult questions of whether anyone else has the right to accept a PR that modifies that function, and what the potential status of your authorship would be thereafter?; and

    iii. You're in the author list in DESCRIPTION anyway

You can have an additional description of what you contributed (like these), but if you're going to be involved further, it'd likely be better and more meaningful to simply list you as a general "author" absent specifications. I'd appreciate an indication of your preference in this regard.

  1. Are you okay with the diacritical marks being removed from your name, because CRAN rejects those anyway? (It'll then just become ''Maelle'' - blame ASCII for that, as I'm sure you're well aware.)

sf suggest on travis

@edzer Your help would be much appreciated on getting travis to pass with suggests:sf on osx as well as linux - my current travis.yml is here, with these travis fails for linux and osx. It'd also be great to load sf within a travis container, which would require sudo:false. Any assistance greatly appreciated!

overpass_query doesn't seem to return polygons when it should

Example, from which I was expecting to get Lovell park as a polygon as it is:

screenshot from 2016-11-01 22-34-24

b = tmap::bb("Leeds")
q = opq(bbox = b) %>% 
  add_feature("leisure", "park")
p = overpass_query(query = q)
library(sp)
plot(p$osm_points)
mapview::mapview(p$osm_points)
plot(p$osm_polygons)

Instead I get just points of the border by the look of it:

screenshot from 2016-11-01 22-29-45

Define class for returned objects

Queries returning no data produce the following error:

> dat
$osm_nodes
[1] coordinates
<0 rows> (or 0-length row.names)

$osm_ways
Error in signif(sapply(coordinates(x), function(x) x[[1]][1, ]), digits = digits) : 
  non-numeric argument to mathematical function

and yet

> dat$osm_ways
An object of class "SpatialLinesDataFrame"
Slot "data":
[1] name   oneway type  
<0 rows> (or 0-length row.names)
...

and also

> sapply (dat, class)
                 osm_nodes                   osm_ways                 osm_polygons
  "SpatialPointsDataFrame"    "SpatialLinesDataFrame"   "SpatialPolygonsDataFrame"
> summary (dat)
             Length Class                    Mode
osm_nodes    0      SpatialPointsDataFrame   S4  
osm_ways     0      SpatialLinesDataFrame    S4  
osm_polygons 0      SpatialPolygonsDataFrame S4  

Because obviously print does not recognise the list item as sp. Most direct fix is likely to be creating a distinct class with its own print/summary method.

Another use case that fails

From the README:

osmcsv <- '[out:csv(::id,::type,"name")];
area[name="Bonn"]->.a;
( node(area.a)[railway=station];
  way(area.a)[railway=station];
  rel(area.a)[railway=station]; );
out;'

obj <- overpass_query(osmcsv)
##  Error in eval(substitute(expr), envir, enclos) : expected < 

recursion operator

As discussed in this comment regarding sf, it would likely be very useful to have some kind of recursion operator for osmdata, along the lines of

> get_points (osmdat$osm_lines)

to return all data for all points comprising those lines, including additional key-val pairs for the points. This is an implicit ''recursion down'' operator. An analogous ''recursion up'' operator would be

> get_lines (osmdat$osm_points)

which would return all lines which contain those points.

A question worth thinking about:

  • Are then any instances in which the recursion direction would not be obvious?

If no, then only three functions need be written, for lines, points, and polygons.

building

When building the package every time it creates new files under src/ but I guess it's normal?

src

Error message when printing empty osmdata object

Example:

origins = dl_origins(bb)
q = osmdata::opq(bbox = bb) %>% 
  osmdata::add_feature("place", "*")
origins = osmdata::overpass_query(q)
origins
$osm_lines
Error in signif(sapply(coordinates(x), function(x) x[[1]][1, ]), digits = digits) : 
  non-numeric argument to mathematical function

It's probably not a meaningful query but think the error message could be a little more informative at least!

extend second vignette

This could be improved by providing concrete examples, particularly in the section on 'GDAL translation of OSM'. It would also be greatly improved by adding a second example other than routing. @Robinlovelace - any ideas here?

TODO: Replace all links to first vignette with URL of the webpage once that is up and running.

Query not working on Windows

I'm currently using the package in RStudio on Windows.

  • When I test the package with testthat, everything works ok.

  • I am attaching the results of R CHECK. The errors are due to examples in which there are comments about their not working so seems ok?
    osmdata_check_results.txt

  • If I run this query in my R session

qry <- opq(bbox=c(-0.12,51.11,-0.11,51.12)) 
qry <- add_feature (qry, key='highway', value='tertiary')
res <- overpass_query (qry)

The session aborts not long after the message

Issuing query to OSM Overpass...
Rate limit: 2

I re-started and now I actually get an error instead of session abortion

> qry <- opq(bbox=c(-0.12,51.11,-0.11,51.12)) 
> qry <- add_feature (qry, key='highway', value='tertiary')
> res <- overpass_query (qry)
Issuing query to OSM Overpass...
2 slots available now.
[1] "2 slots available now."
 Show Traceback
 
 Rerun with Debug
 Error in make_query(query, quiet) : Bad Request (HTTP 400). 

It seems quite weird to me. I can't investigate further today, but I'll try to take a few minutes this week at work to install the package and run the same steps there (still Windows).

What objects does osmdata return?

A question for @Robinlovelace and @hrbrmstr: How do we want the user to control what is returned from overpass? The current overpass_query relies, though process_doc, on the query being precise enough that it will only return the lowest desired OSM objects (node->way->rel), while osmdatar currently has the three functions get-points, get-lines, and get-polygons. The two approaches now need to be reconciled within osmdata, so I'll begin with an argument for my current approach:

  1. Bob's overpass approach relies on the queries being very precise, which they may not always be.
    1. Example: multiipolygons, for which a user may understandably desire the underlying way members rather than the multipolygon relation, yet the extension of process_doc to include processing of polygons would return just the latter and not the former.
    2. Example: There may be situations in which someone actually desires all the nodes which make up a way (that is, SpatialPoints), rather than the ways themselves (SpatialLines). This is possible with the osmdatar approach, yet not the overpass approach.
  2. Many OSM are represented in a variety of formats, regardless of how strict OSM guidelines are. Public transport stations are exemplary: Many may be either node or polygon objects, and simply asking for bus_station will return only those mapped as polygons, yet will miss all purely nodal stations.
    1. Example: The overpass approach (implicitly extended to polygon extraction) will not allow a map of bus_stations as simple points, because a query for bus_stations will return the highest hierarchical objects, which will be (polygonal) ways (or maybe even multipolygons).

Having stated the essence of my thoughts on the matter, I of course acknowledge that Bob's overpass approach is superior in one important way of obviating any need for users to specify a desired kind of output. This would be fantastic in a perfectly tidy OSM world, but I fear that the inherent messiness of everything actually requires the user to exert some degree of control, for which the simplest is surely specifying points, lines, or polygons. Thoughts?

Strange error when only a bb is given in a query

Reproducible example:

q <- opq (bbox="Kunming, China")
osmdata_sf (q)
Error in rcpp_osmdata_sf(doc) : unknown member_type

But this works:

osmdata_sf (add_feature(q, key = "highway"))
Object of class 'osmdata' with:
                 $bbox : 24.8915153,102.5417638,25.2115153,102.8617638
        $overpass_call : The call submitted to the overpass API
            $timestamp : [ Sun Feb 26 23:29:43 2017 ]
           $osm_points : 'sf' Simple Features Collection with 50300 points
            $osm_lines : 'sf' Simple Features Collection with 5106 linestrings
         $osm_polygons : 'sf' Simple Features Collection with 65 polygons
       $osm_multilines : 'sf' Simple Features Collection with 0 multilinestrings
    $osm_multipolygons : 'sf' Simple Features Collection with 0 multipolygons

Is it because the query is simply too large?

add recurse up option

This would probably be quite useful, and easily added to opq (). Should probably also default to recurse down relation (>>).

ropensci submission

As far as I see things, osmdata is now largely done and includes functionality necessary for initial release. Only remaining tasks:

  1. @Robinlovelace finish vignette
  2. @masalmon once Robin's done that, pkgbuild the website again
  3. add examples to fn docs

@hrbrmstr plan now is to submit this first to ropensci to gain some hopefully useful feedback prior to CRAN submission. Any comments, suggestions on general package structure at this stage? Or just a general nod of approval for us to go ahead and submit with you as package co-author?

Thanks all for all the help!

overpass/nominatim API timeout breaks tests/vignettes

See lots of discussion in #31. The problem is particularly pronounced in appveyor builds, but also plagues travis. Both overpass and nominatim are prone to timing out, which leads to tests failing.

Current approach for overpass is in the overpass_status function, which tries 10 times with a 100second timeout, yet still occasionally fails. I've also implemented a URL status check for nominatim called url_available.

Tests seem generally okay now (and even if they weren't, could technically be made okay with if clauses to perform tests only when timeout not reached), yet building vignettes still occasionally fails. This latter can not be avoided through if !timeout trickery, and so will always risk failing CRAN checks.

This problem must be solved ...

cc @masalmon

Function to download osm data

Sometimes you just want to download osm data and save it as a .osm file, e.g. to open in QGIS or JOSM. Is this possible?

more flexible overpass queries

Next request for cognitive input from @Robinlovelace and @hrbrmstr:

How are we going to construct overpass queries? Some food for thought in opq.R here, in which I've implement an option for non-exact matches. How far do we go aiding a user in avoiding the need to understand regex? I'd suggest a few simple extensions might actually go a long way in that regard, thereby making it easier to use for more people, but likely at the expense of requiring several additional arguments for add_feature.

A further issue: Many queries may not be constructed through sequential addition - prime example being AND rather than OR queries, because AND queries are not sequentially independent. (Consider that the example given in the function opq here actually represents an OR-construction rather than an AND-construction.) And yet only OR queries are possible in the structure both of add_feature and the osmdatar approach of specifying extra_pairs (see lines 60-69 here).

I'd suggest that in addition to non-exact values, we could possibly implement further options for:

  1. Negation
  2. Match case or not? (This will be messy to implement, but possible)
  3. Match position (maybe 0=start, 1=end, any other value = anywhere)
  4. Accented characters - maybe could avoid an extra arg by simply replacing any such with wildcards?

This would leave only the task of dealing with proper AND queries, which requires a different approach to that of add_feature, which is unavoidably OR. Thoughts? Suggestions? Food for thought from this point of the overpass language API onwards.

fix getbb()

@Robinlovelace here's one for ya: This should crash at some stage in the following way:

for (i in 1:100) q <- opq ("leeds")
# Error: lexical error: invalid char in json text.
#                                        <!DOCTYPE HTML PUBLIC "-//IETF/
#                      (right here) ------^

Could you catch these errors and spit out a simple "sorry, nominatim is broke; please try again" message?

sf!

The whole package is currently structured around sp objects, with overpass_query returning an osmdata object embedded within which are three sp objects (points/lines/polygons). How can sf-class objects best be incorporated? Possibilities:

  1. Have overpass_query return some more generic object the members of which can be accessed via:

    (i) sp_osm_points(), sp_osm_lines(), sp_osm_polygons(); and

    (ii) sf_osm_points(), sf_osm_lines(), sf_osm_polygons()

  2. Keep things as they are and include an osmdata_to_sf function which will convert all sp members to sf, either by:

    (i) Simply including an sf dep - a massive increase in package size and complexity!, or

    (ii) Hard-coding sf construction within the Rcpp routines as currently done for sp

Thoughts @Robinlovelace ?

Results from running tests on my PC

==> devtools::test()

Loading osmdata
Loading required package: testthat
Data (c) OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright
Testing osmdata
extract-objects: ................................................
features.R: ......
bbox: ..........
overpass query: ................1
sf-construction: ...23.4567..89.abc..de.fFF..F..FF..F..FF
sf-osm: FFF
sp-osm: ......

Failed -------------------------------------------------------------------------
1. Error: make_query (@test-osmdata.R#87) --------------------------------------
Failure when receiving data from the peer
1: osmdata_sf(qry) at C:\Users\msalmon.ISGLOBAL\Documents\osmdata/tests/testthat/test-osmdata.R:87
2: overpass_query(obj$overpass_call, quiet = quiet, encoding = encoding) at C:\Users\msalmon.ISGLOBAL\Documents\osmdata/R/get-osmdata.R:168
3: overpass_status(quiet) at C:\Users\msalmon.ISGLOBAL\Documents\osmdata/R/overpass-query.R:104
4: httr::GET("http://overpass-api.de/api/status") at C:\Users\msalmon.ISGLOBAL\Documents\osmdata/R/overpass-query.R:18
5: request_perform(req, hu$handle$handle)
6: request_fetch(req$output, req$url, handle)
7: request_fetch.write_memory(req$output, req$url, handle)
8: curl::curl_fetch_memory(url, handle = handle)

2. Failure: sf-point (@test-sf-construction.R#83) ------------------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 2, 0 >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


3. Failure: sf-point-with-fields (@test-sf-construction.R#90) ------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


4. Failure: multiple-points (@test-sf-construction.R#103) ----------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


5. Failure: multiple-points (@test-sf-construction.R#107) ----------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


6. Failure: multiple-points (@test-sf-construction.R#110) ----------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


7. Failure: multiple-points (@test-sf-construction.R#112) ----------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


8. Failure: sf-line (@test-sf-construction.R#134) ------------------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 2, 0 >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


9. Failure: sf-line-with-fields (@test-sf-construction.R#141) ------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


10. Failure: sf-multiple-lines (@test-sf-construction.R#158) -------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 2, 0 >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


11. Failure: sf-multiple-lines-with-fields (@test-sf-construction.R#168) -------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


12. Failure: sf-multiple-lines-with-fields (@test-sf-construction.R#174) -------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 2, 3 >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


13. Failure: sf-polygon (@test-sf-construction.R#200) --------------------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 2, 0 >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


14. Failure: sf-polygon-with-fields (@test-sf-construction.R#208) --------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: names for current but not for target >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


15. Failure: sf-multiple-polygons (@test-sf-construction.R#226) ----------------
`x` not identical to `y`.
Attributes: < Names: 2 string mismatches >
Attributes: < Component 1: 'current' is not a factor >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 2, 0 >
Attributes: < Component 2: Attributes: < target is NULL, current is list > >
Attributes: < Component 2: target is character, current is factor >


DONE ===========================================================================
Files
Plots
Packages
Help
Viewer

	
New Folder
	
	
Delete

	
Rename
	
	
More


			
Go to project directoryGo to directory
Home	osmdata	tests	testthat


Name
Size	Modified

..


cfm_output_available_features.rda
190.4 KB
Feb 14, 2017, 3:12 PM


cfm_output_bb.rda
1.5 KB
Feb 14, 2017, 3:12 PM


cfm_output_overpass_query.rda
1.6 KB
Feb 14, 2017, 3:12 PM


junk.osm
4.3 KB
Feb 14, 2017, 3:25 PM


test-extract.R
9.6 KB
Feb 14, 2017, 3:12 PM


test-features.R
2.2 KB
Feb 14, 2017, 3:12 PM


test-getbb.R
2.3 KB
Feb 14, 2017, 3:12 PM


test-osmdata.R
4.1 KB
Feb 14, 2017, 3:12 PM


test-sf-construction.R
15 KB
Feb 14, 2017, 3:12 PM


test-sf-osm.R
3 KB
Feb 14, 2017, 3:12 PM


test-sp-osm.R
5.7 KB
Feb 14, 2017, 3:12 PM
	
README.Rmd

	
osmdata.Rmd

	
test-sf-construction.R
*	

			

			
	
			
	
			
	
Source on Save
		
			

			
	
			

	
Run
	
			
	
	
Source

			
	
			
91:16
(Top Level)
R Script


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
test_that ("sf-point", {
               x <- sf::st_sfc (sf::st_point(1:2))
               expect_identical (x, make_sfc (1:2, "POINT"))
               y <- sf::st_sf (x)
               x <- make_sf (x)
               expect_identical (x, y)
})
test_that ("sf-point-with-fields", {
               x <- sf::st_sfc (sf::st_point(1:2))
               y <- sf::st_sf (x, a=3, b="blah")
               x <- make_sf (x, a=3, b="blah")
               expect_identical (x, y)
               # next lines will work with next sf version:
               #x0 <- make_sf (a=3, b="blah", x)
               #x1 <- sf::st_sf (x, a=3, b="blah")
               #expect_identical (x0, x1)
})
test_that ("multiple-points", {
               x0 <- make_sfc (list (1:2, 3:4), type="POINT")
               y <- sf::st_sfc (sf::st_point (1:2), sf::st_point (3:4))
               expect_identical (x0, y)
Console~/osmdata/
			
Console
R Markdown
	
~/osmdata/	
			

extend tests

Robin, This is something you could definitely help with! I'll take care of the C++ coverage, but you could definitely extend the R tests. One big advance will be an OSM example with a multipolygon relation (that is, with inner and outer components), so if you can dig out a simple one for that, that'd be grand. That'd also be ideal for me to address #20.

(I don't think anything can be done about `stub.R, but will give that a ponder myself ...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.