R package for downloading OpenStreetMap data
1require (sf)
2
3test_that ("unique sf", {
4 q0 <- opq (bbox = c (1, 1, 5, 5))
5 x0 <- osmdata_sf (q0, test_path ("fixtures", "osm-multi.osm"))
6 x1 <- unique_osmdata (x0)
7 expect_true (!identical (x0, x1))
8 expect_true (nrow (x0$osm_points) > nrow (x1$osm_points))
9 # trim converts the polygon to a linestring, but for the ways,
10 # all objects extend through the trim bb_poly and out, so nothing
11 # is trimmed.
12
13 x0 <- osmdata_sf (q0, test_path ("fixtures", "osm-ways.osm"))
14 x1 <- unique_osmdata (x0)
15 expect_true (!identical (x0, x1))
16 expect_true (nrow (x0$osm_points) > nrow (x1$osm_points))
17})
18
19test_that ("unique sp", {
20 q0 <- opq (bbox = c (1, 1, 5, 5))
21 expect_warning (
22 x0 <- osmdata_sp (q0, test_path ("fixtures", "osm-multi.osm")),
23 "Deprecated"
24 )
25 x1 <- unique_osmdata (x0)
26 expect_true (!identical (x0, x1))
27 expect_true (nrow (x0$osm_points) > nrow (x1$osm_points))
28 # trim converts the polygon to a linestring, but for the ways,
29 # all objects extend through the trim bb_poly and out, so nothing
30 # is trimmed.
31
32 expect_warning (
33 x0 <- osmdata_sp (q0, test_path ("fixtures", "osm-ways.osm")),
34 "Deprecated"
35 )
36 # x1 <- unique_osmdata (x0)
37 # expect_true (!identical (x0, x1))
38 # expect_true (nrow (x0$osm_points) > nrow (x1$osm_points))
39})