From 3d4f842dd64294064c42ed430b91ff2eee1cfee6 Mon Sep 17 00:00:00 2001 From: TimMcCauley Date: Tue, 24 Apr 2018 13:57:37 +0200 Subject: [PATCH] Example updates in README an Swagger file --- README.md | 107 +++++++++++++++------ openpoiservice/server/api/pois_post.yaml | 113 +++++++++++++++++++++-- 2 files changed, 184 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index aeaa32a..dbe6693 100755 --- a/README.md +++ b/README.md @@ -217,54 +217,101 @@ Finally, `request=list` will return a JSON object generated from ### Examples -##### POIs +##### POIS around a buffered point + ```sh curl -X POST \ http://localhost:5000/pois \ - -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{ - "geometry": { - "geojson": { - "type": "Point", - "coordinates": [8.8034, 53.0756] - }, - "buffer": 50 + "request": "pois", + "geometry": { + "bbox": [ + [8.8034, 53.0756], + [8.7834, 53.0456] + ], + "geojson": { + "type": "Point", + "coordinates": [8.8034, 53.0756] }, - "limit": 2000, - "request": "pois", - "sortby": "distance", - "filters": { - "category_ids": [488], - "wheelchair": ["yes"] - } + "buffer": 250 + } }' ``` -##### POI Statistics +##### POIs of given categories ```sh curl -X POST \ http://localhost:5000/pois \ - -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{ - "geometry": { - "geojson": { - "type": "Point", - "coordinates": [8.8034, 53.0756] - }, - "buffer": 50 + "request": "pois", + "geometry": { + "bbox": [ + [8.8034, 53.0756], + [8.7834, 53.0456] + ], + "geojson": { + "type": "Point", + "coordinates": [8.8034, 53.0756] + }, + "buffer": 100 + }, + "limit": 200, + "filters": { + "category_ids": [180, 245] + } +}' +``` + +##### POIs of given category groups + +```sh +curl -X POST \ + http://localhost:5000/pois \ + -H 'Content-Type: application/json' \ + -d '{ + "request": "pois", + "geometry": { + "bbox": [ + [8.8034, 53.0756], + [8.7834, 53.0456] + ], + "geojson": { + "type": "Point", + "coordinates": [8.8034, 53.0756] + }, + "buffer": 100 + }, + "limit": 200, + "filters": { + "category_group_ids": [160] + } +}' +``` + +##### POI Statistics +```sh +curl -X POST \ + http://129.206.7.157:5005/pois \ + -H 'Content-Type: application/json' \ + -d '{ + "request": "stats", + "geometry": { + "bbox": [ + [8.8034, 53.0756], + [8.7834, 53.0456] + ], + "geojson": { + "type": "Point", + "coordinates": [8.8034, 53.0756] }, - "limit": 2000, - "request": "stats", - "sortby": "distance", - "filters": { - "category_ids": [488] - } + "buffer": 100 + } }' ``` -##### POI Category List +##### POI Categories as a list ```sh curl -X POST \ diff --git a/openpoiservice/server/api/pois_post.yaml b/openpoiservice/server/api/pois_post.yaml index b557aca..8b01b94 100644 --- a/openpoiservice/server/api/pois_post.yaml +++ b/openpoiservice/server/api/pois_post.yaml @@ -3,14 +3,15 @@ tags: - name: "Pois" info: description: | - Returns points of interest in the area surrounding a geometry (geometry and/or bbox). + Returns points of interest in the area surrounding a geometry which can either be a bounding box, polygon or buffered linestring or point. + Find more examples on https://github.com/GIScience/openpoiservice. version: "0.1" title: "Openpoiservice" contact: email: "support@openrouteservice.org" license: name: "MIT" - url: "https://github.com/swagger-api/swagger-ui/blob/master/LICENSE" + url: "https://github.com/GIScience/openpoiservice/blob/master/LICENSE" consumes: - "application/json" schemes: @@ -23,6 +24,101 @@ security: paths: "/pois": post: + description: | + Examples: + ``` + ##### POIS around a buffered point + curl -X POST \ + https://api.openrouteservice.org/pois?api_key=INSERT_YOUR_KEY \ + -H 'Content-Type: application/json' \ + -d '{ + "request": "pois", + "geometry": { + "bbox": [ + [8.8034, 53.0756], + [8.7834, 53.0456] + ], + "geojson": { + "type": "Point", + "coordinates": [8.8034, 53.0756] + }, + "buffer": 250 + } + }' + + ##### POIs of given categories + curl -X POST \ + https://api.openrouteservice.org/pois?api_key=INSERT_YOUR_KEY \ + -H 'Content-Type: application/json' \ + -d '{ + "request": "pois", + "geometry": { + "bbox": [ + [8.8034, 53.0756], + [8.7834, 53.0456] + ], + "geojson": { + "type": "Point", + "coordinates": [8.8034, 53.0756] + }, + "buffer": 100 + }, + "limit": 200, + "filters": { + "category_ids": [180, 245] + } + }' + + ##### POIs of given category groups + curl -X POST \ + https://api.openrouteservice.org/pois?api_key=INSERT_YOUR_KEY \ + -H 'Content-Type: application/json' \ + -d '{ + "request": "pois", + "geometry": { + "bbox": [ + [8.8034, 53.0756], + [8.7834, 53.0456] + ], + "geojson": { + "type": "Point", + "coordinates": [8.8034, 53.0756] + }, + "buffer": 100 + }, + "limit": 200, + "filters": { + "category_group_ids": [160] + } + }' + + ##### POI Statistics + curl -X POST \ + https://api.openrouteservice.org/pois?api_key=INSERT_YOUR_KEY \ + -H 'Content-Type: application/json' \ + -d '{ + "request": "stats", + "geometry": { + "bbox": [ + [8.8034, 53.0756], + [8.7834, 53.0456] + ], + "geojson": { + "type": "Point", + "coordinates": [8.8034, 53.0756] + }, + "buffer": 100 + } + }' + + ##### POI Categories as a list + curl -X POST \ + https://api.openrouteservice.org/pois?api_key=INSERT_YOUR_KEY \ + -H 'content-type: application/json' \ + -d '{ + "request": "list" + }' + ``` parameters: - name: "api_key" in: "query" @@ -77,10 +173,15 @@ definitions: example: { "request": "pois", "geometry": { - "bbox": [ - [8.74189636230469, 53.07144289415349], - [8.814767341613771, 53.091060308703845] - ] + "bbox": [ + [8.458614349365236, 55.470054514892844], + [8.473613262176515, 55.47323501110393] + ], + "geojson": { + "type": "Point", + "coordinates": [8.458614349365236, 55.470054514892844] + }, + "buffer": 100 }, "limit": 200 }