Get bounded cell from lat / lon polygon
I have a list of boundaries (polygons) and a list of ways represented by latitudes and longitudes. I would like to know if there is one path inside the polygon. I am doing this in perl but cannot find anything useful to calculate. Math :: Polygon (:: Calc) has interesting features, but not for lat / lon only for x / y.
So, I'm thinking about making it simpler and creating a bounding box for each polygon, so it's easier for me to check if one path point is in the bounding box.
Does anyone know what the algorithm looks like to get the bounding box. pseudocode would be enough, so I can code it in perl.
It would be even better to check for the presence inside the polygon without converting the polygon to its bounding rectangle, but I couldn't find anything useful on the net. There are some simple 2d x / y based coordinate systems, but not for spherical lat / lon.
source to share