New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
geojson_json and geojson_write seem to unexpectedly truncate lat/lon precision #170
Comments
thx @dlebauer having a look |
What is your default |
@sckott 7 |
Please try again after reinstalling like
|
Fantastic, it works! Thanks for the quick response! > packageVersion(pkg = 'geojsonio')
[1] ‘0.9.2.93’
> options(digits = 10)
> summary(geojson_json(s, lat = "lat", lon = "lon", precision = 10))
{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-20.12345679,10.12345679]},"properties":{"id":"A"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-20.12345679,10.12345679]},"properties":{"id":"B"}}]} |
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. |
I would like to translate my data to geojson. But I was surprised that the values of lat and lon were truncated by the
geojson_json
function.Not sure if this is related to #141 or #96 that also deals with precision. Apologies if this is a duplicate (but fwiw - the 7 digits implemented in #96 should be sufficient for cm accuracy in my use case - sorry for the arbitrary precision in the example 😺 ).
I will start with the same example tibble:
What works:
when I write out the tibble directly:
produces desired precision
What doesn't work:
using
geojson_json
to convert the tibble to class geojsonproduces values w/ only 5 digits of precision:
and if I write this out using geojson_write, the precision gets truncated by an additional digit:
Session Info
The text was updated successfully, but these errors were encountered: