Closed osserman closed 4 years ago
thanks for this @osserman !
however, I can't replicate the problem, either with the current version of geojsonio
on cran or the development version. I haven't tried it with your version of R, but I don't think that would cause any issues.
geojsonio
doesn't define a summary
method - what summary method is being called? there's a lot of pkgs loaded, so hard to know what s3 method is being used
Thanks @sckott for the quick reply.
Interesting that not reproducible.
Summary was just the first method I tried that actually output the json string. Looks like it's base or sp summary method that is being called (I get the same output from base::summary(x3)
and sp::summary(x3)
). But I don't think it's about the summary, since I also get the same output with cat(x3)
and same changed coordinates when I convert it from geojson to sp.
Let me know if anything else would be useful for me to look into on my end.
Thanks again! Stephen
So it is indeed the R version you're running. I tested on R 3.5 and I now get your result. It must be something about that R version that is causing the issue. Can you upgrade to the latest R version?
the topo2geo
uses internally sf::st_read
- i see you're using an older version of sf from 2018. its possible sf then didn't have topojson support, not sure.
anyway, upgrading to the most recent R and sf would be a good idea
Sure enough -- that did it. Sorry I hadn't tried that for and thanks for tracking it down!
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.
Session Info
R version 3.5.1 (2018-07-02) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS 10.15.2 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] geojsonio_0.8.0 sp_1.3-1 RPostgreSQL_0.6-2 DBI_1.0.0.9001 loaded via a namespace (and not attached): [1] remotes_2.0.0 sf_0.6-3 lattice_0.20-35 [4] testthat_2.0.0 V8_2.0 usethis_1.4.0 [7] yaml_2.2.0 base64enc_0.1-3 rlang_0.4.0 [10] pkgbuild_1.0.2 geojsonlint_0.3.0 e1071_1.7-0 [13] pillar_1.4.2 glue_1.3.1 foreign_0.8-70 [16] httpcode_0.2.0 withr_2.1.2 sessioninfo_1.1.0 [19] rgeos_0.5-2 devtools_2.0.0 memoise_1.1.0 [22] callr_3.0.0 maptools_0.9-8 ps_1.1.0 [25] curl_4.0 class_7.3-14 Rcpp_1.0.2 [28] readr_1.1.1 backports_1.1.4 classInt_0.2-3 [31] jsonvalidate_1.0.0 desc_1.2.0 pkgload_1.0.1 [34] jsonlite_1.6 fs_1.2.6 hms_0.4.2 [37] digest_0.6.20 stringi_1.4.3 processx_3.2.0 [40] grid_3.5.1 rprojroot_1.3-2 jqr_1.1.0 [43] rgdal_1.4-3 cli_1.1.0 tools_3.5.1 [46] magrittr_1.5 lazyeval_0.2.1 geojson_0.3.2 [49] tibble_2.1.3 crul_0.7.0 crayon_1.3.4 [52] pkgconfig_2.0.2 prettyunits_1.0.2 spData_0.2.9.4 [55] getcartr_1.01 assertthat_0.2.1 httr_1.4.0 [58] rstudioapi_0.7 R6_2.4.0 units_0.6-0 [61] compiler_3.5.1I was seeing some really weird behavior where coordinates were totally mangled when I converted topojson back to geojson. I tried to do a bit of debugging to see what cases it was happening in or figure out more and seems to be happening even in the simplest of cases:
produces:
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"id":"foo"},"geometry":{"type":"LineString","coordinates":[[100,0],[201,1],[303,2]]}}]}
Going through another loop:
produces:
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"id":"foo"},"geometry":{"type":"LineString","coordinates":[[100,0],[301,1],[604,3]]}}]}
Thanks in advance!