invalid polygon
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- computer-graphics
Research direction
Start with the reproducible R example using s2_geog_from_text(), s2_rebuild(), and s2_is_valid(), then compare its result with the GEOS validity check shown through sf. Determine whether the differing validity result reflects S2's validity rules or package handling; done means the behavior and any required change are clearly established.
Written by the indexing model from the issue text.
Description
I was hoping that this polygon:

would be made valid by:
library(s2)
x = s2_geog_from_text("POLYGON ((0 0, 3 0, 3 2, 1 1, 2 1, 0 2, 0 0))", check = FALSE)
o = s2_options(split_crossing_edges = TRUE)
s2_rebuild(x, o) |> s2_is_valid()
# [1] FALSE
Zooming in, the resulting geometry
library(sf)
# Linking to GEOS 3.11.1, GDAL 3.6.2, PROJ 9.1.1; sf_use_s2() is TRUE
s2_rebuild(x, o) |> st_as_sfc() -> y
y[[1]]
# POLYGON ((0 0, 3 0, 3 2, 1.5 1.250243, 0 2, 0 0), (2 1, 1 1, 1.5 1.250243, 2 1))
seems valid (inner ring CW, touches outer ring in a point), and
st_crs(y) = NA # so that GEOS is_valid is called:
st_is_valid(y)
# [1] TRUE
is considered valid by GEOS. Does s2geometry have a different concept of valid, or does the package handle this?
- Dominant language
- C++
- Stars
- 81
- Forks
- 19
- Avg merge
- 20h 25m
- Merged PRs (30d)
- 3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from r-spatial/s2
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·