Yesterday I was looking to check if a point was inside a polygon and found this great script: https://github.com/tparkin/Google-Maps-Point-in-Polygon
But today at wo
I had to find a similar solution. Here is what i have so far :
array[pol1cords[cord1,cord2...],pol2cords[cord1,cord2...],..]google.maps.geometry.poly.containsLocation(latLng, pol)true counter would go upMy algorithm looks something like this:
""Zone(level 3)->District(level 2)->VDC(level 1)"" vdcs = getVDCs(); -> gives vdcs in an array which has name, id and polygon coordinates zones = getZones(); ->gives zones in an array which has name, id and polygon coordinates
foreach(zones as zone){
drawPolygon(zone[coordinates]);
foreach(vdcs as vdc){
foreach(vdc[coordinates] as coordinate){
result = checkLocation(zone, coordinate);
if(result) counter++;
}
if(counter = vdc[coordinates].length){writeConsole(vdc_id+"true in"+zone_id)}
}
}