Tuesday, February 26, 2008

Using GSAK Polygon Filters

Finally, the last episode in the adventures of GSAK line, arc, and polygon filters! Since we've already covered lines and arcs, that would leave . . . . POLYGONS! If you were paying attention during Geometry class, you know that a polygon is is a plane figure that is bounded by a closed path or circuit, composed of a finite sequence of straight line segments (i.e., by a closed polygonal chain). These segments are called its edges or sides, and the points where two edges meet are the polygon's vertices or corners. The interior of the polygon is called its body. Also, in a simple polygon, the boundary of the polygon does not cross itself.

You did remember that, right? Right?? Oh, well, even if you didn't, I'm sure you have the idea. A triangle is a simple polygon. So is a square. So is that hexagonal stop sign at the street corner. Unlike those examples, which are all convex and often equilateral, a GSAK polygon can be any shape as long as it is simple (no crossing edges), and each of its sides can be any length.

This filter will select all of the waypoints that are contained INSIDE a closed polygon. You can have as many sides to the polygon as you wish. To keep the example simple, I will just take the route I used in the previous example, and turn it into a closed polygon by connecting my last Rockford lat/long to my initial Schaumburg lat/long. There are two important things you have to remember about polygons. First, just like with a route, the lat/long pairs have to appear in order as you make your way around the polygon (but it doesn’t matter what your starting point is). Second, the LAST lat/long in your polygon definition has to be the same as your FIRST – that is, you have to CLOSE the polygon. Notice in the following filter that the first and last lat/long pairs are the same, and also that the box for specifying distance is no longer available.

Here’s the map, showing the closed polygon, and all the caches contained inside that area.

Finally, one other option that wasn’t discussed earlier is the “Exclude” option on the Arc/Poly tab. If you check this box, it basically reverses the filter – select all waypoints that are NOT within “x” miles of these points, select all waypoints that are NOT within “x” miles of this line/arc, select all waypoints that are NOT contained inside this polygon. Go back and take a look at the original map showing ALL of the northern Illinois waypoints. Using the same polygon filter as in our last example, but specifying “Exclude”, we get a result like the next map. See the big empty area inside the polygon?

The "Exclude" option works just as well with points, lines, and arcs -- that is, you can find everything that is NOT within 5 miles of a point (for example), or NOT within 2.5 miles of a route. You're limited only by your imagination!

Profile for WascoZooKeeper

No comments: