Skip to content

Instantly share code, notes, and snippets.

@CliffordAnderson
Forked from Ramona2020/Single-Feature.xq
Created February 7, 2016 01:46
Show Gist options
  • Save CliffordAnderson/c15f3a05bc780abf35ff to your computer and use it in GitHub Desktop.
Save CliffordAnderson/c15f3a05bc780abf35ff to your computer and use it in GitHub Desktop.
Single Feature
let $uri := fn:encode-for-uri( "http://bioimages.vanderbilt.edu/vanderbilt/7-314#2002-06-14")
let $json := fetch:text("http://api.gbif.org/v1/occurrence/search?occurrenceID=" || $uri)
let $json := fn:parse-json($json)
let $latitude := $json?results?1?decimalLatitude
let $longitude := $json?results?1?decimalLongitude
let $identifier := $json?results?1?identifier
return map {
"type": "Feature",
"geometry": map {
"type": "Point",
"coordinates": [$longitude, $latitude]
},
"properties": map {
"name": $identifier
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment