Web API v2

Discussion about the Geocaching Australia web site
User avatar
caughtatwork
Posts: 17015
Joined: 17 May 04 12:11 pm
Location: Melbourne
Contact:

Post by caughtatwork » 15 November 08 9:13 am

The last post in this thread http://forum.geocaching.com.au/viewtopi ... &start=120 has a function to return the closest 50 caches.

Guest

Post by Guest » 15 November 08 9:47 am

The problem I'm trying to solve is when there is no coverage, but still be as useful as if there was coverage.

I'm half toying with the idea of importing all GA locations, although I'd import it on a PC then do a memory dump and import the memory dump to the handheld, after that just do updates on the hand held.

Although the code I have working now would be able to import all locations but would just be slow.

Guest

Post by Guest » 15 November 08 9:56 am

caughtatwork wrote:The last post in this thread http://forum.geocaching.com.au/viewtopi ... &start=120 has a function to return the closest 50 caches.
Yup but that's in the browser, I'm trying to get away from it too, no matter how many times you OK the site to get your location, each new page view annoys you again.

User avatar
caughtatwork
Posts: 17015
Joined: 17 May 04 12:11 pm
Location: Melbourne
Contact:

Post by caughtatwork » 15 November 08 3:01 pm

It could always be xml'ified if you wanted.

Guest

Post by Guest » 15 November 08 4:21 pm

caughtatwork wrote:It could always be xml'ified if you wanted.
xml is so bloated, this is why I originally posted about JSON ;)

Some speculate JSON could be parsed up to 100x quicker than XML, which on a handheld would be a very good thing! ;)

I'm guessing you nearly have to get all the info into some kind of array to output it into XML formatting anyway, but yea...

However I think I asked for this in another thread a while back, and got pointed to the gmap stuff which is good enough anyway, combined with a changelog of all of Australia and some liberal string comparing things are ok on that front.

User avatar
caughtatwork
Posts: 17015
Joined: 17 May 04 12:11 pm
Location: Melbourne
Contact:

Post by caughtatwork » 15 November 08 8:26 pm

http://www.json.org/example.html

Doesn't seem too bloated, but there you go I suppose.

Guest

Post by Guest » 15 November 08 9:07 pm

caughtatwork wrote:http://www.json.org/example.html

Doesn't seem too bloated, but there you go I suppose.
That's expanded out, also XML should be verified against a schema blah blah.

How about a more real example, random GPX file:

http://geocaching.com.au/cache/ga1214.gpx

and the json: (I only did 2 logs because I was building the array by hand, seemed like a good idea at the time, next time I'll code something to do it)

{"creator":"Geocaching Australia","url":"http://geocaching.com.au","time":"2008-09-12T00:00:00.000Z","lat":-35.315,"lon":149.146717,"name":"GA1214","desc":"PARK GYPSY","status":"Available","owner":"MC KENNA","locale":"Kingston","state":"Australian Capital Territory","country":"Australia","type":"Other","container":"Small","difficulty":2,"terrain":1,"summary":"SMALL SYSTEMA CONTAINER","description":"&p&&span style=&font-size: medium&&&span style=&color: #333399&&&span style=&font-family: Comic Sans MS&&The PARK GYPSY lives in a very pretty park and as her home has no wheels she hopes that our geocaching community will place her in different places with in the park. (please do not take her from the park)  There are Black Swans watching over her and also many apartments so care must be taken not to disclose her whereabouts to the local muggle population. A lot of fun and creativity can be had placing the gypsy. Please do not post pictures of the Park Gypsy in your log but feel free to email them to me so I can see where she travels.&/span&&/span&&/span&&/p&nn&p&&span style=&font-size: medium&&&span style=&color: #333399&&&span style=&font-family: Comic Sans MS&&If you move her please post her new co-ordinates with haste allowing her to be found and moved on by the  next cachers. But remember she must stay in this park!&/span&&/span&&/span&&/p&nn&p&&span style=&font-size: medium&&&span style=&color: #333399&&&span style=&font-family: Comic Sans MS&&If you can't find her please drop me an email or text øiør røa nbu  and I can send a picture of her home and you might by chance stumble across it. &/span&&/span&&/span&&/p&nn&p&&span style=&font-size: medium&&&span style=&color: #333399&& &/span&&/span&&/p&nn&p&&span style=&font-size: medium&&&span style=&color: #333399&&&span style=&font-size: large&&&font size=&4&&CHECK LOGS FOR UP TO DATE CO-ORDINATES!!!&/font&&/span&&/span&&/span&&/p&nn&p& &/p&","licence":"","0":{"time":"2008-10-31T00:00:00Z","geocacher":"urch","type":"Found","text":"Oops, I think I am supposed to log this as a 'found' before I logged it as 'moved'."},"1":{"time":"2008-10-31T00:00:00Z","geocacher":"urch","type":"Waypoint","text":"This is a great hide - would blend in very well with the environment back in WA! Moved a little further. Thanks for the hunt, MC KENNA","lat":-35.315,"lon":149.146717}}

Guest

Post by Guest » 16 November 08 4:32 am

Don't know if it's over sight or not, but there is a lot of caches in the GPX file listed as "Other" but show up on the website as Locationless for example.

http://geocaching.com.au/cache/ga1002
http://geocaching.com.au/cache/ga1002.gpx

Yes I realise the location is given as locationless, but it'd be nice to be able to parse the cache type field and be able to display a suitable icon etc.

User avatar
caughtatwork
Posts: 17015
Joined: 17 May 04 12:11 pm
Location: Melbourne
Contact:

Post by caughtatwork » 16 November 08 10:31 am

Fixed.

User avatar
ideology
Posts: 2763
Joined: 28 March 03 4:01 pm
Location: Sydney
Contact:

Post by ideology » 16 November 08 11:32 am

careful! you'll have robert lipe of gpsbabel sending you death threats because gca gpx files won't validate! we also don't know how applications like gsak will now treat this

validation: each gca gpx file refers to the schema at http://geocaching.com.au/geocache/1/geocache.xsd the shema tells third party programs how to interpret the gpx file. type enumeration tells the third party program that the file will only contain particular types of data. in gca's case, we put in type enumeration so that developers didn't have to update their software every time we invented a new cache type. from dim memory, we recall that gc.com didn't have a locationless type, and we didn't really have the market power to ask clyde or other developers to include it just for gca, so we mapped locationless into "other," which was supported by third party applications. validation is important because it allows third party developers to read the gpx file correctly. robert lipe of gpsbabel was particularly insistent that we get it right because he is trying to support so many formats, but so few developers implement them correctly that it makes his life miserable coding around the exceptions, especially when the exceptions move with time! anyway, putting in "locationless" now breaks that validation and may break gpsbabel and potentially other applications that read gpx.

gsak: probably the main software that reads gca gpx files is gsak. it would be worthwhile testing to see what gsak does with a type of "locationless" before putting this into production. if it doesn't work, perhaps clyde would be kind enough to support it

if we wish to include "locationless", to be technically correct, we should bump the gpx schema to the next version and possibly post to the gps-stash mailing list to say that we've bumped the version. or even better, telling them we're considering bumping the version and call for input. the idea was that we could support a free and open namespace unlike gc.com which embeds its business name through the schema!

Guest

Post by Guest » 16 November 08 12:55 pm

ideology wrote:careful! you'll have robert lipe of gpsbabel sending you death threats because gca gpx files won't validate! we also don't know how applications like gsak will now treat this
Ain't XML grand ;)

On a more serious note, surely there has to be some kind of middle ground here, because simply putting other for every type of cache not listed in a schema is pointless from my, and anyone else, making 3rd party software that makes use of the GPX files from you guys.

*ponders* have I mentioned lately my absolute loathing for XML? :)

