rowanwins/point-in-polygon-hao

always return false

Closed this issue · 2 comments

hi, i am working with this library with coordinates but always return false, example

this is false
console.log(inside([-33.439609219597486, -70.64156352003205 ], [[-33.442101569876634, -70.64380238713],
[-33.441027250788686, -70.6448967284086],
[-33.43791165020402, -70.6435019797209],
[-33.4380369926173, -70.6428797072294],
[-33.43955899318741, -70.6422788924101],
[-33.440669141469726, -70.6423003500822],
[-33.44086610177808, -70.6418711966398],
[-33.4410988724751, -70.6416351622465],
[-33.44211947508206, -70.6438023871306]]))

this should be true

console.log(inside([-33.43987398458904, -70.6429418981949 ], [[-33.442101569876634, -70.64380238713],
[-33.441027250788686, -70.6448967284086],
[-33.43791165020402, -70.6435019797209],
[-33.4380369926173, -70.6428797072294],
[-33.43955899318741, -70.6422788924101],
[-33.440669141469726, -70.6423003500822],
[-33.44086610177808, -70.6418711966398],
[-33.4410988724751, -70.6416351622465],
[-33.44211947508206, -70.6438023871306]]))

any idea ??

regards

sorry, was my error, i need to add another array to polygon

      console.log(inside([this.state.latitude, this.state.longitude ], [[[-33.442101569876634, -70.64380238713],
        [-33.441027250788686, -70.6448967284086],
        [-33.43791165020402, -70.6435019797209],
        [-33.4380369926173, -70.6428797072294],
        [-33.43955899318741, -70.6422788924101],
        [-33.440669141469726, -70.6423003500822],
        [-33.44086610177808, -70.6418711966398],
        [-33.4410988724751, -70.6416351622465],
        [-33.44211947508206, -70.6438023871306]]]))

works perfects

Glad you got it sorted!