Opened 9 years ago

Closed 8 years ago

#5338 closed enhancement (wontfix)

GeoJSON driver handle output from opencaching.com api HTTP requests

Reported by: khicks Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: 1.10.1
Severity: normal Keywords: geojson
Cc:

Description

It would be great if GeoJSON driver would support the output returned from the opencaching api (opencaching.com). It does use the REST webservice (see http://www.opencaching.com/api_doc/) and GDAL does retrieve the data OK when I send it the http request.

The data must be formatted slightly different then what gdal expects though as it says it can't read it. One thing I noted when going through the debugger is it expects '{' as the first character whereas the json text returned from the api surrounds the complete text with []. Even after removing the [] it still didn't work though.

I am currently getting around it by creating a temporary gpx file as the api also supports returning that but it would of course be handy not to have to do that step.

Attachments (1)

geocaches.json (3.2 KB ) - added by khicks 9 years ago.
json text retuned

Download all attachments as: .zip

Change History (8)

comment:1 by warmerdam, 9 years ago

Could you attach the json string returned by the opencaching api?

comment:2 by warmerdam, 9 years ago

Component: defaultOGR_SF
Keywords: geojson added

comment:3 by khicks, 9 years ago

Here is an example of what's returned as requested:

[{"name":"See?","location":{"lat":49.0456,"lon":-122.8181333},"type":"Unknown Cache","size":2.8,"description":"","tags":[],"status":"Active","terrain":2.5,"difficulty":2.0,"hint":null,"awesomeness":3.0,"found":null,"votes":null,"series":null,"images":[],"logs":[],"verification":{"number":false,"chirp":null,"qr":false,"code_phrase":null},"region":{"state":"BC","country":"Canada","county":"Greater Vancouver","city":"Surrey","postal":"V4A"},"oxcode":"OX14TK5","hidden_by":{"name":"KnL_Caching","id":"71291"},"hidden":1326215984000,"last_updated":1326216153000,"last_found":1343545200000,"review_start":null,"log_code_required":false,"tag_votes":[]},{"name":"Got Wind?","location":{"lat":49.0372833,"lon":-122.8141167},"type":"Unknown Cache","size":2.1,"description":"","tags":[],"status":"Active","terrain":1.6,"difficulty":1.7,"hint":null,"awesomeness":2.9,"found":null,"votes":null,"series":null,"images":[],"logs":[],"verification":{"number":false,"chirp":null,"qr":false,"code_phrase":null},"region":{"state":"BC","country":"Canada","county":"Greater Vancouver","city":"Surrey","postal":"V4A"},"oxcode":"OX15JAM","hidden_by":{"name":"KnL_Caching","id":"71291"},"hidden":1324488928000,"last_updated":1324489116000,"last_found":1372489200000,"review_start":null,"log_code_required":false,"tag_votes":[]},{"name":"Byker Grove","location":{"lat":49.0420167,"lon":-122.8183},"type":"Traditional Cache","size":2.5,"description":"","tags":[],"status":"Active","terrain":1.7,"difficulty":2.2,"hint":null,"awesomeness":2.7,"found":null,"votes":null,"series":null,"images":[],"logs":[],"verification":{"number":false,"chirp":null,"qr":false,"code_phrase":null},"region":{"state":"BC","country":"Canada","county":"Greater Vancouver","city":"Surrey","postal":"V4A"},"oxcode":"OXX1WR","hidden_by":{"name":"KnL_Caching","id":"71291"},"hidden":1325372123000,"last_updated":1325372194000,"last_found":1363635306000,"review_start":null,"log_code_required":false,"tag_votes":[]},{"name":"xmasevekids1","location":{"lat":49.0463333,"lon":-122.8203889},"type":"Traditional Cache","size":3.1,"description":"","tags":Exclusive,"status":"Active","terrain":2.4,"difficulty":3.3,"hint":null,"awesomeness":3.0,"found":null,"votes":null,"series":null,"images":[],"logs":[],"verification":{"number":false,"chirp":null,"qr":false,"code_phrase":null},"region":{"state":"BC","country":"Canada","county":"Greater Vancouver","city":"Surrey","postal":"V4A"},"oxcode":"OXZTB41","hidden_by":{"name":"Smac4616","id":"168257"},"hidden":1356387735000,"last_updated":1356888967000,"last_found":1360623545000,"review_start":null,"log_code_required":false,"tag_votes":[]},{"name":"Byker Grove II","location":{"lat":49.0404667,"lon":-122.8197333},"type":"Traditional Cache","size":3.0,"description":"","tags":[],"status":"Active","terrain":2.5,"difficulty":2.2,"hint":null,"awesomeness":3.0,"found":null,"votes":null,"series":null,"images":[],"logs":[],"verification":{"number":false,"chirp":null,"qr":false,"code_phrase":null},"region":{"state":"BC","country":"Canada","county":"Greater Vancouver","city":"Surrey","postal":"V4A"},"oxcode":"OXXGMB","hidden_by":{"name":"KnL_Caching","id":"71291"},"hidden":1326215761000,"last_updated":1326215785000,"last_found":1360625638000,"review_start":null,"log_code_required":false,"tag_votes":[]}]

by khicks, 9 years ago

Attachment: geocaches.json added

json text retuned

comment:4 by khicks, 9 years ago

I've attached a file which might be easier then using previous comment. Also note that the json driver doesn't seem to like the data as a file either.

comment:5 by warmerdam, 9 years ago

I checked the file quickly, and the schema is not in any way similar to GeoJSON other than that it is JSON. The structure is an array of objects which contain a "location" attribute along with a variety of other attributes. It feels to me like this would be a distinct JSON based driver rather than a slight adaption of the GeoJSON driver.

[
    {
        "awesomeness": 3.0,
...
        "last_updated": 1326216153000,
        "location": {
            "lat": 49.0456,
            "lon": -122.8181333
        },

I have no plans to implement it.

comment:6 by khicks, 9 years ago

I understand. Thanks for checking it out - I wasn't sure how similar it might be. I will stick with using the gpx file method.

comment:7 by Jukka Rahkonen, 8 years ago

Resolution: wontfix
Status: newclosed

Closing as wontfix.

Note: See TracTickets for help on using tickets.