Retrieval of Area Shapes
Location information of geocoding requests can include area or postal code shape information. These shapes can be used as map overlays, for example. To get shape information add additionaldata=IncludeShapeLevel,<level>
to the request.
Valid shape levels are: country
, state
, county
, city
, district
, postalCode
, default
Level default
returns the area shape corresponding to the match level.
The following example adds the postal code shape information to the response:
https://geocoder.ls.hereapi.com/6.2/geocode.xml
?searchtext=94301+USA
&additionaldata=IncludeShapeLevel,postalCode
&apiKey={YOUR_API_KEY}
&gen=9
The shape information is in Well Known Text (WKT) format, in the element Shape in x y format where x is longitude and y latitude.
<Location>
<Address>
...
<PostalCode>94301</PostalCode>
...
</Address>
<Shape>
<Value>POLYGON ((-122.13053 37.43417, -122.13080
37.43374, -122.13085 37.43369, -122.13119 37.43349, -122.13158
37.43326,
-122.13181 37.43319, -122.132 37.43319, -122.13251 37.4333,
-122.13275
37.4334
...
-122.13053 37.43417))
</Value>
</Shape>
<Location>
Shapes can consist of multiple polygons. Example:
<Location>
<Address>
...
<PostalCode>94304</PostalCode>
...
</Address>
<Shape>
<Value>MULTIPOLYGON (((-122.14427 37.42147, -122.14158 37.42004,
-122.14067 37.42117,
...
-122.14427 37.42147)), ((-122.17107 37.44626,
...
-122.17107 37.44626)))
</Value>
</Shape>
<Location>