+++ /dev/null
-@APIDB
-Feature: Parameters for Reverse API
- Testing correctness of geocodejson output.
-
- Scenario: City housenumber-level address with street
- When sending geocodejson reverse coordinates 47.1068011,9.52810091
- Then results contain
- | housenumber | street | postcode | city | country |
- | 8 | Im Winkel | 9495 | Triesen | Liechtenstein |
-
- Scenario: Town street-level address with street
- When sending geocodejson reverse coordinates 47.066,9.504
- | zoom |
- | 16 |
- Then results contain
- | name | city | postcode | country |
- | Gnetsch | Balzers | 9496 | Liechtenstein |
-
- Scenario: Poi street-level address with footway
- When sending geocodejson reverse coordinates 47.0653,9.5007
- Then results contain
- | street | city | postcode | country |
- | Burgweg | Balzers | 9496 | Liechtenstein |
-
- Scenario: City address with suburb
- When sending geocodejson reverse coordinates 47.146861,9.511771
- Then results contain
- | housenumber | street | district | city | postcode | country |
- | 5 | Lochgass | Ebenholz | Vaduz | 9490 | Liechtenstein |
--- /dev/null
+@APIDB
+Feature: Geometries for reverse geocoding
+ Tests for returning geometries with reverse
+
+
+ Scenario: Polygons are returned fully by default
+ When sending v1/reverse at 47.13803,9.52264
+ | polygon_text |
+ | 1 |
+ Then results contain
+ | geotext |
+ | POLYGON((9.5225302 47.138066,9.5225348 47.1379282,9.5226142 47.1379294,9.5226143 47.1379257,9.522615 47.137917,9.5226225 47.1379098,9.5226334 47.1379052,9.5226461 47.1379037,9.5226588 47.1379056,9.5226693 47.1379107,9.5226762 47.1379181,9.5226762 47.1379268,9.5226761 47.1379308,9.5227366 47.1379317,9.5227352 47.1379753,9.5227608 47.1379757,9.5227595 47.1380148,9.5227355 47.1380145,9.5227337 47.1380692,9.5225302 47.138066)) |
+
+
+ Scenario: Polygons can be slightly simplified
+ When sending v1/reverse at 47.13803,9.52264
+ | polygon_text | polygon_threshold |
+ | 1 | 0.00001 |
+ Then results contain
+ | geotext |
+ | POLYGON((9.5225302 47.138066,9.5225348 47.1379282,9.5226142 47.1379294,9.5226225 47.1379098,9.5226588 47.1379056,9.5226761 47.1379308,9.5227366 47.1379317,9.5227352 47.1379753,9.5227608 47.1379757,9.5227595 47.1380148,9.5227355 47.1380145,9.5227337 47.1380692,9.5225302 47.138066)) |
+
+
+ Scenario: Polygons can be much simplified
+ When sending v1/reverse at 47.13803,9.52264
+ | polygon_text | polygon_threshold |
+ | 1 | 0.9 |
+ Then results contain
+ | geotext |
+ | POLYGON((9.5225302 47.138066,9.5225348 47.1379282,9.5227608 47.1379757,9.5227337 47.1380692,9.5225302 47.138066)) |
+
+
+ Scenario: For polygons return the centroid as center point
+ When sending v1/reverse at 47.13836,9.52304
+ Then results contain
+ | centroid |
+ | 9.52271080 47.13818045 |
+
+
+ Scenario: For streets return the closest point as center point
+ When sending v1/reverse at 47.13368,9.52942
+ Then results contain
+ | centroid |
+ | 9.529431527 47.13368172 |
Feature: Localization of reverse search results
Scenario: default language
- When sending json reverse coordinates 47.14,9.55
+ When sending v1/reverse at 47.14,9.55
Then result addresses contain
| ID | country |
| 0 | Liechtenstein |
Scenario: accept-language parameter
- When sending json reverse coordinates 47.14,9.55
+ When sending v1/reverse at 47.14,9.55
| accept-language |
| ja,en |
Then result addresses contain
Given the HTTP header
| accept-language |
| fo-ca,fo;q=0.8,en-ca;q=0.5,en;q=0.3 |
- When sending json reverse coordinates 47.14,9.55
+ When sending v1/reverse at 47.14,9.55
Then result addresses contain
| ID | country |
| 0 | Liktinstein |
Given the HTTP header
| accept-language |
| fo-ca,fo;q=0.8,en-ca;q=0.5,en;q=0.3 |
- When sending json reverse coordinates 47.14,9.55
+ When sending v1/reverse at 47.14,9.55
| accept-language |
| en |
Then result addresses contain
+++ /dev/null
-@APIDB
-Feature: Parameters for Reverse API
- Testing different parameter options for reverse API.
-
- Scenario Outline: Reverse-geocoding without address
- When sending <format> reverse coordinates 47.13,9.56
- | addressdetails |
- | 0 |
- Then exactly 1 result is returned
- And result has not attributes address
-
- Examples:
- | format |
- | json |
- | jsonv2 |
- | geojson |
- | xml |
-
- Scenario Outline: Coordinates must be floating-point numbers
- When sending reverse coordinates <coords>
- Then a HTTP 400 is returned
-
- Examples:
- | coords |
- | -45.3,; |
- | gkjd,50 |
-
- Scenario Outline: Zoom levels between 4 and 18 are allowed
- When sending reverse coordinates 47.14122383,9.52169581334
- | zoom |
- | <zoom> |
- Then exactly 1 result is returned
- And result addresses contain
- | country_code |
- | li |
-
- Examples:
- | zoom |
- | 4 |
- | 5 |
- | 6 |
- | 7 |
- | 8 |
- | 9 |
- | 10 |
- | 11 |
- | 12 |
- | 13 |
- | 14 |
- | 15 |
- | 16 |
- | 17 |
- | 18 |
-
- Scenario: Non-numerical zoom levels return an error
- When sending reverse coordinates 47.14122383,9.52169581334
- | zoom |
- | adfe |
- Then a HTTP 400 is returned
-
- Scenario Outline: Reverse Geocoding with extratags
- When sending <format> reverse coordinates 47.1395013150811,9.522098077031046
- | extratags |
- | 1 |
- Then result 0 has attributes extratags
-
- Examples:
- | format |
- | xml |
- | json |
- | jsonv2 |
- | geojson |
-
- Scenario Outline: Reverse Geocoding with namedetails
- When sending <format> reverse coordinates 47.1395013150811,9.522098077031046
- | namedetails |
- | 1 |
- Then result 0 has attributes namedetails
-
- Examples:
- | format |
- | xml |
- | json |
- | jsonv2 |
- | geojson |
-
- Scenario Outline: Reverse Geocoding contains TEXT geometry
- When sending <format> reverse coordinates 47.165989816710066,9.515774846076965
- | polygon_text |
- | 1 |
- Then result 0 has attributes <response_attribute>
-
- Examples:
- | format | response_attribute |
- | xml | geotext |
- | json | geotext |
- | jsonv2 | geotext |
-
- Scenario Outline: Reverse Geocoding contains SVG geometry
- When sending <format> reverse coordinates 47.165989816710066,9.515774846076965
- | polygon_svg |
- | 1 |
- Then result 0 has attributes <response_attribute>
-
- Examples:
- | format | response_attribute |
- | xml | geosvg |
- | json | svg |
- | jsonv2 | svg |
-
- Scenario Outline: Reverse Geocoding contains KML geometry
- When sending <format> reverse coordinates 47.165989816710066,9.515774846076965
- | polygon_kml |
- | 1 |
- Then result 0 has attributes <response_attribute>
-
- Examples:
- | format | response_attribute |
- | xml | geokml |
- | json | geokml |
- | jsonv2 | geokml |
-
- Scenario Outline: Reverse Geocoding contains GEOJSON geometry
- When sending <format> reverse coordinates 47.165989816710066,9.515774846076965
- | polygon_geojson |
- | 1 |
- Then result 0 has attributes <response_attribute>
-
- Examples:
- | format | response_attribute |
- | xml | geojson |
- | json | geojson |
- | jsonv2 | geojson |
- | geojson | geojson |
-
- Scenario Outline: Reverse Geocoding in geojson format contains no non-geojson geometry
- When sending geojson reverse coordinates 47.165989816710066,9.515774846076965
- | polygon_text | polygon_svg | polygon_geokml |
- | 1 | 1 | 1 |
- Then result 0 has not attributes <response_attribute>
-
- Examples:
- | response_attribute |
- | geotext |
- | polygonpoints |
- | svg |
- | geokml |
Feature: Reverse geocoding
Testing the reverse function
+ Scenario Outline: Simple reverse-geocoding with no results
+ When sending v1/reverse at <lat>,<lon>
+ Then exactly 0 results are returned
+
+ Examples:
+ | lat | lon |
+ | 0.0 | 0.0 |
+ | -34.830 | -56.105 |
+ | 45.174 | -103.072 |
+ | 21.156 | -12.2744 |
+ | 91.3 | 0.4 |
+ | -700 | 0.4 |
+ | 0.2 | 324.44 |
+ | 0.2 | -180.4 |
+
+
@Tiger
Scenario: TIGER house number
- When sending jsonv2 reverse coordinates 32.4752389363,-86.4810198619
+ When sending v1/reverse at 32.4752389363,-86.4810198619
Then results contain
- | osm_type | category | type |
- | way | place | house |
+ | category | type |
+ | place | house |
And result addresses contain
| house_number | road | postcode | country_code |
| 707 | Upper Kingston Road | 36067 | us |
@Tiger
Scenario: No TIGER house number for zoom < 18
- When sending jsonv2 reverse coordinates 32.4752389363,-86.4810198619
+ When sending v1/reverse at 32.4752389363,-86.4810198619
| zoom |
| 17 |
Then results contain
| Upper Kingston Road | 30607 | us |
Scenario: Interpolated house number
- When sending jsonv2 reverse coordinates 47.118533,9.57056562
+ When sending v1/reverse at 47.118533,9.57056562
Then results contain
| osm_type | category | type |
| way | place | house |
| 1019 | Grosssteg |
Scenario: Address with non-numerical house number
- When sending jsonv2 reverse coordinates 47.107465,9.52838521614
+ When sending v1/reverse at 47.107465,9.52838521614
Then result addresses contain
| house_number | road |
| 39A/B | Dorfstrasse |
Scenario: Address with numerical house number
- When sending jsonv2 reverse coordinates 47.168440329479594,9.511551699184338
+ When sending v1/reverse at 47.168440329479594,9.511551699184338
Then result addresses contain
| house_number | road |
| 6 | Schmedgässle |
Scenario Outline: Zoom levels below 5 result in country
- When sending jsonv2 reverse coordinates 47.16,9.51
+ When sending v1/reverse at 47.16,9.51
| zoom |
| <zoom> |
Then results contain
| 4 |
Scenario: When on a street, the closest interpolation is shown
- When sending jsonv2 reverse coordinates 47.118457166193245,9.570678289621355
+ When sending v1/reverse at 47.118457166193245,9.570678289621355
| zoom |
| 18 |
Then results contain
# github 2214
Scenario: Interpolations do not override house numbers when they are closer
- When sending jsonv2 reverse coordinates 47.11778,9.57255
+ When sending v1/reverse at 47.11778,9.57255
| zoom |
| 18 |
Then results contain
| 5, Grosssteg, Steg, Triesenberg, Oberland, 9497, Liechtenstein |
Scenario: Interpolations do not override house numbers when they are closer (2)
- When sending jsonv2 reverse coordinates 47.11834,9.57167
+ When sending v1/reverse at 47.11834,9.57167
| zoom |
| 18 |
Then results contain
| 3, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
Scenario: When on a street with zoom 18, the closest housenumber is returned
- When sending jsonv2 reverse coordinates 47.11755503977281,9.572722250405036
+ When sending v1/reverse at 47.11755503977281,9.572722250405036
| zoom |
| 18 |
Then result addresses contain
+++ /dev/null
-@APIDB
-Feature: Simple Reverse Tests
- Simple tests for internal server errors and response format.
-
- Scenario Outline: Simple reverse-geocoding
- When sending reverse coordinates <lat>,<lon>
- Then the result is valid xml
- When sending xml reverse coordinates <lat>,<lon>
- Then the result is valid xml
- When sending json reverse coordinates <lat>,<lon>
- Then the result is valid json
- When sending jsonv2 reverse coordinates <lat>,<lon>
- Then the result is valid json
- When sending geojson reverse coordinates <lat>,<lon>
- Then the result is valid geojson
-
- Examples:
- | lat | lon |
- | 0.0 | 0.0 |
- | -34.830 | -56.105 |
- | 45.174 | -103.072 |
- | 21.156 | -12.2744 |
-
- Scenario Outline: Testing different parameters
- When sending reverse coordinates 53.603,10.041
- | param | value |
- | <parameter> | <value> |
- Then the result is valid xml
- When sending xml reverse coordinates 53.603,10.041
- | param | value |
- | <parameter> | <value> |
- Then the result is valid xml
- When sending json reverse coordinates 53.603,10.041
- | param | value |
- | <parameter> | <value> |
- Then the result is valid json
- When sending jsonv2 reverse coordinates 53.603,10.041
- | param | value |
- | <parameter> | <value> |
- Then the result is valid json
- When sending geojson reverse coordinates 53.603,10.041
- | param | value |
- | <parameter> | <value> |
- Then the result is valid geojson
- When sending geocodejson reverse coordinates 53.603,10.041
- | param | value |
- | <parameter> | <value> |
- Then the result is valid geocodejson
-
- Examples:
- | parameter | value |
- | polygon_text | 1 |
- | polygon_text | 0 |
- | polygon_kml | 1 |
- | polygon_kml | 0 |
- | polygon_geojson | 1 |
- | polygon_geojson | 0 |
- | polygon_svg | 1 |
- | polygon_svg | 0 |
-
- Scenario Outline: Wrapping of legal jsonp requests
- When sending <format> reverse coordinates 67.3245,0.456
- | json_callback |
- | foo |
- Then the result is valid <outformat>
-
- Examples:
- | format | outformat |
- | json | json |
- | jsonv2 | json |
- | geojson | geojson |
-
- Scenario Outline: Boundingbox is returned
- When sending <format> reverse coordinates 47.11,9.57
- | zoom |
- | 8 |
- Then result has bounding box in 47,48,9,10
-
- Examples:
- | format |
- | json |
- | jsonv2 |
- | geojson |
- | xml |
-
- Scenario Outline: Reverse-geocoding with zoom
- When sending <format> reverse coordinates 47.11,9.57
- | zoom |
- | 10 |
- Then exactly 1 result is returned
-
- Examples:
- | format |
- | json |
- | jsonv2 |
- | geojson |
- | xml |
-
- Scenario: Missing lon parameter
- When sending reverse coordinates 52.52,
- Then a HTTP 400 is returned
-
- Scenario: Missing lat parameter
- When sending reverse coordinates ,52.52
- Then a HTTP 400 is returned
-
- Scenario: Missing osm_id parameter
- When sending reverse coordinates ,
- | osm_type |
- | N |
- Then a HTTP 400 is returned
-
- Scenario: Missing osm_type parameter
- When sending reverse coordinates ,
- | osm_id |
- | 3498564 |
- Then a HTTP 400 is returned
-
- Scenario Outline: Bad format for lat or lon
- When sending reverse coordinates ,
- | lat | lon |
- | <lat> | <lon> |
- Then a HTTP 400 is returned
-
- Examples:
- | lat | lon |
- | 48.9660 | 8,4482 |
- | 48,9660 | 8.4482 |
- | 48,9660 | 8,4482 |
- | 48.966.0 | 8.4482 |
- | 48.966 | 8.448.2 |
- | Nan | 8.448 |
- | 48.966 | Nan |
-
-
- @v1-api-python-only
- Scenario: Reverse Debug output returns no errors
- When sending debug reverse coordinates 47.11,9.57
- Then the result is valid html
--- /dev/null
+@APIDB
+Feature: Geocodejson for Reverse API
+ Testing correctness of geocodejson output (API version v1).
+
+ Scenario Outline: Simple OSM result
+ When sending v1/reverse at 47.066,9.504 with format geocodejson
+ | addressdetails |
+ | <has_address> |
+ Then result has attributes place_id, accuracy
+ And result has <attributes> country,postcode,county,city,district,street,housenumber, admin
+ Then results contain
+ | osm_type | osm_id | osm_key | osm_value | type |
+ | node | 6522627624 | shop | bakery | house |
+ And results contain
+ | name | label |
+ | Dorfbäckerei Herrmann | Dorfbäckerei Herrmann, 29, Gnetsch, Mäls, Balzers, Oberland, 9496, Liechtenstein |
+ And results contain in field geojson
+ | type | coordinates |
+ | Point | [9.5036065, 47.0660892] |
+ And results contain in field __geocoding
+ | version | licence | attribution |
+ | 0.1.0 | ODbL | Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright |
+
+ Examples:
+ | has_address | attributes |
+ | 1 | attributes |
+ | 0 | not attributes |
+
+
+ Scenario: City housenumber-level address with street
+ When sending v1/reverse at 47.1068011,9.52810091 with format geocodejson
+ Then results contain
+ | housenumber | street | postcode | city | country |
+ | 8 | Im Winkel | 9495 | Triesen | Liechtenstein |
+ And results contain in field admin
+ | level6 | level8 |
+ | Oberland | Triesen |
+
+
+ Scenario: Town street-level address with street
+ When sending v1/reverse at 47.066,9.504 with format geocodejson
+ | zoom |
+ | 16 |
+ Then results contain
+ | name | city | postcode | country |
+ | Gnetsch | Balzers | 9496 | Liechtenstein |
+
+
+ Scenario: Poi street-level address with footway
+ When sending v1/reverse at 47.06515,9.50083 with format geocodejson
+ Then results contain
+ | street | city | postcode | country |
+ | Burgweg | Balzers | 9496 | Liechtenstein |
+
+
+ Scenario: City address with suburb
+ When sending v1/reverse at 47.146861,9.511771 with format geocodejson
+ Then results contain
+ | housenumber | street | district | city | postcode | country |
+ | 5 | Lochgass | Ebenholz | Vaduz | 9490 | Liechtenstein |
+
+
+ @Tiger
+ Scenario: Tiger address
+ When sending v1/reverse at 32.4752389363,-86.4810198619 with format geocodejson
+ Then results contain
+ | osm_type | osm_id | osm_key | osm_value | type |
+ | way | 396009653 | place | house | house |
+ And results contain
+ | housenumber | street | city | county | postcode | country |
+ | 707 | Upper Kingston Road | Prattville | Autauga County | 36067 | United States |
+
+
+ Scenario: Interpolation address
+ When sending v1/reverse at 47.118533,9.57056562 with format geocodejson
+ Then results contain
+ | osm_type | osm_id | osm_key | osm_value | type |
+ | way | 1 | place | house | house |
+ And results contain
+ | label |
+ | 1019, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
+ And result has not attributes name
+
+
+ Scenario: Line geometry output is supported
+ When sending v1/reverse at 47.06597,9.50467 with format geocodejson
+ | param | value |
+ | polygon_geojson | 1 |
+ Then results contain in field geojson
+ | type |
+ | LineString |
+
+
+ Scenario Outline: Only geojson polygons are supported
+ When sending v1/reverse at 47.06597,9.50467 with format geocodejson
+ | param | value |
+ | <param> | 1 |
+ Then results contain in field geojson
+ | type |
+ | Point |
+
+ Examples:
+ | param |
+ | polygon_text |
+ | polygon_svg |
+ | polygon_kml |
--- /dev/null
+@APIDB
+Feature: Geojson for Reverse API
+ Testing correctness of geojson output (API version v1).
+
+ Scenario Outline: Simple OSM result
+ When sending v1/reverse at 47.066,9.504 with format geojson
+ | addressdetails |
+ | <has_address> |
+ Then result has attributes place_id, importance, __licence
+ And result has <attributes> address
+ And results contain
+ | osm_type | osm_id | place_rank | category | type | addresstype |
+ | node | 6522627624 | 30 | shop | bakery | shop |
+ And results contain
+ | name | display_name |
+ | Dorfbäckerei Herrmann | Dorfbäckerei Herrmann, 29, Gnetsch, Mäls, Balzers, Oberland, 9496, Liechtenstein |
+ And results contain
+ | boundingbox |
+ | [47.0660392, 47.0661392, 9.5035565, 9.5036565] |
+ And results contain in field geojson
+ | type | coordinates |
+ | Point | [9.5036065, 47.0660892] |
+
+ Examples:
+ | has_address | attributes |
+ | 1 | attributes |
+ | 0 | not attributes |
+
+
+ @Tiger
+ Scenario: Tiger address
+ When sending v1/reverse at 32.4752389363,-86.4810198619 with format geojson
+ Then results contain
+ | osm_type | osm_id | category | type | addresstype | place_rank |
+ | way | 396009653 | place | house | place | 30 |
+
+
+ Scenario: Interpolation address
+ When sending v1/reverse at 47.118533,9.57056562 with format geojson
+ Then results contain
+ | osm_type | osm_id | place_rank | category | type | addresstype |
+ | way | 1 | 30 | place | house | place |
+ And results contain
+ | boundingbox |
+ | [47.118495392, 47.118595392, 9.57049676, 9.57059676] |
+ And results contain
+ | display_name |
+ | 1019, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
+
+
+ Scenario: Line geometry output is supported
+ When sending v1/reverse at 47.06597,9.50467 with format geojson
+ | param | value |
+ | polygon_geojson | 1 |
+ Then results contain in field geojson
+ | type |
+ | LineString |
+
+
+ Scenario Outline: Only geojson polygons are supported
+ When sending v1/reverse at 47.06597,9.50467 with format geojson
+ | param | value |
+ | <param> | 1 |
+ Then results contain in field geojson
+ | type |
+ | Point |
+
+ Examples:
+ | param |
+ | polygon_text |
+ | polygon_svg |
+ | polygon_kml |
--- /dev/null
+@APIDB
+Feature: Json output for Reverse API
+ Testing correctness of json and jsonv2 output (API version v1).
+
+ Scenario Outline: OSM result with and without addresses
+ When sending v1/reverse at 47.066,9.504 with format json
+ | addressdetails |
+ | <has_address> |
+ Then result has <attributes> address
+ When sending v1/reverse at 47.066,9.504 with format jsonv2
+ | addressdetails |
+ | <has_address> |
+ Then result has <attributes> address
+
+ Examples:
+ | has_address | attributes |
+ | 1 | attributes |
+ | 0 | not attributes |
+
+ Scenario Outline: Siple OSM result
+ When sending v1/reverse at 47.066,9.504 with format <format>
+ Then result has attributes place_id
+ And results contain
+ | licence |
+ | Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright |
+ And results contain
+ | osm_type | osm_id |
+ | node | 6522627624 |
+ And results contain
+ | lat | lon | boundingbox |
+ | 47.0660892 | 9.5036065 | ['47.0660392', '47.0661392', '9.5035565', '9.5036565'] |
+ And results contain
+ | display_name |
+ | Dorfbäckerei Herrmann, 29, Gnetsch, Mäls, Balzers, Oberland, 9496, Liechtenstein |
+ And result has not attributes namedetails,extratags
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
+
+ Scenario: Extra attributes of jsonv2 result
+ When sending v1/reverse at 47.066,9.504 with format jsonv2
+ Then result has attributes importance
+ Then results contain
+ | category | type | name | place_rank | addresstype |
+ | shop | bakery | Dorfbäckerei Herrmann | 30 | shop |
+
+
+ @Tiger
+ Scenario: Tiger address
+ When sending v1/reverse at 32.4752389363,-86.4810198619 with format jsonv2
+ Then results contain
+ | osm_type | osm_id | category | type | addresstype |
+ | way | 396009653 | place | house | place |
+
+
+ Scenario Outline: Interpolation address
+ When sending v1/reverse at 47.118533,9.57056562 with format <format>
+ Then results contain
+ | osm_type | osm_id |
+ | way | 1 |
+ And results contain
+ | lat | lon | boundingbox |
+ | 47.118545392 | 9.57054676 | ['47.118495392', '47.118595392', '9.57049676', '9.57059676'] |
+ And results contain
+ | display_name |
+ | 1019, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
+
+
+ Scenario Outline: Output of geojson
+ When sending v1/reverse at 47.06597,9.50467 with format <format>
+ | param | value |
+ | polygon_geojson | 1 |
+ Then results contain in field geojson
+ | type | coordinates |
+ | LineString | [[9.5039353, 47.0657546], [9.5040437, 47.0657781], [9.5040808, 47.065787], [9.5054298, 47.0661407]] |
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
+
+
+ Scenario Outline: Output of WKT
+ When sending v1/reverse at 47.06597,9.50467 with format <format>
+ | param | value |
+ | polygon_text | 1 |
+ Then results contain
+ | geotext |
+ | LINESTRING(9.5039353 47.0657546,9.5040437 47.0657781,9.5040808 47.065787,9.5054298 47.0661407) |
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
+
+
+ Scenario Outline: Output of SVG
+ When sending v1/reverse at 47.06597,9.50467 with format <format>
+ | param | value |
+ | polygon_svg | 1 |
+ Then results contain
+ | svg |
+ | M 9.5039353 -47.0657546 L 9.5040437 -47.0657781 9.5040808 -47.065787 9.5054298 -47.0661407 |
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
+
+
+ Scenario Outline: Output of KML
+ When sending v1/reverse at 47.06597,9.50467 with format <format>
+ | param | value |
+ | polygon_kml | 1 |
+ Then results contain
+ | geokml |
+ | <LineString><coordinates>9.5039353,47.0657546 9.5040437,47.0657781 9.5040808,47.065787 9.5054298,47.0661407</coordinates></LineString> |
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
--- /dev/null
+@APIDB
+Feature: v1/reverse Parameter Tests
+ Tests for parameter inputs for the v1 reverse endpoint.
+ This file contains mostly bad parameter input. Valid parameters
+ are tested in the format tests.
+
+ Scenario: Bad format
+ When sending v1/reverse at 47.14122383,9.52169581334 with format sdf
+ Then a HTTP 400 is returned
+
+ Scenario: Missing lon parameter
+ When sending v1/reverse at 52.52,
+ Then a HTTP 400 is returned
+
+
+ Scenario: Missing lat parameter
+ When sending v1/reverse at ,52.52
+ Then a HTTP 400 is returned
+
+ @v1-api-php-only
+ Scenario: Missing osm_id parameter
+ When sending v1/reverse at ,
+ | osm_type |
+ | N |
+ Then a HTTP 400 is returned
+
+ @v1-api-php-only
+ Scenario: Missing osm_type parameter
+ When sending v1/reverse at ,
+ | osm_id |
+ | 3498564 |
+ Then a HTTP 400 is returned
+
+
+ Scenario Outline: Bad format for lat or lon
+ When sending v1/reverse at ,
+ | lat | lon |
+ | <lat> | <lon> |
+ Then a HTTP 400 is returned
+
+ Examples:
+ | lat | lon |
+ | 48.9660 | 8,4482 |
+ | 48,9660 | 8.4482 |
+ | 48,9660 | 8,4482 |
+ | 48.966.0 | 8.4482 |
+ | 48.966 | 8.448.2 |
+ | Nan | 8.448 |
+ | 48.966 | Nan |
+ | Inf | 5.6 |
+ | 5.6 | -Inf |
+ | <script></script> | 3.4 |
+ | 3.4 | <script></script> |
+ | -45.3 | ; |
+ | gkjd | 50 |
+
+
+ Scenario: Non-numerical zoom levels return an error
+ When sending v1/reverse at 47.14122383,9.52169581334
+ | zoom |
+ | adfe |
+ Then a HTTP 400 is returned
+
+
+ Scenario Outline: Truthy values for boolean parameters
+ When sending v1/reverse at 47.14122383,9.52169581334
+ | addressdetails |
+ | <value> |
+ Then exactly 1 result is returned
+ And result has attributes address
+
+ When sending v1/reverse at 47.14122383,9.52169581334
+ | extratags |
+ | <value> |
+ Then exactly 1 result is returned
+ And result has attributes extratags
+
+ When sending v1/reverse at 47.14122383,9.52169581334
+ | namedetails |
+ | <value> |
+ Then exactly 1 result is returned
+ And result has attributes namedetails
+
+ When sending v1/reverse at 47.14122383,9.52169581334
+ | polygon_geojson |
+ | <value> |
+ Then exactly 1 result is returned
+ And result has attributes geojson
+
+ When sending v1/reverse at 47.14122383,9.52169581334
+ | polygon_kml |
+ | <value> |
+ Then exactly 1 result is returned
+ And result has attributes geokml
+
+ When sending v1/reverse at 47.14122383,9.52169581334
+ | polygon_svg |
+ | <value> |
+ Then exactly 1 result is returned
+ And result has attributes svg
+
+ When sending v1/reverse at 47.14122383,9.52169581334
+ | polygon_text |
+ | <value> |
+ Then exactly 1 result is returned
+ And result has attributes geotext
+
+ Examples:
+ | value |
+ | yes |
+ | no |
+ | -1 |
+ | 100 |
+ | false |
+ | 00 |
+
+
+ Scenario: Only one geometry can be requested
+ When sending v1/reverse at 47.165989816710066,9.515774846076965
+ | polygon_text | polygon_svg |
+ | 1 | 1 |
+ Then a HTTP 400 is returned
+
+
+ Scenario Outline: Wrapping of legal jsonp requests
+ When sending v1/reverse at 67.3245,0.456 with format <format>
+ | json_callback |
+ | foo |
+ Then the result is valid <outformat>
+
+ Examples:
+ | format | outformat |
+ | json | json |
+ | jsonv2 | json |
+ | geojson | geojson |
+ | geocodejson | geocodejson |
+
+
+ Scenario Outline: Illegal jsonp are not allowed
+ When sending v1/reverse at 47.165989816710066,9.515774846076965
+ | param | value |
+ |json_callback | <data> |
+ Then a HTTP 400 is returned
+
+ Examples:
+ | data |
+ | 1asd |
+ | bar(foo) |
+ | XXX['bad'] |
+ | foo; evil |
+
+
+ @v1-api-python-only
+ Scenario Outline: Reverse debug mode produces valid HTML
+ When sending v1/reverse at , with format debug
+ | lat | lon |
+ | <lat> | <lon> |
+ Then the result is valid html
+
+ Examples:
+ | lat | lon |
+ | 0.0 | 0.0 |
+ | 47.06645 | 9.56601 |
+ | 47.14081 | 9.52267 |
+
+
+ Scenario Outline: Full address display for city housenumber-level address with street
+ When sending v1/reverse at 47.1068011,9.52810091 with format <format>
+ Then address of result 0 is
+ | type | value |
+ | house_number | 8 |
+ | road | Im Winkel |
+ | neighbourhood | Oberdorf |
+ | village | Triesen |
+ | ISO3166-2-lvl8 | LI-09 |
+ | county | Oberland |
+ | postcode | 9495 |
+ | country | Liechtenstein |
+ | country_code | li |
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
+ | geojson |
+ | xml |
+
+
+ Scenario Outline: Results with name details
+ When sending v1/reverse at 47.14052,9.52202 with format <format>
+ | zoom | namedetails |
+ | 14 | 1 |
+ Then results contain in field namedetails
+ | name |
+ | Ebenholz |
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
+ | xml |
+ | geojson |
+
+
+ Scenario Outline: Results with extratags
+ When sending v1/reverse at 47.14052,9.52202 with format <format>
+ | zoom | extratags |
+ | 14 | 1 |
+ Then results contain in field extratags
+ | wikidata |
+ | Q4529531 |
+
+ Examples:
+ | format |
+ | json |
+ | jsonv2 |
+ | xml |
+ | geojson |
+
+
--- /dev/null
+@APIDB
+Feature: XML output for Reverse API
+ Testing correctness of xml output (API version v1).
+
+ Scenario Outline: OSM result with and without addresses
+ When sending v1/reverse at 47.066,9.504 with format xml
+ | addressdetails |
+ | <has_address> |
+ Then result has attributes place_id
+ Then result has <attributes> address
+ And results contain
+ | osm_type | osm_id | place_rank | address_rank |
+ | node | 6522627624 | 30 | 30 |
+ And results contain
+ | lat | lon | boundingbox |
+ | 47.0660892 | 9.5036065 | 47.0660392,47.0661392,9.5035565,9.5036565 |
+ And results contain
+ | ref | display_name |
+ | Dorfbäckerei Herrmann | Dorfbäckerei Herrmann, 29, Gnetsch, Mäls, Balzers, Oberland, 9496, Liechtenstein |
+
+ Examples:
+ | has_address | attributes |
+ | 1 | attributes |
+ | 0 | not attributes |
+
+
+ @Tiger
+ Scenario: Tiger address
+ When sending v1/reverse at 32.4752389363,-86.4810198619 with format xml
+ Then results contain
+ | osm_type | osm_id | place_rank | address_rank |
+ | way | 396009653 | 30 | 30 |
+ And results contain
+ | lat | lon | boundingbox |
+ | 32.47535802569396 | -86.48085532585448 | 32.475308025694,32.475408025694,-86.480905325854,-86.480805325854 |
+ And results contain
+ | display_name |
+ | 707, Upper Kingston Road, Upper Kingston, Prattville, Autauga County, 36067, United States |
+
+
+ Scenario: Interpolation address
+ When sending v1/reverse at 47.118533,9.57056562 with format xml
+ Then results contain
+ | osm_type | osm_id | place_rank | address_rank |
+ | way | 1 | 30 | 30 |
+ And results contain
+ | lat | lon | boundingbox |
+ | 47.118545392 | 9.57054676 | 47.118495392,47.118595392,9.57049676,9.57059676 |
+ And results contain
+ | display_name |
+ | 1019, Grosssteg, Sücka, Triesenberg, Oberland, 9497, Liechtenstein |
+
+
+ Scenario: Output of geojson
+ When sending v1/reverse at 47.06597,9.50467 with format xml
+ | param | value |
+ | polygon_geojson | 1 |
+ Then results contain
+ | geojson |
+ | {"type":"LineString","coordinates":[[9.5039353,47.0657546],[9.5040437,47.0657781],[9.5040808,47.065787],[9.5054298,47.0661407]]} |
+
+
+ Scenario: Output of WKT
+ When sending v1/reverse at 47.06597,9.50467 with format xml
+ | param | value |
+ | polygon_text | 1 |
+ Then results contain
+ | geotext |
+ | LINESTRING(9.5039353 47.0657546,9.5040437 47.0657781,9.5040808 47.065787,9.5054298 47.0661407) |
+
+
+ Scenario: Output of SVG
+ When sending v1/reverse at 47.06597,9.50467 with format xml
+ | param | value |
+ | polygon_svg | 1 |
+ Then results contain
+ | geosvg |
+ | M 9.5039353 -47.0657546 L 9.5040437 -47.0657781 9.5040808 -47.065787 9.5054298 -47.0661407 |
+
+
+ Scenario: Output of KML
+ When sending v1/reverse at 47.06597,9.50467 with format xml
+ | param | value |
+ | polygon_kml | 1 |
+ Then results contain
+ | geokml |
+ | <geokml><LineString><coordinates>9.5039353,47.0657546 9.5040437,47.0657781 9.5040808,47.065787 9.5054298,47.0661407</coordinates></LineString></geokml> |
Then W1 expands to interpolation
| start | end | geometry |
| 2 | 8 | 10,11 |
- When sending jsonv2 reverse coordinates 1,1
+ When sending v1/reverse at 1,1
Then results contain
| ID | osm | type | display_name |
| 0 | N1 | house | 0 |
| id | nodes |
| 1 | 1,3 |
When importing
- When sending jsonv2 reverse point 2
+ When sending v1/reverse N2
Then results contain
| ID | display_name |
| 0 | 3, Nickway |
| id | nodes |
| 1 | 1,3 |
When importing
- When sending jsonv2 reverse point 2
+ When sending v1/reverse N2
Then results contain
| ID | display_name | centroid |
| 0 | 10, Nickway | 2 |
context.response = SearchResponse(outp, fmt or 'json', status)
-@when(u'sending (?P<fmt>\S+ )?reverse coordinates (?P<lat>.+)?,(?P<lon>.+)?')
-def website_reverse_request(context, fmt, lat, lon):
+
+@when('sending v1/reverse at (?P<lat>[\d.-]*),(?P<lon>[\d.-]*)(?: with format (?P<fmt>.+))?')
+def api_endpoint_v1_reverse(context, lat, lon, fmt):
params = {}
if lat is not None:
params['lat'] = lat
if lon is not None:
params['lon'] = lon
+ if fmt is None:
+ fmt = 'jsonv2'
+ elif fmt == "''":
+ fmt = None
outp, status = send_api_query('reverse', params, fmt, context)
-
context.response = ReverseResponse(outp, fmt or 'xml', status)
-@when(u'sending (?P<fmt>\S+ )?reverse point (?P<nodeid>.+)')
-def website_reverse_request(context, fmt, nodeid):
+
+@when('sending v1/reverse N(?P<nodeid>\d+)(?: with format (?P<fmt>.+))?')
+def api_endpoint_v1_reverse_from_node(context, nodeid, fmt):
params = {}
params['lon'], params['lat'] = (f'{c:f}' for c in context.osm.grid_node(int(nodeid)))
-
outp, status = send_api_query('reverse', params, fmt, context)
-
context.response = ReverseResponse(outp, fmt or 'xml', status)
-
@when(u'sending (?P<fmt>\S+ )?details query for (?P<query>.*)')
def website_details_request(context, fmt, query):
params = {}