http://www.groundspeak.com/cache/1/0/cache.xsd

PS is there a particular reason you include license tags, but always leave them empty, not worried, just curious.

User avatar
ideology
Posts: 2763
Joined: 28 March 03 4:01 pm
Location: Sydney
Contact:

Post by ideology » 16 November 08 1:10 pm

yes you have mentioned your loathing for xml many times, however:
1. this is not an xml issue: we deliberately decided to strongly enumerate the options. xml quite happily supports non-enumerated types
2. it is not pointless: it was done to keep compatibility with other software that reads gpx files as mentioned above.

there could be some middle ground in that the gca gpx files could include two types: an enumerated type which maintains compatibility with existing software and a free-text type which can be parsed by the client software. however, as stated above we think a better approach would be to consult the developers of existing third party software (especially clyde whose gsak probably has the most usage) and seek their input as to how support more types.

Guest

Post by Guest » 16 November 08 1:36 pm

ideology wrote:yes you have mentioned your loathing for xml many times, however:
tee hee hee ;) They say it's good to vent, rather than bottling it up ;)
there could be some middle ground in that the gca gpx files could include two types: an enumerated type which maintains compatibility with existing software and a free-text type which can be parsed by the client software. however, as stated above we think a better approach would be to consult the developers of existing third party software (especially clyde whose gsak probably has the most usage) and seek their input as to how support more types.
I'm not sure how you guys are storing the data, but the app I'm writing is actually converting from names to an int, would like to do the same thing to a few other fields, but first things first, currently using geocache.com's int values as a base.

2, 3, 4, 5, 6, 8, 9, 11, 12, 13, 137, 453, 1858 with 12 being locationless.

Guest

Post by Guest » 16 November 08 3:25 pm

Short of screen scraping, I doubt there is anything, other than user comments, that indicates this is a movable cache.

http://geocaching.com.au/cache/ga1184.gpx

I'm sure there is going to be others too, is there an easy solution to this by adding a second field with 'free' text or something?

User avatar
ideology
Posts: 2763
Joined: 28 March 03 4:01 pm
Location: Sydney
Contact:

Post by ideology » 16 November 08 3:50 pm

this issue will apply to any type of cache not listed in the schema, ie moveable, cito, wherigo, other, podcache, earthcache, unknown/mystery and letterbox.

for the third time: we don't want to quickly put in a free text string because it might break compatibility with software such as gsak. this type of change should be worked through and agreed by multiple developers before being put into production. it may well be that it doesn't break gsak, but to our knowledge nobody has tested it.

Post Reply