Open Elevation API

GET
Elevation Profile

Resource URL

http://open.mapquestapi.com/elevation/v1/profile

Resource Information

Response Formats JSON, XML
Authentication Yes (Requires Key)
Rate Limited Yes

Parameters

Request Parameter Description Required?
key

The API Key, which is needed to make requests to MapQuest services.

Yes
latLngCollection

String/JsonArray

Collection of latitude/longitude pairs for a given route which may be in raw or compressed format. A route session Id may be used in place of this parameter. Yes
sessionId

The Route Session Id can be used in place of a latLngCollection to get the lat/lng positions for an elevation profile request. The session will expire after 30 minutes. Please also see the Advanced Routing and Options Parameters

No - May be used in place of a latLngCollection
inFormat

Specifies the format of the request. The JSON-formatted input text must be supplied as either the "json" parameter of an HTTP GET, or as the BODY of an HTTP POST. If this parameter is "xml", the XML-formatted input text must be supplied as either the "xml" parameter of an HTTP GET, or as the BODY of an HTTP POST.

Must be one of the following, if supplied:

  • json
  • xml

Defaults to "json" if not supplied

No
shapeFormat

String

Shape format options. This value represents the input and output format for the shape points. Default behaviour of the service is to return all the input shape points in the response.

  • raw: shape is represented as float pairs. (default)
  • cmp: shape is represented as a compressed path string with 5 digits of precision.
  • cmp6: shape is represented as a compressed path string with 6 digits of precision.

See the Compressed Lat/Lng description page for more detail, including sample source code and an interactive encoder/decoder.

No
inShapeFormat

String

Input Shape format options. Overrides the given "shapeFormat" value for input shape points.
  • raw: shape is represented as float pairs.
  • cmp: shape is represented as a compressed path string with 5 digits of precision.
  • cmp6: shape is represented as a compressed path string with 6 digits of precision.

See the Compressed Lat/Lng description page for more detail, including sample source code and an interactive encoder/decoder.

No
outShapeFormat

String

Output Shape format options. Overrides the given "shapeFormat" value for output shape points in the response.
  • raw: shape is represented as float pairs. (default)
  • cmp: shape is represented as a compressed path string with 5 digits of precision.
  • cmp6: shape is represented as a compressed path string with 6 digits of precision.
  • none: use this option if input shape points are not needed in the response.

See the Compressed Lat/Lng description page for more detail, including sample source code and an interactive encoder/decoder.

No
unit

String

Specifies the type of units to use when calculating elevation profile. Acceptable values are:
  • m: Metric
  • f: Imperial

Default value is m.

No
useFilter

Boolean

This is a bilinear filter (a smoothing function) that is used when sampling height data. This option will use the lat/lng and look at the four closest lat/lng pairs and weigh them inversely.
  • false: No bilinear filter will be used.
  • true: The bilinear filter will be used.

Default = false

No
outFormat Specifies the format of the response. Must be one of the following, if supplied:
  • json
  • xml

Defaults to json if not supplied.

No
cyclingRoadFactor See the Advanced Routing and Options Parameters No
roadGradeStrategy See the Advanced Routing and Options Parameters No

Example Request

GET

http://open.mapquestapi.com/elevation/v1/profile?key=KEY&shapeFormat=raw&latLngCollection=39.74012,-104.9849,39.7995,-105.7237,39.6404,-106.3736

Example Response

{
   "shapePoints":[
      39.74012,
      -104.9849,
      39.7995,
      -105.7237,
      39.6404,
      -106.3736
   ],
   "elevationProfile":[
      {
         "distance":0,
         "height":1616
      },
      {
         "distance":63.5583,
         "height":3910
      },
      {
         "distance":121.9561,
         "height":2501
      }
   ],
   "info":{
      "copyright":{
         "text":"© 2018 MapQuest, Inc.",
         "imageUrl":"http://api.mqcdn.com/res/mqlogo.gif",
         "imageAltText":"© 2018 MapQuest, Inc."
      },
      "statuscode":0,
      "messages":[

      ]
   }
}
<elevationResponse>
    <distanceHeightCollection>
        <distanceHeight>
            <distance>0.0</distance>
            <height>1616.0</height>
        </distanceHeight>
        <distanceHeight>
            <distance>63.5583</distance>
            <height>3910.0</height>
        </distanceHeight>
        <distanceHeight>
            <distance>121.9561</distance>
            <height>2501.0</height>
        </distanceHeight>
    </distanceHeightCollection>
    <shapePoints>
        <latLng>
            <lat>39.74012</lat>
            <lng>-104.9849</lng>
        </latLng>
        <latLng>
            <lat>39.7995</lat>
            <lng>-105.7237</lng>
        </latLng>
        <latLng>
            <lat>39.6404</lat>
            <lng>-106.3736</lng>
        </latLng>
    </shapePoints>
    <info>
        <info>
            <statusCode>0</statusCode>
            <messages/>
            <copyright>
                <imageUrl>http://api.mqcdn.com/res/mqlogo.gif</imageUrl>
                <imageAltText>© 2018 MapQuest, Inc.</imageAltText>
                <text>© 2018 MapQuest, Inc.</text>
            </copyright>
        </info>
    </info>
</elevationResponse>