Dev: SM: Reverse Geocoding

From AAT Wiki
Jump to: navigation, search

Introduction

The Reverse Geocoding API provides a rich geocoding solution. It is both very accurate and fast.

Usage

/api/rev_geocode/?key=YOUR_API_KEY&x=X_COORD&y=Y_COORD[&range=METERS][&xml=1][&sym=1][&areaspeed=M][&musthavelabel=1]
/api/rev_geocode/?key=YOUR_API_KEY&x1=X_COORD&y1=Y_COORD&x2=X_COORD&y2=Y_COORD...&[&range=METERS][&xml=1][&sym=1][&areaspeed=M][&musthavelabel=1]
key
Your API key
x, y
x1, y1 ... xN,yN
The X (E-W) and Y (N-S) coordinates. These are in decimal degrees.
range
(optional) - The the nearest road will only be returned if it's within the specfied range, in meters.
xml=1
(optional) - The results will be returned in XML format
sym=1
(optional) - The results will be returned in Symbolic format
areaspeed
(optional) - The maximum speed limit of roads within the range, specified in meters, is returned.
musthavelabel=1
(optional) - The nearest road with a label will be returned. The maximum search range for a labelled road is 5km.

Return - CSV (Default)

If neither xml=1 or sym=1 are specified, a simple CSV list will be returned - this contains only basic information:

Road_Full_Name,Suburb,City,Province,Avg_Pos_X,Avg_Pos_Y,ExtraInfo
  • Fields which cannot be calculated are returned as "-" ... this applies should there be no road in the specified range.
  • The ExtraInfo field is populated if there's no road match, it will be a description of the position of the point, in plain english

Return - Symbolic Format

Should sym=1 be specified, the results are returned in symbolic format:

NM=Willingdon Avenue/SU=Kloof/CI=Kloof/PR=KwaZulu-Natal/X=30.837525/Y=-29.794108/EX=-

The format is a number of symbol=data pairs, delimited by a / slash. The symbols may be:

NM Road Name
SU Suburb
CI City
PR Province
X X coordinate passed in
Y Y coordinate passed in
EX Extra data
MS Maximum speed in a "M" radius (if areaspeed parameter is used)

Return - XML

The return from the XML format is quite self-explanatory. A few fields need to be clarified:

Layer
ROADS_MAJOR National Road
ROADS_MAIN Municipal Road
ROADS_MAIN_O Other Main Road
ROADS_RAMP Ramp or Slipway
ROADS_SUB Suburban Roads
ROADS_SUB_O Other, smaller, suburban roads
ROADS_SEC Secondary Roads
ROADS_TRACK Tracks
ROADS_TRAIL Trails
ROADS_PRIVATE Private Roads
ROADS_OTHER Unclassified Roads