Closed coolbutuseless closed 4 months ago
thanks - the cause is in {sfheaders} requiring an std::isnan()
check - https://github.com/dcooley/sfheaders/issues/100 - I've put a fix on master for z_range
, but not m_range
yet.
On a side note, both this issue and the {shfeaders} one are number 100 !
updated sfheaders dependency so this now works:
library(geojsonsf)
js0 <- '{"type":"MultiPoint","coordinates":[[0.0,0.0,0.0],[1.0,1.0]]}'
sfc0 <- geojson_sfc(js0)
attr(sfc0, 'z_range')
# zmin zmax
# 0 0
# attr(,"class")
# [1] "z_range"
js1 <- '{"type":"MultiPoint","coordinates":[[0.0,0.0],[1.0,1.0,1.0]]}'
sfc1 <- geojson_sfc(js1)
attr(sfc1, 'z_range')
# zmin zmax
# 1 1
# attr(,"class")
# [1] "z_range"
Great work on the extensive test suite you have included with
geojsonsf
- really shows how tricky this parsing can be!There appears to be a small inconsistency on how/when
z_range
attribute is calculated for MULTIPOINTIn the first example, the first point has XYZ coords, and the second point has XY coords. No
z_range
attribute is produced.In the second example, the first point has XY. The second point has XYZ. In this case, a
z_range
attribute is included.I'm not certain if this is an actual inconsistency, or something particular to the requirements of
sf
Created on 2023-08-26 with reprex v2.0.2