Closed ateucher closed 5 years ago
@sckott @edzer
thanks for pointing this out @ateucher
that sounds good to me to unname the objects. is there any complexity or edge cases here?
Not that I can see. It works in rmapshaper which has a pretty comprehensive test suite. The only issue is that on round-trip (i.e., sfc
-> geojson
-> scf
) the names would be lost... but I don't know a: if that's a big deal, or b: a robust way to get around it (i.e., if there is manipulation of the geojson
before converting back to sfc
.
we could consider keeping the names in attributes in the object, and applying them to the geojson before converting back to sfc
?
Yep, that would work if the geojson
is unchanged (though then you have to ask why would a user do a straight round trip if not to do some processing (e.g., with rmapshaper
or jqr
)?
right, that's not gonna work to reapply names
Having named geometries is, afair, neither mentioned by simple feature access nor by the geojson RFC. Package sf does it because OGR (GDAL) provides feature IDs -- for some data formats it makes sense to pass them on to R. I don't see an issue if geojsonio drops them.
Thanks @edzer that's a good perspective.
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 think the answer is to just
unname()
sfc objects before converting withgeojson_json.sfc()
andgeojson_list.sfc()
Created on 2018-10-12 by the reprex package (v0.2.1)