javascript - containsLocation always returning false with PolyLine -


i'm trying determine points in map fall inside of route , ones don't, using containslocation on result of directionsservice.

basically, after route rendered have array of latlng objects, , use overview_path first route of result instantiate polyline , test each point containslocation.

i instantiate polyline this:

test_path = result.routes[0].overview_path; line = new google.maps.polyline({path: test_path}); 

then go through array this:

for(i = 0; < positions.length; i++){       point = new google.maps.latlng(positions[i].lat, positions[i].lng);       resultados.push({position: positions[i], result: google.maps.geometry.poly.containslocation(point, line)});   } 

however, every single 1 of points comes false, on cases inside route (like in annexed print).

ps: objects have been tested , have valid coordinates.
ps2: have tried islocationonedge, , returns false.
ps3: have set polyline map valid map, no change.

here exemple points fall route, come false:

http://imgur.com/a/lorfh

ps4: coordinates of markers same ones tested.

full code: https://jsfiddle.net/fl7qasar/


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -