From ced95f8ecc39190967c6b9cdc5eb5f14e7f67658 Mon Sep 17 00:00:00 2001 From: TimMcCauley Date: Tue, 24 Apr 2018 14:28:16 +0200 Subject: [PATCH 1/4] Adds encoding to content-type headers, closes #25 --- openpoiservice/server/api/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openpoiservice/server/api/views.py b/openpoiservice/server/api/views.py index 7ac2fad..d59b05d 100755 --- a/openpoiservice/server/api/views.py +++ b/openpoiservice/server/api/views.py @@ -100,7 +100,8 @@ def places(): raise api_exceptions.InvalidUsage(str(error), status_code=401) # query stats if all_args['request'] == 'list': - return jsonify(categories_tools.categories_object) + r = Response(json.dumps(categories_tools.categories_object), mimetype='application/json; charset=utf-8') + return r if 'filters' in all_args and 'category_group_ids' in all_args['filters']: all_args['filters']['category_ids'] = categories_tools.unify_categories(all_args['filters']) @@ -123,9 +124,8 @@ def places(): features["information"] = query_info # query pois - return Response(json.dumps(features), mimetype='application/json') - # cant use jsonify directly for tests, error since upgrade python36, wtf? - # return jsonify(request_pois(all_args)) + r = Response(json.dumps(features), mimetype='application/json; charset=utf-8') + return r else: From f47c45784b3953c8dc148e60a871e2e8ce876e53 Mon Sep 17 00:00:00 2001 From: TimMcCauley Date: Wed, 25 Apr 2018 14:22:38 +0200 Subject: [PATCH 2/4] Adds internal error codes, closes #15 --- openpoiservice/server/api/__init__.py | 13 +++ openpoiservice/server/api/api_exceptions.py | 30 ++--- openpoiservice/server/api/pois_post.yaml | 31 +++-- openpoiservice/server/api/views.py | 123 +++++++++++--------- 4 files changed, 113 insertions(+), 84 deletions(-) diff --git a/openpoiservice/server/api/__init__.py b/openpoiservice/server/api/__init__.py index fb86a20..6bd86e5 100644 --- a/openpoiservice/server/api/__init__.py +++ b/openpoiservice/server/api/__init__.py @@ -1 +1,14 @@ # openpoiservice/server/api/__init__.py + +error_codes = { + 4000: 'Invalid JSON object in request', + 4001: 'Category or category group ids missing', + 4002: 'Geometry is missing', + 4003: 'Bounding box and or geojson not present in request', + 4004: 'Buffer is missing', + 4005: 'Geometry length does not meet the restrictions', + 4006: 'Unsupported HTTP method', + 4007: 'GeoJSON issue', + 4008: 'Geometry size does not meet the restrictions', + 4099: 'Unknown internal error' +} diff --git a/openpoiservice/server/api/api_exceptions.py b/openpoiservice/server/api/api_exceptions.py index a6fb422..dfbdb22 100644 --- a/openpoiservice/server/api/api_exceptions.py +++ b/openpoiservice/server/api/api_exceptions.py @@ -1,15 +1,10 @@ +from openpoiservice.server.api import error_codes + + class InvalidUsage(Exception): - status_code = 400 - def __init__(self, message, status_code=None, payload=None): + def __init__(self, status_code=500, error_code=None, message=None): """ - INVALID_JSON_FORMAT = 400 - MISSING_PARAMETER = 401 - INVALID_PARAMETER_FORMAT = 402 - INVALID_PARAMETER_VALUE = 403 - PARAMETER_VALUE_EXCEEDS_MAXIMUM = 404 - UNKNOWN = 499 - :param message: custom message :type message: string @@ -22,13 +17,20 @@ def __init__(self, message, status_code=None, payload=None): # type: (object, object, object) -> object Exception.__init__(self) - self.message = message + if status_code is not None: self.status_code = status_code - self.payload = payload + + if message is None: + message = error_codes[error_code] + else: + message = message + + self.error = { + "code": error_code, + "message": message + } def to_dict(self): - rv = dict(self.payload or ()) - rv['message'] = self.message + rv = dict(self.error or ()) return rv - diff --git a/openpoiservice/server/api/pois_post.yaml b/openpoiservice/server/api/pois_post.yaml index 8b01b94..e3e1638 100644 --- a/openpoiservice/server/api/pois_post.yaml +++ b/openpoiservice/server/api/pois_post.yaml @@ -141,26 +141,33 @@ paths: #- $ref: '#/definitions/LocationsBodyList' responses: 200: - description: Standard response for successfully processed requests. + description: "Standard response for successfully processed requests." schema: $ref: '#/definitions/LocationsPoiResponse' # oneOf: #- $ref: '#/definitions/LocationsPoiResponse' #- $ref: '#/definitions/LocationsStatsResponse' #- $ref: '#/definitions/LocationsListResponse' - 400: - description: Unable to parse JSON request. 401: - description: Required parameter is missing. - 402: - description: Invalid parameter format. + description: "Authorization field missing." 403: - description: Invalid parameter value. - 404: - description: Parameter value exceeds the maximum allowed limit. - 499: - description: Unknown internal error. - + description: "Key not authorised." + 500: + description: | + An unexpected error was encountered and more detailed internal + errorcode is provided. + | Internal Code | Description | + |:-------------:|----------------------------------------------------| + | 4000 | Invalid JSON object in request | + | 4001 | Category or category group ids missing | + | 4002 | Geometry is missing | + | 4003 | Bounding box and or geojson not present in request | + | 4004 | Buffer is missing | + | 4005 | Geometry length does not meet the restrictions | + | 4006 | Unsupported HTTP method | + | 4007 | GeoJSON parsing error | + | 4008 | Geometry size does not meet the restrictions | + | 4099 | Unknown internal error | securityDefinitions: UserSecurity: name: "api_key" diff --git a/openpoiservice/server/api/views.py b/openpoiservice/server/api/views.py index d59b05d..6c05a29 100755 --- a/openpoiservice/server/api/views.py +++ b/openpoiservice/server/api/views.py @@ -13,6 +13,7 @@ import json import copy + # from flasgger import validate @@ -41,12 +42,13 @@ def custom_schema(): Optional('category_group_ids'): Required( All(categories_tools.category_group_ids, Length(max=ops_settings['maximum_categories'])), - msg='Must be one of {}'.format( - categories_tools.category_group_ids)), + msg='Must be one of {} and have a maximum amount of {}'.format( + categories_tools.category_group_ids, ops_settings['maximum_categories'])), Optional('category_ids'): Required( All(categories_tools.category_ids, Length(max=ops_settings['maximum_categories'])), - msg='Must be one of {}'.format(categories_tools.category_ids)), + msg='Must be one of {} and have a maximum amount of {}'.format(categories_tools.category_ids, + ops_settings['maximum_categories'])), Optional('address'): Required(Boolean(Coerce(str)), msg='Must be true or false'), @@ -92,12 +94,12 @@ def places(): raw_request = copy.deepcopy(all_args) if all_args is None: - raise api_exceptions.InvalidUsage('Invalid JSON object in request', status_code=400) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4000) try: schema(all_args) except MultipleInvalid as error: - raise api_exceptions.InvalidUsage(str(error), status_code=401) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4000, message=str(error)) # query stats if all_args['request'] == 'list': r = Response(json.dumps(categories_tools.categories_object), mimetype='application/json; charset=utf-8') @@ -110,7 +112,7 @@ def places(): all_args['limit'] = ops_settings['response_limit'] if 'geometry' not in all_args: - raise api_exceptions.InvalidUsage('Geometry missing', status_code=401) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4002) are_required_geom_present(all_args['geometry']) @@ -129,7 +131,7 @@ def places(): else: - raise api_exceptions.InvalidUsage('HTTP request not supported.', status_code=499) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4006) def request_pois(all_args): @@ -151,7 +153,7 @@ def are_required_keys_present(filters): :param filters: Request parameters from get or post request """ if 'category_group_ids' not in filters and 'category_ids' not in filters: - raise api_exceptions.InvalidUsage('Category or category group ids missing', status_code=401) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4001) def are_required_geom_present(geometry): @@ -160,16 +162,28 @@ def are_required_geom_present(geometry): :param geometry: Geometry parameters from post request """ if 'geojson' not in geometry and 'bbox' not in geometry: - raise api_exceptions.InvalidUsage('Bounding box and or geojson not present in request', - status_code=401) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4003) def check_for_buffer(geometry, maximum_search_radius): if 'buffer' not in geometry: - raise api_exceptions.InvalidUsage('Buffer is missing', status_code=404) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4004) if not validate_limit(int(geometry['buffer']), maximum_search_radius): - raise api_exceptions.InvalidUsage('Maximum restrictions reached', status_code=404) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4008) + + +def check_validity(geojson): + """ + Checks if geojson is valid, throws exception otherwise. + :param geojson: geojson object + :return: will return the geo + """ + if geojson.is_valid: + return geojson + else: + raise api_exceptions.InvalidUsage(status_code=500, error_code=4007, message='{} {}'.format( + "geojson", geojson.is_valid)) def parse_geometries(geometry): @@ -187,17 +201,17 @@ def parse_geometries(geometry): s = json.dumps(geometry['geojson']) # Convert to geojson.geometry - g1 = geojson.loads(s) + try: + g1 = geojson.loads(s) + except ValueError as e: + raise api_exceptions.InvalidUsage(status_code=500, error_code=4007, message=str(e)) + # Feed to shape() to convert to shapely.geometry.polygon.Polygon # This will invoke its __geo_interface__ (https://gist.github.com/sgillies/2217756) try: g2 = shape(g1) except ValueError as e: - raise api_exceptions.InvalidUsage(str(e), - status_code=401) - except AttributeError as e: - raise api_exceptions.InvalidUsage(str(e), - status_code=401) + raise api_exceptions.InvalidUsage(status_code=500, error_code=4007, message=str(e)) # parse geom if valid geojson_obj = check_validity(g2) @@ -212,54 +226,47 @@ def parse_geometries(geometry): length = transform_geom(geojson_obj, 'epsg:4326', 'epsg:3857').length if length > ops_settings['maximum_linestring_length']: raise api_exceptions.InvalidUsage( - 'Your linestring geometry is too long ({} meters), check the server restrictions.'.format( - length), - status_code=404) + status_code=500, error_code=4005, + message='Your linestring geometry is too long ({} meters), check the server restrictions.'.format( + length)) - elif geojson_obj.geom_type == 'Polygon': + elif geojson_obj.geom_type == 'Polygon': - check_for_buffer(geometry, ops_settings['maximum_search_radius_for_polygons']) + check_for_buffer(geometry, ops_settings['maximum_search_radius_for_polygons']) - # check if area not too large - area = transform_geom(geojson_obj, 'epsg:4326', 'epsg:3857').area - if area > ops_settings['maximum_area']: - raise api_exceptions.InvalidUsage( - 'Your polygon geometry is too large ({} square meters), check the server restrictions.'.format( - area), - status_code=404) + # check if area not too large + area = transform_geom(geojson_obj, 'epsg:4326', 'epsg:3857').area + if area > ops_settings['maximum_area']: + raise api_exceptions.InvalidUsage( + message='Your polygon geometry is too large ({} square meters), check the server ' + 'restrictions.'.format(area), + status_code=500, error_code=4008) - else: - # type not supported - raise api_exceptions.InvalidUsage('GeoJSON type {} not supported'.format(geojson_obj.geom_type), - status_code=401) + else: + # type not supported + raise api_exceptions.InvalidUsage(error_code=4007, + message='GeoJSON type {} not supported'.format(geojson_obj.geom_type), + status_code=500) - geometry['geom'] = geojson_obj + geometry['geom'] = geojson_obj - # parse bbox, can be provided additionally to geometry - if 'bbox' in geometry: - geojson_obj = MultiPoint(parse_geometry(geometry['bbox'])) - geometry['bbox'] = check_validity(geojson_obj).envelope + # parse bbox, can be provided additionally to geometry + if 'bbox' in geometry: - # print(geometry['bbox'].wkt) + try: + geojson_obj = MultiPoint(parse_geometry(geometry['bbox'])) + except ValueError as e: + raise api_exceptions.InvalidUsage(status_code=500, error_code=4007, message=str(e)) - # check if area not too large - area = transform_geom(geometry['bbox'], 'epsg:4326', 'epsg:3857').area - if area > ops_settings['maximum_area']: - raise api_exceptions.InvalidUsage( - 'Your polygon geometry is too large ({} square meters), check the server restrictions.'.format( - area), - status_code=404) + geometry['bbox'] = check_validity(geojson_obj).envelope - return geometry + # print(geometry['bbox'].wkt) + # check if area not too large + area = transform_geom(geometry['bbox'], 'epsg:4326', 'epsg:3857').area + if area > ops_settings['maximum_area']: + raise api_exceptions.InvalidUsage(error_code=4008, status_code=500, + message='Your polygon geometry is too large ({} square meters), ' + 'check the server restrictions.'.format(area)) -def check_validity(geojson): - """ - Checks if geojson is valid, throws exception otherwise. - :param geojson: geojson object - :return: will return the geo - """ - if geojson.is_valid: - return geojson - else: - raise api_exceptions.InvalidUsage('{} {}'.format("geojson", geojson.is_valid), status_code=401) + return geometry From 67bbf48b993c942912d0ca5e76050c4306bada5b Mon Sep 17 00:00:00 2001 From: TimMcCauley Date: Fri, 4 May 2018 16:48:12 +0200 Subject: [PATCH 3/4] docs edits --- .../openpoiservice/server/api/pois_post.yaml | 337 ---------------- openpoiservice/server/api/pois_post.yml | 365 ------------------ openpoiservice/server/ops_settings.yml | 1 + 3 files changed, 1 insertion(+), 702 deletions(-) delete mode 100644 blob/master/openpoiservice/server/api/pois_post.yaml delete mode 100644 openpoiservice/server/api/pois_post.yml diff --git a/blob/master/openpoiservice/server/api/pois_post.yaml b/blob/master/openpoiservice/server/api/pois_post.yaml deleted file mode 100644 index 6405dd2..0000000 --- a/blob/master/openpoiservice/server/api/pois_post.yaml +++ /dev/null @@ -1,337 +0,0 @@ -swagger: "2.0" -tags: -- name: "Pois" -info: - description: | - Returns points of interest in the area surrounding a geometry (geometry and/or bbox). - version: "0.1" - title: "Openpoiservice" - contact: - email: "support@openrouteservice.org" - license: - name: "MIT" - url: "https://github.com/swagger-api/swagger-ui/blob/master/LICENSE" -consumes: -- "application/json" -schemes: -- "https" -produces: -- "application/json" -host: "api.openrouteservice.org" -security: -- UserSecurity: [api_key] -paths: - "/pois": - post: - parameters: - - name: "api_key" - in: "query" - description: | - Insert your API Key here. - type: "string" - required: true - default: "your-api-key" - - in: body - name: "body" - required: true - description: body for a post request - schema: - $ref: '#/definitions/LocationsBodyPois' - # this does not work yet.. - # https://swagger.io/docs/specification/describing-request-body/ - # oneOf: - #- $ref: '#/definitions/LocationsBodyPois' - #- $ref: '#/definitions/LocationsBodyStats' - #- $ref: '#/definitions/LocationsBodyList' - responses: - 200: - description: Standard response for successfully processed requests. - schema: - $ref: '#/definitions/LocationsPoiResponse' - # oneOf: - #- $ref: '#/definitions/LocationsPoiResponse' - #- $ref: '#/definitions/LocationsStatsResponse' - #- $ref: '#/definitions/LocationsListResponse' - 400: - description: Unable to parse JSON request. - 401: - description: Required parameter is missing. - 402: - description: Invalid parameter format. - 403: - description: Invalid parameter value. - 404: - description: Parameter value exceeds the maximum allowed limit. - 499: - description: Unknown internal error. - -securityDefinitions: - UserSecurity: - name: "api_key" - description: | - Add your API Key as the value of the api_key parameter to your request. - type: "apiKey" - in: "query" -definitions: - LocationsBodyPois: - example: "{1: 1}" - type: object - required: - - request - - geometry - properties: - request: - type: string - example: pois - geometry: - type: object - properties: - buffer: - $ref: "#/definitions/buffer" - bbox: - $ref: "#/definitions/bbox" - geojson: - $ref: "#/definitions/geojson" - filters: - type: object - properties: - category_group_ids: - $ref: "#/definitions/category_group_ids" - category_ids: - $ref: "#/definitions/category_ids" - # CUSTOM FILTERS - name: - $ref: "#/definitions/name" - wheelchair: - $ref: "#/definitions/wheelchair" - smoking: - $ref: "#/definitions/smoking" - fee: - $ref: "#/definitions/fee" - limit: - $ref: "#/definitions/limit" - sortby: - $ref: "#/definitions/sortby" - title: "Openpoiservice poi request" - - LocationsBodyStats: - required: - - request - - geometry - properties: - request: - type: string - example: category_stats - geometry: - type: object - properties: - buffer: - $ref: "#/definitions/buffer" - bbox: - $ref: "#/definitions/bbox" - geojson: - $ref: "#/definitions/geojson" - filters: - type: object - properties: - category_group_ids: - $ref: "#/definitions/category_group_ids" - category_ids: - $ref: "#/definitions/category_ids" - # CUSTOM FILTERS NOT SUPPORTED YET! - #name: - # $ref: "#/definitions/name" - #wheelchair: - # $ref: "#/definitions/wheelchair" - #smoking: - # $ref: "#/definitions/smoking" - #fee: - # $ref: "#/definitions/fee" - title: "Openpoiservice category statistics" - - LocationsBodyList: - required: - - request - properties: - request: - type: string - example: category_list - title: "Openpoiservice category list" - - # SHARED PROPERTIES - category_group_ids: - type: array - items: - type: integer - format: int64 - example: [420] - category_ids: - type: array - items: - type: integer - format: int64 - example: [601, 280] - limit: - type: integer - format: int64 - example: 1000 - buffer: - type: integer - format: int64 - example: 500 - sortby: - type: string - example: category - enum: - - category - - distance - bbox: - type: array - #items: - # type: array - # minItems: 2 - # maxItems: 2 - # items: - # type: float - minItems: 2 - maxItems: 2 - example: [[53.075051,8.798952],[53.080785,8.907160]] - description: The pattern for this bbox string is minlon,minlat,maxlon,maxlat - - geojson: - description: This is a geojson object - type: object - example: '"geometry": { - "type": "Point", - "coordinates": [125.6, 10.1] - }' - # SHARED CUSTOM PROPERTIES - name: - description: Filter by name of the poi object. - type: array - example: ["Tankstelle",...] - wheelchair: - description: Filter example. - type: array - example: ["yes", "no", "limited", "designated"] - smoking: - description: Filter example. - type: array - example: ["dedicated","yes","no","separated","isolated","outside"] - fee: - description: Filter example. - type: array - example: ["yes", "no"] - - # List response object - LocationsListResponse: - type: object - title: "Openpoiservice category list response" - description: "Openpoiservice category list" - - # Poi response object - LocationsPoiResponse: - type: "object" - properties: - type: - type: "string" - default: "FeatureCollection" - features: - type: "array" - items: - $ref: "#/definitions/location_features" - title: "Openpoiservice poi response" - - # Stats response object - LocationsStatsResponse: - type: "object" - properties: - places: - type: "object" - $ref: "#/definitions/places_object" - - title: "Openpoiservice stats response" - - places_object: - type: object - properties: - category_group_id: - type: object - $ref: "#/definitions/stats_object" - total_count: - type: integer - additionalProperties: - type: object - $ref: "#/definitions/stats_object" - title: "Places object" - - stats_object: - type: object - properties: - categories: - type: object - $ref: "#/definitions/category_object" - name: - type: string - description: name of group - total_count: - type: integer - title: "Stats object" - - category_object: - type: object - properties: - category_id: - type: integer - additionalProperties: - type: object - - location_features: - type: "object" - properties: - type: - type: "string" - default: "Feature" - geometry: - $ref: "#/definitions/location_features_geometry" - feature_properties: - $ref: "#/definitions/location_features_properties" - title: "GeoJSON features object" - - location_features_geometry: - properties: - type: - type: "string" - default: "Point" - coordinates: - type: "array" - items: - type: "number" - format: "double" - maxItems: 2 - minItems: 2 - title: "GeoJSON geometry object" - - location_features_properties: - properties: - osm_id: - type: "number" - osm_type: - type: "number" - category_id: - type: "string" - name: - type: "string" - address: - type: "string" - website: - type: "string" - opening_hours: - type: "string" - wheelchair: - type: "string" - distance: - type: "string" - fee: - type: "string" - title: "GeoJSON properties object" \ No newline at end of file diff --git a/openpoiservice/server/api/pois_post.yml b/openpoiservice/server/api/pois_post.yml deleted file mode 100644 index 2cd2222..0000000 --- a/openpoiservice/server/api/pois_post.yml +++ /dev/null @@ -1,365 +0,0 @@ -swagger: "2.0" -tags: -- name: "Pois" -info: - description: | - Returns points of interest in the area surrounding a geometry (geometry and/or bbox). - version: "0.1" - title: "Openpoiservice" - contact: - email: "support@openrouteservice.org" - license: - name: "MIT" - url: "https://github.com/swagger-api/swagger-ui/blob/master/LICENSE" -consumes: -- "application/json" -schemes: -- "https" -produces: -- "application/json" -host: "api.openrouteservice.org" -security: -- UserSecurity: [api_key] -paths: - "/pois": - post: - parameters: - - name: "api_key" - in: "query" - description: | - Insert your API Key here. - type: "string" - required: true - default: "your-api-key" - - in: body - name: "body" - required: true - description: body for a post request - schema: - $ref: '#/definitions/LocationsBodyPois' - # this does not work yet.. - # https://swagger.io/docs/specification/describing-request-body/ - # oneOf: - #- $ref: '#/definitions/LocationsBodyPois' - #- $ref: '#/definitions/LocationsBodyStats' - #- $ref: '#/definitions/LocationsBodyList' - responses: - 200: - description: Standard response for successfully processed requests. - schema: - $ref: '#/definitions/LocationsPoiResponse' - # oneOf: - #- $ref: '#/definitions/LocationsPoiResponse' - #- $ref: '#/definitions/LocationsStatsResponse' - #- $ref: '#/definitions/LocationsListResponse' - 400: - description: Unable to parse JSON request. - 401: - description: Required parameter is missing. - 402: - description: Invalid parameter format. - 403: - description: Invalid parameter value. - 404: - description: Parameter value exceeds the maximum allowed limit. - 499: - description: Unknown internal error. - -securityDefinitions: - UserSecurity: - name: "api_key" - description: | - Add your API Key as the value of the api_key parameter to your request. - type: "apiKey" - in: "query" -definitions: - LocationsBodyPois: - example: { - "request": "pois", - "geometry": { - "bbox": [ - [8.74189636230469, 53.07144289415349], - [8.814767341613771, 53.091060308703845] - ] - }, - "limit": 200 - } - type: object - required: - - request - - geometry - properties: - request: - type: string - example: pois - geometry: - type: object - properties: - buffer: - $ref: "#/definitions/buffer" - bbox: - $ref: "#/definitions/bbox" - geojson: - $ref: "#/definitions/geojson" - filters: - type: object - properties: - category_group_ids: - $ref: "#/definitions/category_group_ids" - category_ids: - $ref: "#/definitions/category_ids" - # CUSTOM FILTERS - name: - $ref: "#/definitions/name" - wheelchair: - $ref: "#/definitions/wheelchair" - smoking: - $ref: "#/definitions/smoking" - fee: - $ref: "#/definitions/fee" - limit: - $ref: "#/definitions/limit" - sortby: - $ref: "#/definitions/sortby" - title: "Openpoiservice poi request" - - LocationsBodyStats: - required: - - request - - geometry - properties: - request: - type: string - example: stats - geometry: - type: object - properties: - buffer: - $ref: "#/definitions/buffer" - bbox: - $ref: "#/definitions/bbox" - geojson: - $ref: "#/definitions/geojson" - filters: - type: object - properties: - category_group_ids: - $ref: "#/definitions/category_group_ids" - category_ids: - $ref: "#/definitions/category_ids" - # CUSTOM FILTERS NOT SUPPORTED YET! - #name: - # $ref: "#/definitions/name" - #wheelchair: - # $ref: "#/definitions/wheelchair" - #smoking: - # $ref: "#/definitions/smoking" - #fee: - # $ref: "#/definitions/fee" - title: "Openpoiservice category statistics" - - LocationsBodyList: - required: - - request - properties: - request: - type: string - example: list - title: "Openpoiservice category list" - - # SHARED PROPERTIES - category_group_ids: - type: array - items: - type: integer - format: int64 - example: [420] - category_ids: - type: array - items: - type: integer - format: int64 - example: [601, 280] - limit: - type: integer - format: int64 - example: 1000 - buffer: - type: integer - format: int64 - example: 500 - sortby: - type: string - example: category - enum: - - category - - distance - bbox: - type: array - #items: - # type: array - # minItems: 2 - # maxItems: 2 - # items: - # type: float - minItems: 2 - maxItems: 2 - example: [[53.075051,8.798952],[53.080785,8.907160]] - description: The pattern for this bbox string is minlon,minlat,maxlon,maxlat - - geojson: - description: This is a GeoJSON object. Is either Point, Polygon or LineString. - type: object - # SHARED CUSTOM PROPERTIES - name: - description: Filter by name of the poi object. - type: array - example: ["Tankstelle",...] - wheelchair: - description: Filter example. - type: array - example: ["yes", "no", "limited", "designated"] - smoking: - description: Filter example. - type: array - example: ["dedicated","yes","no","separated","isolated","outside"] - fee: - description: Filter example. - type: array - example: ["yes", "no"] - - # List response object - LocationsListResponse: - type: object - title: "Openpoiservice category list response" - description: "Openpoiservice category list" - - # Poi response object - LocationsPoiResponse: - type: "object" - properties: - type: - type: "string" - default: "FeatureCollection" - features: - type: "array" - items: - $ref: "#/definitions/location_features" - title: "Openpoiservice poi response" - - # Stats response object - LocationsStatsResponse: - type: "object" - properties: - places: - type: "object" - $ref: "#/definitions/places_object" - - title: "Openpoiservice stats response" - - places_object: - type: object - properties: - category_group_id: - type: object - $ref: "#/definitions/stats_object" - total_count: - type: integer - additionalProperties: - type: object - $ref: "#/definitions/stats_object" - title: "Places object" - - stats_object: - type: object - properties: - categories: - type: object - $ref: "#/definitions/category_object" - name: - type: string - description: name of group - total_count: - type: integer - title: "Stats object" - - category_object: - type: object - properties: - category_id: - type: integer - additionalProperties: - type: object - - location_features: - type: "object" - properties: - type: - type: "string" - default: "Feature" - geometry: - type: "object" - $ref: "#/definitions/location_features_geometry" - feature_properties: - type: "object" - $ref: "#/definitions/location_features_properties" - title: "GeoJSON features object" - - location_features_geometry: - properties: - type: - type: "string" - default: "Point" - coordinates: - type: "array" - items: - type: "number" - format: "double" - maxItems: 2 - minItems: 2 - title: "GeoJSON geometry object" - - location_features_properties: - title: "GeoJSON properties object" - properties: - osm_id: - type: "number" - osm_type: - type: "number" - distance: - type: "number" - category_ids: - type: "object" - $ref: "#/definitions/location_features_properties_category_ids" - osm_tags: - type: "object" - $ref: "#/definitions/location_features_properties_osm_tags" - - location_features_properties_category_ids: - properties: - category_id: - type: "object" - properties: - category_name: - type: "string" - category_group: - type: "number" - - location_features_properties_osm_tags: - type: "object" - properties: - name: - type: "string" - address: - type: "string" - website: - type: "string" - opening_hours: - type: "string" - wheelchair: - type: "string" - distance: - type: "string" - fee: - type: "string" - diff --git a/openpoiservice/server/ops_settings.yml b/openpoiservice/server/ops_settings.yml index 1e5f517..93a27c8 100644 --- a/openpoiservice/server/ops_settings.yml +++ b/openpoiservice/server/ops_settings.yml @@ -18,6 +18,7 @@ provider_parameters: table_name: ops_planet_pois db_name: gis user_name: gis_admin + #user_name: admin password: admin host: localhost port: 5432 From 8e1af739b2c81f666970b8ef5c76308e432e0145 Mon Sep 17 00:00:00 2001 From: TimMcCauley Date: Fri, 4 May 2018 16:49:22 +0200 Subject: [PATCH 4/4] edits gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f3b00e3..cfc7c53 100755 --- a/.gitignore +++ b/.gitignore @@ -115,4 +115,6 @@ ENV/ .idea -openpoiservice/server/ops_settings.yml \ No newline at end of file +openpoiservice/server/ops_settings.yml +osm_1 +osm_2