This should be an easy question but I have hit a brick wall with my code. I greatly appreciate any response...
I work extensively with GoogleEarth files that contain both points and polygons. I have assigned two arrays for each X and Y coordinate for the points file. The arrays look something like this:
For the following coordinates:(-12, -83),(0, 34),(23, -76)
@pnt_x_values = (-12, 0, 23)
@pnt_y_values = (-83, 34, -76)
I would like to find any points that lie within any of the polygons. I have stripped the polygon file into four arrays. Each consecutive element of each array contains the minimum and maximum values for the x and y coordinates for each polygon.
The sample below uses three (rectangular) polygons:
@poly_x_min = (-13, 45, 22)
@poly_x_max = (-11, 49, 24)
@poly_y_min = (-82, 33, -2)
@poly_y_max = (-84, 35, -6)
In other words, the first point coordinate lies within the first polygon. ie:
$poly_x_min[0] <= $pnt_x_values[0] <= $poly_x_max[0]
and
$poly_y_min[0] <= $pnt_y_values[0] <= $poly_y_max[0]
(In the file, there is no nice correlation between indexes like this.)I have posted a horrible illustration here
If you have any ideas, on how to get perl to evaluate each point against each polygon in this manner, I would greatly appreciate it.
In reply to Is a point in a polygon? by ferddle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |