Skip to content
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

geoContains is not working #112

Closed
psi-gh opened this issue Aug 31, 2017 · 5 comments
Closed

geoContains is not working #112

psi-gh opened this issue Aug 31, 2017 · 5 comments

Comments

@psi-gh
Copy link

psi-gh commented Aug 31, 2017

According to geoContains method, the center of Moscow is not contained in Moscow Area (it returned false), which is a strange fact :) Code snippet to test:
https://runkit.com/embed/cw2rh9zbcbcr
(or in gist https://gist.github.com/psi-gh/6f8e7b356f2bb5086cb98c58fbd0d588)

@Fil
Copy link
Member

Fil commented Aug 31, 2017 via email

@psi-gh
Copy link
Author

psi-gh commented Aug 31, 2017

Oh thanks Fil! So i forced to use other library.

@mbostock
Copy link
Member

You can reverse the coordinates of the polygon rings to flip the winding order.

@mbostock
Copy link
Member

Standard GeoJSON is planar rather than spherical, so if we implement path.contains #109 it would be easy to test for containment using d3.geoIdentity as the projection.

@iway1
Copy link

iway1 commented Oct 11, 2022

probably better off just using this: https://stackoverflow.com/questions/22521982/check-if-point-is-inside-a-polygon

geoContains some times does not even work when the coords are counter clockwise. =/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants