d3/d3-geo

Problem with geoContains

pit07 opened this issue · 2 comments

pit07 commented

Hi everybody!

I use geoContains to test a GPS cordinates with a zone... but the result is false while my point IS in my zone... :(

My code :
`var zone = {"type":"FeatureCollection","features":[
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[5.3777706,43.4988418,0],[5.3623211,43.5043206,0],[5.3547679,43.4994644,0],[5.3468715,43.4966627,0],[5.3404341,43.495791,0],[5.3391467,43.4923041,0],[5.3397475,43.4870734,0],[5.342494,43.4833369,0],[5.3482448,43.4814685,0],[5.3527079,43.478915,0],[5.3545963,43.4775448,0],[5.3583729,43.477358,0],[5.3618061,43.4784791,0],[5.3634369,43.4735586,0],[5.3683292,43.4720014,0],[5.3733933,43.4739946,0],[5.3769124,43.4723751,0],[5.3806031,43.4744306,0],[5.385238,43.474742,0],[5.3926195,43.4771088,0],[5.3983702,43.4832746,0],[5.3991427,43.4882565,0],[5.3930487,43.4903737,0],[5.3848947,43.4951061,0],[5.3777706,43.4988418,0]]]},"properties":{"name":"zone"}}
]}

var point = [43.4859209,5.3378438];
console.log(d3.geoContains(zone, point));`

It's strange... :(
Thanks a lot for helping!
Vincent

Looks like you have your coordinates reversed?

[43.4859209,5.3378438]
[5.3930487,43.4903737,0]
pit07 commented

You're the best.
The third element in this array (0), what is it ?
Thanks a lot !