I created a polygon şn google maps which coords are
const osevioServingArea = [
{ lat: 41.0064636, lng: 29.0139668 },
{ lat: 41.0057511, lng: 29.0148251 },
{ lat: 40.8916216, lng: 29.1868298 },
{ lat: 40.9989817, lng: 29.2390148 },
{ lat: 41.0375782, lng: 29.0725033 },
{ lat: 41.0064636, lng: 29.0139668 },
];
And I took an point input and check the point if it is inside the polygon.
var lat = response.data.results[0].geometry.location.lat;
var lng = response.data.results[0].geometry.location.lng;
if(lat>= 40.8916216 && lat<= 41.0375782 && lng<=29.2390148 && lng>=29.0139668){
isInside= true;
}
But I think it is wrong because the polygon has not a clear shape. Therefore the point can be smaller than the biggest lat and smaller than the biggest leg but does not locate inside the polygon.(sorry but I can't add an image) How do I check the given point is inside the polygon?