i have a typical question with the Geometric datatype of mysql, polygon.
I have the polygon data, in the form of an array of latitudes and longitudes, ex:
[["x":37.628134, "y":-77.458334],
["x":37.629867, "y":-77.449021],
["x":37.62324, "y":-77.445416],
["x":37.622424, "y":-77.457819]]
And i have a point (Vertex) with coordinates of latitude and longitude, ex:
$location = new vertex($_GET["longitude"], $_GET["latitude"]);
Now i want to find whether this vertex (point) is inside the polygon. How can i do this in php ?
This is a function i converted from another language into PHP:
Additional: For more functions i advise you to use the polygon.php class available here. Create the Class using your vertices and call the function
isInside
with your testpoint as input to have another function solving your problem.