Skip to content

Instantly share code, notes, and snippets.

@stefanocudini
Last active September 7, 2023 15:27
Show Gist options
  • Save stefanocudini/77f36db813997e057d3fd163cbe04a73 to your computer and use it in GitHub Desktop.
Save stefanocudini/77f36db813997e057d3fd163cbe04a73 to your computer and use it in GitHub Desktop.
geopocker api rest endpoints

API Rest endpoints

The API is work in progress. This basic structure can be extended starting from the environment variable PREFIX which by default /

(✔️ Work ❌ TODO 🚧 Work in Progress)

Status Method Path Return Description
✔️ GET / html default demo map page if enabled by env var DEMO_PAGE=true
✔️ GET /status object service status, versions, datasets
✔️ GET /datasets array list available datasets and their attributes
✔️ GET /datasets/:datasetId object search dataset by id
✔️ GET /datasets/:lon/:lat array search dataset contains lon,lat
✔️ GET /:datasetId object show attributes of a certain dataset by id
✔️ GET /:datasetId/:lon/:lat array get single location value of dataset, densify not supported
✔️ GET /:datasetId/:locations array locations is a string (format: `lon,lat
✔️ POST /:datasetId/lonlat arrays accept array or object in body
✔️ POST /:datasetId/locations arrays accept array or object of locations in body (format is [[lon,lat],[lon,lat],[lon,lat]])
✔️ POST /:datasetId/geometry object geojson Point or LineString in body (support feature/geometry/f.collection)
✔️ GET /metadata/:locations object return info about direction, length, centroid, middlepoint of locations
✔️ POST /metadata/geometry object return info about direction, length, centroid, middlepoint of geometry

Global Parameters

Status Parameter Default Description
✔️ precision input rounded to digits decimal precision
✔️ format input output format conversion
✔️ densify input enable densification of points in the result
✔️ simplify input enable simplication geometry of the result
height false add vertical distance from the ground(only input has elevation)

Some behaviors to know about parameters are that:

  • precision and densify parameters is only supported by endpoints and formats that return coordinates
  • datasetId can have the value default to referring the main dataset defined in config
  • from version v1.6.1 /<datasetId>/... is the same of /datasets/<datasetId>/... /datasets/ is implicit.

Formats

If the format parameter is not specified the default behavior is to output the same format as the input

  • input format can be specified by Content-type: header in request
  • output format can be specified by format parameter

the support for various input and output formats is summarized in the table

Value In Out Description
input ✔️ ✔️ means the same format as the input data
array ✔️ 🚧 each location is Array and a Z dimension as value [lon,lat,val]
json ✔️ 🚧 each location is Object having lon,lat and val attributes
geojson ✔️ 🚧 standard GeoJSON objects Feature, Geometry with a Z dimension in coordinates as value
polyline 🚧 ✔️ Encoded Polyline Algorithm
gpx 🚧 ✔️ GPS eXchange Format is an XML textual format
csv Comma-separated values is an textual format
kml Keyhole Markup Language is an XML format for Google Earth

each endpoint has its own default format, for example endpoint /dataset/lon/lat return a simple array of one value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment