Skip to content

Commit

Permalink
Fix wrong changeset bbox in sf format
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaspons committed Jul 14, 2024
1 parent ee9738f commit 84f16e7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: osmapiR
Title: 'OpenStreetMap' API
Version: 0.1.0.9010
Version: 0.1.0.9011
Authors@R: c(
person("Joan", "Maspons", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0003-2286-8727")),
Expand Down
4 changes: 2 additions & 2 deletions R/st_as_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ st_as_sf.osmapi_changesets <- function(x, ...) {
bbox <- apply(x[, c("min_lat", "min_lon", "max_lat", "max_lon")], 1, function(y) {
sf::st_bbox(stats::setNames(as.numeric(y), nm = c("ymin", "xmin", "ymax", "xmax")), crs = sf::st_crs(4326))
}, simplify = FALSE)
geom <- do.call(sf::st_as_sfc, bbox)
out$geometry <- geom
geom <- lapply(bbox, sf::st_as_sfc)
out$geometry <- do.call(c, geom)

out <- sf::st_as_sf(x = as.data.frame(out), crs = sf::st_crs(4326), ...)
class(out) <- c("sf_osmapi_changesets", "sf", "data.frame")
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci/osmapiR",
"issueTracker": "https://github.com/ropensci/osmapiR/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.0.9010",
"version": "0.1.0.9011",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -180,7 +180,7 @@
"name": "osmapiR: OpenStreetMap API",
"identifier": "10.32614/CRAN.package.osmapiR",
"url": "https://docs.ropensci.org/osmapiR/",
"description": "R package version 0.1.0.9009 \nhttps://github.com/ropensci/osmapiR",
"description": "R package version 0.1.0.9011 \nhttps://github.com/ropensci/osmapiR",
"@id": "https://doi.org/10.32614/CRAN.package.osmapiR",
"sameAs": "https://doi.org/10.32614/CRAN.package.osmapiR"
}
Expand Down
24 changes: 12 additions & 12 deletions tests/testthat/_snaps/changesets.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
Simple feature collection with 2 features and 9 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 2.658056 ymin: 42.67996 xmax: 2.712578 ymax: 42.69368
Bounding box: xmin: 2.393848 ymin: 42.50335 xmax: 2.712578 ymax: 42.69368
Geodetic CRS: WGS 84
id created_at closed_at open user uid
1 137595351 2023-06-21 09:09:18 2023-06-21 09:09:18 FALSE Quercinus 19641470
Expand All @@ -81,7 +81,7 @@
2 2 tags: comment=Volta pel Canogó. Add Waste basket, 7 Information guidepost, Inf...
geometry
1 POLYGON ((2.658056 42.67996...
2 POLYGON ((2.658056 42.67996...
2 POLYGON ((2.393848 42.50335...

# osm_download_changeset works

Expand Down Expand Up @@ -468,7 +468,7 @@
Simple feature collection with 50 features and 9 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: -6.978249 ymin: 42.43274 xmax: -6.978003 ymax: 42.43286
Bounding box: xmin: -8.122144 ymin: 42.43051 xmax: -6.975474 ymax: 43.57051
Geodetic CRS: WGS 84
First 10 features:
id created_at closed_at open user
Expand Down Expand Up @@ -506,15 +506,15 @@
10 6 tags: changesets_count=138 | comment=13 | created_by=iD 2.25.2 | host=https://...
geometry
1 POLYGON ((-6.978249 42.4327...
2 POLYGON ((-6.978249 42.4327...
3 POLYGON ((-6.978249 42.4327...
4 POLYGON ((-6.978249 42.4327...
5 POLYGON ((-6.978249 42.4327...
6 POLYGON ((-6.978249 42.4327...
7 POLYGON ((-6.978249 42.4327...
8 POLYGON ((-6.978249 42.4327...
9 POLYGON ((-6.978249 42.4327...
10 POLYGON ((-6.978249 42.4327...
2 POLYGON ((-6.97651 42.43275...
3 POLYGON ((-6.975636 42.4328...
4 POLYGON ((-7.852761 43.4488...
5 POLYGON ((-7.852622 43.4499...
6 POLYGON ((-7.852723 43.4498...
7 POLYGON ((-7.849041 43.4509...
8 POLYGON ((-7.849193 43.4503...
9 POLYGON ((-7.851801 43.4515...
10 POLYGON ((-7.852136 43.4517...

---

Expand Down

0 comments on commit 84f16e7

Please sign in to comment.