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:
ps4: coordinates of markers same ones tested.
full code: https://jsfiddle.net/fl7qasar/
Comments
Post a Comment