@@ -3,27 +3,27 @@ has_internet <- curl::has_internet ()
33test_that (" query-construction" , {
44
55 q0 <- opq (bbox = c (- 0.12 , 51.51 , - 0.11 , 51.52 ))
6- expect_error (q1 <- add_osm_feature (q0 ), " key must be provided" )
7- expect_silent (q1 <- add_osm_feature (q0 , key = " aaa" )) # bbox from qry
6+ expect_error (q1 <- filter_osm_tags (q0 ), " key must be provided" )
7+ expect_silent (q1 <- filter_osm_tags (q0 , key = " aaa" )) # bbox from qry
88 q0 $ bbox <- NULL
99 expect_error (
10- q1 <- add_osm_feature (q0 , key = " aaa" ),
10+ q1 <- filter_osm_tags (q0 , key = " aaa" ),
1111 " Bounding box has to either be set in opq or must be set here"
1212 )
1313 q0 <- opq (bbox = c (- 0.12 , 51.51 , - 0.11 , 51.52 ))
14- q1 <- add_osm_feature (q0 , key = " aaa" )
14+ q1 <- filter_osm_tags (q0 , key = " aaa" )
1515 expect_false (grepl (" =" , q1 $ features ))
16- q1 <- add_osm_feature (q0 , key = " aaa" , value = " bbb" )
16+ q1 <- filter_osm_tags (q0 , key = " aaa" , value = " bbb" )
1717 expect_true (grepl (" =" , q1 $ features ))
1818 expect_message (
19- q1 <- add_osm_feature (q0 ,
19+ q1 <- filter_osm_tags (q0 ,
2020 key = " aaa" , value = " bbb" ,
2121 key_exact = FALSE
2222 ),
2323 " key_exact = FALSE can only combined with value_exact = FALSE;"
2424 )
2525 expect_silent (
26- q1 <- add_osm_feature (q0 ,
26+ q1 <- filter_osm_tags (q0 ,
2727 key = " aaa" , value = " bbb" ,
2828 key_exact = FALSE , value_exact = FALSE
2929 )
@@ -33,14 +33,14 @@ test_that ("query-construction", {
3333test_that (" add feature" , {
3434
3535 qry <- opq (bbox = c (- 0.118 , 51.514 , - 0.115 , 51.517 ))
36- qry1 <- add_osm_feature (qry , key = " highway" )
37- qry2 <- add_osm_feature (qry , key = " highway" , value = " primary" )
38- qry3 <- add_osm_feature (qry ,
36+ qry1 <- filter_osm_tags (qry , key = " highway" )
37+ qry2 <- filter_osm_tags (qry , key = " highway" , value = " primary" )
38+ qry3 <- filter_osm_tags (qry ,
3939 key = " highway" ,
4040 value = c (" primary" , " tertiary" )
4141 )
42- qry4 <- add_osm_feature (qry , key = " highway" , value = " !primary" )
43- qry5 <- add_osm_feature (qry ,
42+ qry4 <- filter_osm_tags (qry , key = " highway" , value = " !primary" )
43+ qry5 <- filter_osm_tags (qry ,
4444 key = " highway" , value = " primary" ,
4545 match_case = FALSE
4646 )
@@ -56,7 +56,7 @@ test_that ("add feature", {
5656 bbox <- c (- 0.118 , 51.514 , - 0.115 , 51.517 )
5757 qry <- opq (bbox = bbox )
5858 bbox2 <- bbox + c (0.01 , 0.01 , - 0.01 , - 0.01 )
59- qry6 <- add_osm_feature (
59+ qry6 <- filter_osm_tags (
6060 qry ,
6161 bbox = bbox2 ,
6262 key = " highway" ,
@@ -65,14 +65,14 @@ test_that ("add feature", {
6565 expect_true (! identical (qry $ bbox , qry6 $ bbox ))
6666
6767 qry7 <- opq (" relation(id:74310)" ) | > # "Vinçà"
68- add_osm_feature (key = c (" name" , " !name:ca" ))
68+ filter_osm_tags (key = c (" name" , " !name:ca" ))
6969 qry8 <- opq (" relation(id:11755232)" ) | > # "el Carxe"
70- add_osm_feature (key = " natural" , value = " peak" ) | >
71- add_osm_feature (key = " !ele" )
70+ filter_osm_tags (key = " natural" , value = " peak" ) | >
71+ filter_osm_tags (key = " !ele" )
7272 expect_warning (
7373 qry9 <- opq (" relation(id:11755232)" ) | > # "el Carxe"
74- add_osm_feature (key = " !ele" ) | >
75- add_osm_feature (key = " natural" , value = " peak" ),
74+ filter_osm_tags (key = " !ele" ) | >
75+ filter_osm_tags (key = " natural" , value = " peak" ),
7676 " The query will request objects whith only a negated key "
7777 )
7878 expect_identical (qry7 $ features , " [\" name\" ] [!\" name:ca\" ]" )
@@ -249,7 +249,7 @@ test_that ("osmdata without query", {
249249test_that (" make_query" , {
250250
251251 qry <- opq (bbox = c (- 0.116 , 51.516 , - 0.115 , 51.517 ))
252- qry <- add_osm_feature (qry , key = " highway" )
252+ qry <- filter_osm_tags (qry , key = " highway" )
253253
254254 if (! has_internet ) {
255255 expect_error (
@@ -361,7 +361,7 @@ test_that ("make_query", {
361361test_that (" query-no-quiet" , {
362362
363363 qry <- opq (bbox = c (- 0.116 , 51.516 , - 0.115 , 51.517 ))
364- qry <- add_osm_feature (qry , key = " highway" )
364+ qry <- filter_osm_tags (qry , key = " highway" )
365365
366366 with_mock_dir (" mock_osm_xml" , {
367367 expect_message (
@@ -395,47 +395,47 @@ test_that ("query-no-quiet", {
395395 })
396396})
397397
398- test_that (" add_osm_features " , {
398+ test_that (" add_osm_tags " , {
399399
400400 qry <- opq (bbox = c (- 0.118 , 51.514 , - 0.115 , 51.517 ))
401401 expect_error (
402- qry <- add_osm_features (qry ),
402+ qry <- add_osm_tags (qry ),
403403 " tags must be provided"
404404 )
405405
406406 qry $ bbox <- NULL
407407 expect_error (
408- qry <- add_osm_features (qry , features = " a" ),
408+ qry <- add_osm_tags (qry , tags = " a" ),
409409 " Bounding box has to either be set in opq or must be set here"
410410 )
411411
412412 qry <- opq (bbox = c (- 0.118 , 51.514 , - 0.115 , 51.517 ))
413413
414414 expect_error (
415- qry <- add_osm_features (qry , features = " a" ),
415+ qry <- add_osm_tags (qry , tags = " a" ),
416416 " tags must be a named list or vector or a character vector enclosed in escape delimited quotations \\ (see examples\\ )"
417417 )
418418
419419 bbox <- c (- 0.118 , 51.514 , - 0.115 , 51.517 )
420420 bbox_mod <- bbox + c (- 0.001 , - 0.001 , 0.001 , 0.001 )
421421 qry0 <- opq (bbox = bbox )
422- qry1 <- add_osm_features (qry0 , features = " \" amenity\" =\" restaurant\" " )
423- qry2 <- add_osm_features (qry0 ,
424- features = " \" amenity\" =\" restaurant\" " ,
422+ qry1 <- add_osm_tags (qry0 , tags = " \" amenity\" =\" restaurant\" " )
423+ qry2 <- add_osm_tags (qry0 ,
424+ tags = " \" amenity\" =\" restaurant\" " ,
425425 bbox = bbox_mod
426426 )
427427 expect_false (identical (qry1 $ bbox , qry2 $ bbox ))
428428
429- qry3 <- add_osm_features (qry0 , features = c (" amenity" = " restaurant" ))
429+ qry3 <- add_osm_tags (qry0 , tags = c (" amenity" = " restaurant" ))
430430 expect_identical (qry1 , qry3 )
431431
432- qry4 <- add_osm_features (qry0 ,
433- features = c (" amenity" = " restaurant" , " amentity" = " pub" )
432+ qry4 <- add_osm_tags (qry0 ,
433+ tags = c (" amenity" = " restaurant" , " amentity" = " pub" )
434434 )
435435 expect_s3_class (qry4 , " overpass_query" )
436436
437- qry5 <- add_osm_features (qry0 ,
438- features = list (" amenity" = " restaurant" , " amentity" = " pub" )
437+ qry5 <- add_osm_tags (qry0 ,
438+ tags = list (" amenity" = " restaurant" , " amentity" = " pub" )
439439 )
440440 expect_s3_class (qry5 , " overpass_query" )
441441})
0 commit comments