GSAK (Geocaching Swiss Army Knife)
 

Contents - Index


GetCounty (function)

GetCounty(sOptions) : numeric

This function is a optimized routine to calculate the county name for a given waypoint. Part of this optimization requires that the waypoint must already have a valid Country and for USA and UK also a valid State. This function uses polygon files to determine the location of each county and is not guaranteed to be perfect.

At the time of writing this help file, countries supported were: Austria, Czech Republic, France, Germany, Ireland, Italy, Netherlands, New Zealand, Norway, Slovakia, Sweden, USA, UK. . 

sOptions

U = update user data
2 = update user data 2
Y = update county
B = only update if blank
F = set user flag, but only if updated
R = set user flag if matching polygon found (see note)

Note: R option should just be used by itself and was added to allow you to flag those waypoints that have matching polygons withoug actually updating any data in the database. The B and F options should not be used alone and must also include at least one of U,Y or 2

Options can be entered in any order. The return value of the function is the number of records updated - or in the case of the single R option, then number of records flagged

So if you wanted to update user data with county names, but only if there wasn't already something in there, the code would be:
 

$updated = GetCounty("ub")
msgok msg=Number of records updated: $updated

 
There is actually many polygon files required to make this work (even zipped they are many Megabytes in size) so they are not shipped in the GSAK install.

Accordingly the function does a "smart update" of the county polygon files as needed. That is, it checks to see if a current state polygon file exists when it is updating. If not, then it will automatically download and install that state from the GSAK web site. It will only download those states that are being processed in the current filter.

The first time you run this function for a particular state, you must be connected to the Internet so it can download the corresponding polygon files. From then onwards, this function can be run at anytime. 

At the time of writing this help file, countries supported were (More will be added as the Polygon files come to hand):



Related: GetCountry() GetState() GetPolygon() 

Alpha List         Category List
Copyright 2004-2011 CWE Computer Services  
Privacy Policy Contact