|GSAK (Geocaching Swiss Army Knife)|
GetCountry(sOptions) : numeric
This function is a optimized routine to calculate the country name for a given waypoint.
U = update user data
2 = update user data 2
C = update country
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 without 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,C,Y or 2
Options can be entered in any order. The return value of the function is the number of records changed (that is, where the new country value is different to the one on file) - or in the case of the single R option, then number of records flagged
So if you wanted to update the country column with country names, but only if there wasn't already something in there, the code would be:
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 country polygon files as needed. For the definition of "needed" please see this link
The first time you run this function, 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.
Related: GetCounty() GetState() GetPolygon()
Alpha List Category List
Copyright 2004-2016 CWE Computer Services |