-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transmeridian polygons fail on ContainsPoint #21
Comments
Something looks off about the polygon that h3 is generating. When I run your code I get these points:
A valid polygon is usually closed, where the first and last point are the same. I made some minor changes in order to output a (valid'ish) geojson document. {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[145.5581976913369, 87.36469532319619],
[-163.45686807900947, 76.14556732608257],
[-131.70883908792965, 69.37134141076518],
[-100.82187020582201, 67.53592431503803],
[-66.90449925088507, 72.20470505499345],
[-34.758417980284634, 81.27137179020501],
[145.5581976913369, 87.36469532319619]
]
]
},
"properties": {}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-107.42920224303745, 79.220986356276]
},
"properties": {}
}
]
}
In the output above, the Point is outside of the generated polygon.
This library generally follows GeoJSON spec where geometries should stay within (-180 -90),(180, 90) boundary, and not cross the antimeridian. If the hexagonal polygon overlaps the antimeridian or the poles then it should be cut up into multiple polygons to conform to the GeoJSON spec, and this library. https://www.rfc-editor.org/rfc/rfc7946#section-5.3 |
Thank you for the extensive reply! Let's take this back to the H3 community, because this indeed seems off. Sorry I should have drawn the polygon by myself before asking. |
Hi,
I'm using your library to calculate if a point is within the polygon defined by a Uber H3 res0. Example code:
Some H3Cells are transmeridian such as this example. ContainsPoint return
false
while actually the point is the centerpoint (res0.LatLng())
of the polygon. I tried wrapping the longitudes to a 0 - 360 degrees system, but this also doesn't work because the point isn't valid anymore.The text was updated successfully, but these errors were encountered: