Open benbovy opened 1 month ago
I am not entirely sure why s2geography
returns -1 (cc @paleolimbot?), because AFAIK R's s2
returns the max dimension of the parts (except for an empty collection): https://r-spatial.github.io/s2/reference/s2_is_collection.html (see the examples).
And I suppose this is then also consistent with bigquery (I assume, based on the description, but didn't test that)
It seems that in s2geography
, there is a difference between the Geography::dimension()
attribute and the s2_dimension()
function.
The attribute is used in code where you want to know if you have points or polylines or polygons (and if not one of those three, it returns -1), and then the logic to calculate the max dimension in case of collections is handled inside the s2_dimension
function (https://github.com/paleolimbot/s2geography/blob/1c67ddc62c30977fabca291fb68fd8cb62f3beaa/src/s2geography/accessors.cc#L55-L69)
In the case where a collection contains features of different dimensions, the default value returned via s2geography (-1) is not consistent with the value returned by shapely (max dimension value found).
Which one do we want?
_Originally posted by @jorisvandenbossche in https://github.com/benbovy/spherely/pull/51#discussion_r1806473111_