Skip to content

accept WKT "POLYGON FULL", for full polygon (entire Earth), if coordinates are geodetic #2441

@edzer

Description

@edzer

The full polygon is not part of the simple feature standard, but is needed when coordinates are geodetic. The "hidden" implementation used by s2geometry is POLYGON((0 -90,0 -90))

st_as_sfc("POLYGON((0 -90,0 -90))", crs = 4326) |> st_area()
# 5.100661e+14 [m^2]

but that is rather ugly from the user side. A more reasonable approach would be

library(sf)
# Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.4.0; sf_use_s2() is TRUE
x = st_as_sfc(c("POINT(0 1)", "POLYGON FULL"), crs = 'OGC:CRS84')
x
# Geometry set for 2 features 
# Geometry type: GEOMETRY
# Dimension:     XY
# Bounding box:  xmin: 0 ymin: -90 xmax: 0 ymax: 1
# Geodetic CRS:  WGS 84 (CRS84)
# POINT (0 1)
# POLYGON FULL
st_area(x)
# Units: [m^2]
# [1] 0.000000e+00 5.100661e+14

I suppose it should only be accepted when it is clear that the CRS is unprojected / coordinates are geodetic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions