How do I make Geocoding API request to MapQuest API?

To make a geocoding API request to the MapQuest API, you need to make an HTTP POST request to the mapquestapi geocoding API endpoint and provide JSON with the location data and the MapQuest API key in the URL parameter. The MapQuest API will return JSON with latitude and longitude for the given address.
Loading...
Updated: Viewed: 8129 times

What is MapQuest?

MapQuest is a free online mapping service. It provides features such as street detailing and projection and driving directions for selected countries. MapQuest supports voice navigation and real-time traffic information. Besides maps, it also maintains various travel blogs and information on many attractive travel destinations through MapQuest Discover.

How to use MapQuest Geocoding API?

To use the MapQuest Geocoding API in your application, you need to register with the MapQuest website and obtain a free API key for your application. After that, you can make geocoding API requests to MapQuest and get the associated latitude and longitude of the address, calculate optimized routes, or search within the radius of the origin point.

MapQuest Geocoding API Request Example

An example of sending a geocoding API request to a MapQuest API endpoint.

MapQuest Geocoding Request
POST /geocoding/v1/address?key={mapquest_apikey} HTTP/1.1
Host: www.mapquestapi.com
Content-Type: application/json
Content-Length: 80

{
  "location": "Broadway, New York",
  "options": {
    "thumbMaps": true
  }
}

Server response to our geocoding request.

MapQuest Server Response to Geocoding Request
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1736

{
   ...
    "results": [{
		"adminArea3": "NY",
		"adminArea1": "US",
		"geocodeQuality": "CITY",
		"latLng": {
			"lat": 42.3661,
			"lng": -78.544701
		}
    }]
   ...
}

Generate Code Snippets for Geocoding API Example

Convert your Geocoding API request to the PHP, JavaScript/AJAX, Curl/Bash, Python, Java, C#/.NET code snippets using the ReqBin code generator.