ropensci / geojsonio

Convert many data formats to & from GeoJSON & TopoJSON
https://docs.ropensci.org/geojsonio
Other
151 stars 59 forks source link

geojsonio vulnerable to forthcoming changes in sp and rgdal #157

Closed rsbivand closed 4 years ago

rsbivand commented 4 years ago

Related to https://github.com/ropensci/geojsonio/issues/150 and https://github.com/ropensci/geojsonio/issues/148:

Running revdep checks for current rgdal on R-Forge - see:

https://stat.ethz.ch/pipermail/r-sig-geo/2019-November/027801.html

shows the errors in the attached check log, related to use of PROJ&/GDAL3 and required changes to sp and rgdal. If useful find a regerence to a docker image in this thread:

https://github.com/r-spatial/discuss/issues/28

Changes will occur quite fast, and packages need to be prepared.

The problems seem to come from not preparing the sp::CRS objects in a way that lets us modify them outside S4 to use WKT in comments. I tried to trace the crs object through your nested function calls, but lost trace.

* checking examples ... ERROR
Running examples in ‘geojsonio-Ex.R’ failed
The error most likely occurred in:

> ### Name: topojson_write
> ### Title: Write TopoJSON from various inputs
> ### Aliases: topojson_write
> 
> ### ** Examples
> 
> # From a data.frame
> ## to points
> topojson_write(us_cities[1:2,], lat='lat', lon='long')
Error in (function (obj, dsn, layer, driver, dataset_options = NULL, layer_options = NULL,  : 
  Can't parse WKT2-style parameter string
Calls: topojson_write ... write_geojson -> write_ogr -> do.call -> <Anonymous>
Execution halted
sckott commented 4 years ago

thanks @rsbivand - I can't replicate the error. I used the jakubnowosad/geocompr_proj6 docker image, installed latest rgdal from rforge and have

sf::sf_extSoftVersion()
#>          GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H 
#>       "3.8.0"        "3.0.2"        "6.2.1"        "false"         "true"

packageVersion("rgdal")
#> [1] ‘1.5.2’

do i have the wrong versions of anything?

sckott commented 4 years ago

Ah I see, I needed dev sp on github, now I can see the error

sckott commented 4 years ago

not preparing the sp::CRS objects in a way that lets us modify them outside S4 to use WKT in comments

@rsbivand What is the proper way? I couldn't figure it out from the links

rsbivand commented 4 years ago

First, PROJ 6 (I use 6.2.1), then GDAL 3 built on PROJ 6 (I use 3.0.2). Next, current rgdal on R-Forge https://r-forge.r-project.org/R/?group_id=884, for example source install of install.packages("rgdal", repos="http://R-Forge.R-project.org"). Finally, my fork of sp on github, https://github.com/rsbivand/sp, which requires rgdal >= 1.5.1. See the comments by @mdsumner and @Robinlovelace wrt. @Nowosad 's docker image https://github.com/r-spatial/discuss/issues/28#issuecomment-551241421.

A range of somewhat splattered sanguineous details in https://github.com/r-spatial/discuss/issues/28 - I/we don't really see the full contours of the unavoidable/desirable GDAL3/PROJ6 regression, involving silent accuracy degradation if we carry on using PROJ strings with +datum= tags other than WGS84, NAD83 and NAD27. See also: https://github.com/r-spatial/sf/issues/1187.

github-actions[bot] commented 2 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.