-
Enjoying GeoKrety.org?
If you use GeoKrety.org and have found it helpful, please consider donating.
Read
General
Logtypes (state)
0 = Dropped to; 1 = Grabbed from; 2 = A comment; 3 = Seen in; 4 = Archived; 5 = Visiting;GK Types (type)
0 = Traditional; 1 = A book/CD/DVD...; 2 = A human; 3 = A coin; 4 = KretyPost;Reference number and id conversion
$id=hexdec(substr($gk, 2, 4)); $gk=sprintf("GK%04X",$id);
Database synchronising
This can be used to synchronize your database with GK database - useful for OpenCaching and other geocaching projects as well as for other purposes ;) Please note, all opencaching sites should be using Method 2!
Note: export*.php has a limit of retrieved data set at 10 days (ie you can download data changed in the past 10 days only). This should be enough to sync local OC nodes or other databases. To get older data check: here.
Method 1: All GeoKrety & logs information (slow and large volume of data)
To get list of GK created after the date and moves registered after the date:https://geokrety.org/export.php?modifiedsince=20090901000000
Sample output (without headers):
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <gkxml version="1.0" date="2013-01-05 13:00:49"> <geokret id="6664"> <name><![CDATA[Piramidy]]></name> <description><![CDATA[by Terry Pratchett]]></description> <owner id="3807"><![CDATA[meteor2017]]></owner> <datecreated>2010-01-17 17:43:50</datecreated> <distancetravelled>408</distancetravelled> <state>0</state> <missing>0</missing> <position latitude="49.48972" longitude="18.96848" /> <waypoints> <waypoint><![CDATA[OP41A1]]></waypoint> </waypoints> <type id="1"><![CDATA[A book/CD/DVD...]]></type> </geokret> <moves id="284778"> <geokret id="28328"><![CDATA[Indián 2]]></geokret> <position latitude="50.33383" longitude="13.51802" /> <waypoints> <waypoint><![CDATA[GC1W85C]]></waypoint> </waypoints> <date moved="2013-01-05 12:00:00" logged="2013-01-05 12:48:01" /> <user id="17715"><![CDATA[sacreecoeur]]></user> <comment><![CDATA[Moje první GeoKrety]]></comment> <logtype id="0"><![CDATA[Dropped to]]></logtype> </moves> </gkxml>
Method 2: Only GeoKrety information (fast, only most important data; designed for OC sites)
To get list of GK that changed location during last hour: https://geokrety.org/export_oc.php?modifiedsince=20230331191703State field may have different value than in other versions of export scripts. This is because OC sites only need to know if a geokret is in a cache or in the hands of some geocacher. So if someone dips a geokret, its state will be 1 (grabbed).
Note: export*.php has a limit of retrieved data set at 10 days (ie you can download data changed in the past 10 days only). This should be enough to sync local OC nodes or other databases. To get older data check: here.
Sample output:
<geokret id="4849"> <name><![CDATA[B&B's Dragonfly]]></name> <distancetravelled>1959</distancetravelled> <state>0</state> <position latitude="53.73917" longitude="17.40568" /> <waypoints> <waypoint><![CDATA[OP1003]]></waypoint> </waypoints> </geokret> <geokret id="3249"> <name><![CDATA[Geokretynka]]></name> <distancetravelled>113</distancetravelled> <state>1</state> <position latitude="0.00000" longitude="0.00000" /> <waypoints> <waypoint><![CDATA[]]></waypoint> </waypoints> </geokret>
Retriving information
Note: export*.php has a limit of retrieved data set at 10 days (ie you can download data changed in the past 10 days only). This should be enough to sync local OC nodes or other databases. To get older data check: here.
https://geokrety.org/export2.php
sample output:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <gkxml version="1.0" date="2010-12-09 19:10:03"> <geokrety> <geokret id="8143" dist="251" lat="53.14598" lon="23.18567" waypoint="OP2FD9" owner_id="3813" state="0" type="0" last_pos_id="11536" last_log_id="11553" image="1273660644jr8sm.jpg"> <![CDATA[Wiewireczka]]> </geokret> </geokrety> </gkxml>
General purpose swiches:
- modifiedsince*; list of GK with the timestamp of the last move >modifiedsince; (required for some queries) example:
https://geokrety.org/export2.php?modifiedsince=20100901000000 - swiches defining the area of places, where GK are:
latNE latSW lonNE lonSW; example:
https://geokrety.org/export2.php?latNE=50&latSW=40&lonNE=50&lonSW=0 - userid; lists GK owned by userid; example:
https://geokrety.org/export2.php?userid=1 - gkid: lists only one GK, example:
https://geokrety.org/export2.php?gkid=141 - wpt: lists GK which are in the cache with specified waypoint, eg:
https://geokrety.org/export2.php?wpt=op05e5
it can be used to show GK in caches with defined waypoint's prefix; eg to show all GK in romanian caches (prefix GR), just enter:
https://geokrety.org/export2.php?wpt=gr
Above swiches can be mixed. Eg to list my (ownerid=1) geokrets
which are in GC caches, just enter:
https://geokrety.org/export2.php?userid=1&wpt=gc
Retriving user's inventory:
- userid and inventory=1: list GKs in user's inventory, eg:
https://geokrety.org/export2.php?userid=1&inventory=1 - the same but with secid user's identification:
https://geokrety.org/export2.php?secid=....&inventory=1
this request returns also the secret tracking codes (the nr variable) for all geokrets in user's inventory
Compressing output
- adding gzip=1 swich makes output is compressed with gzip (gzencode), eg:
https://geokrety.org/export2.php?userid=1&inventory=1&gzip=1
Retriving Geokrety information
- trip in JSON: list latest 1000 trip steps for a given Geokrety, eg:
https://geokrety.org/rest/konkret/trip/read.php?id=67914 - trip in CSV: list latest 1000 trip steps for a given Geokrety, eg:
https://geokrety.org/rest/konkret/trip/read.php?id=67914&format=csv - trip in GPX: list latest 1000 trip steps for a given Geokrety, eg:
https://geokrety.org/rest/konkret/trip/read.php?id=67914&format=gpx
Write
this part of API is highly experimental!
(1) secid
Logging of geokrety is possible by passing to appropriate script variable secid via POST method. The secid is 128 characters long string, unique for all users (it should be kept secret like a password). The secid can be obtained by passing variables login and password to the script:
https://geokrety.org/api-login2secid.php
via POST method. If correct login credentials are supplied, the secid is returned.
(2) logging
To log a geokret, you have to pass to the https://geokrety.org/ruchy.php script the secid as well as other data you normally pass via form:
variable | description | example |
---|---|---|
secid | authentication string - see above | |
nr | geokret's tracking code | GH68MA |
formname = 'ruchy' | (must be set this way) | ruchy |
logtype | see logtypeson the top of this document | 0 |
data | the log date YYYY-MM-DD | 2012-12-15 |
godzina | hour HH | 15 |
minuta | minutes MM | 23 |
comment | (optional) comment to the log | It is a good place for this geokret! |
app | (optional) application name, <=16 chars | Locus |
app_ver | (optional) application version, <=16 chars | 1.16dev |
mobile_lang | (optional) error messages language; for list of avaliable languages see here | pl_PL.UTF-8 |
The new position of geokret should be set by one of the following variables:
variable | description | example |
---|---|---|
latlon | latitude and longitude (various formats acceptable) | 52.1534 21.0539 |
wpt | waypoint | OP05E5 |
All those via POST method. After successful logging the geokret, the xml is returned, like in this example.
After successful data submission the "no errors" code is returned along with gk number:
<?xml version="1.0" ?> <gkxml version="1.0" date="2013-01-03 21:29:11"> <errors> <error></error> </errors> <geokrety> <geokret id="27334"/> </geokrety> </gkxml>
If errors occurs, the XML error list is returned in the defined language, eg:
<?xml version="1.0" ?> <gkxml version="1.0" date="2013-01-03 21:13:51"> <errors> <error>Wrong secid</error> <error>Wrond date or time</error> </errors> </gkxml>
If you provide an app name, it would be nice to send us an application icon (16x16, png, eg ), that we could add short info about application in the log entry.
If you have any idea, how to improve this API or any function-request, feel free to contact us!
Sample scripts
Here are sample scripts for using GK api
- pyGK (python)
- phpGK (php)
Note: export*.php has a limit of retrieved data set at 10 days (ie you can download data changed in the past 10 days only). This should be enough to sync local OC nodes or other databases. To get older data check: here.
https://geokrety.org/export2.php
-
Enjoying GeoKrety.org?
If you use GeoKrety.org and have found it helpful, please consider donating.
Your donations help us pay for servers and other costs.