Skip to content

Commit

Permalink
Merge pull request #27 from GIScience/development
Browse files Browse the repository at this point in the history
Changed yaml instead of yml for apiary
  • Loading branch information
TimMcCauley authored Apr 11, 2018
2 parents f480b9c + 08281a9 commit d44bc9d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion openpoiservice/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def create_app(script_info=None):
from openpoiservice.server.api.views import main_blueprint
app.register_blueprint(main_blueprint)

Swagger(app, template_file='api/pois_post.yml')
Swagger(app, template_file='api/pois_post.yaml')

if "DEVELOPMENT" in os.environ:
@app.before_request
Expand Down
47 changes: 37 additions & 10 deletions openpoiservice/server/api/pois_post.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,16 @@ securityDefinitions:
in: "query"
definitions:
LocationsBodyPois:
example: "{1: 1}"
example: {
"request": "pois",
"geometry": {
"bbox": [
[8.74189636230469, 53.07144289415349],
[8.814767341613771, 53.091060308703845]
]
},
"limit": 200
}
type: object
required:
- request
Expand Down Expand Up @@ -121,7 +130,7 @@ definitions:
properties:
request:
type: string
example: category_stats
example: stats
geometry:
type: object
properties:
Expand Down Expand Up @@ -155,7 +164,7 @@ definitions:
properties:
request:
type: string
example: category_list
example: list
title: "Openpoiservice category list"

# SHARED PROPERTIES
Expand Down Expand Up @@ -199,12 +208,8 @@ definitions:
description: The pattern for this bbox string is minlon,minlat,maxlon,maxlat

geojson:
description: This is a geojson object
description: This is a GeoJSON object. Is either Point, Polygon or LineString.
type: object
example: '"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
}'
# SHARED CUSTOM PROPERTIES
name:
description: Filter by name of the poi object.
Expand Down Expand Up @@ -293,8 +298,10 @@ definitions:
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"

Expand All @@ -313,13 +320,34 @@ definitions:
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: "string"
type: "object"
properties:
category_name:
type: "string"
category_group:
type: "number"

location_features_properties_osm_tags:
type: "object"
properties:
name:
type: "string"
address:
Expand All @@ -334,4 +362,3 @@ definitions:
type: "string"
fee:
type: "string"
title: "GeoJSON properties object"
2 changes: 1 addition & 1 deletion openpoiservice/server/api/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def generate_geojson_features(cls, query, limit):

key_values = {}
for idx, key in enumerate(q[4]):
if key is not 'null':
if key != "null":
key_values[key] = q[5][idx]

properties["osm_tags"] = key_values
Expand Down

0 comments on commit d44bc9d

Please sign in to comment.