Nominatim

With version 6.1 of our Open JavaScript API, you can create POI's by searching an address directly on the map using Nominatim. This module is intended to be extended and customized for your particular use case. The following samples are only a starting point for integration.

Nominatim indexes named (or numbered) features with the OpenStreetMap data set and a subset of other unnamed features (pubs, hotels, churches, etc).


Search terms are processed left to right so

pilkington avenue, birmingham

will work, and

birmingham, pilkington avenue

will fail. Commas are optional but improve performance by reducing the complexity of the search so

pilkington avenue birmingham

will succeed. Where house numbers have been defined for an area they will be used:

135 pilkington avenue, birmingham

Like other modules in the API, you must first download and initialize the nominatim support modules prior to use with the MQA.withModule mechanism as it is not included in the base download.


Basic Nominatim Search

 
//This uses the MQA.withModule support to download and initialize the Nominatim support module.  When the 
//module is ready for use, the function provided as the last parameter will be executed.
MQA.withModule('nominatim', function() {
	  
  /*Executes a Nominatim search and adds result to the map*/
  map.nominatimSearchAndAddLocation("300 granite run drive, lancaster, pa, us", null);

});

Show me the code

Play with the code


Multiple Nominatim Search Results

 
//This uses the MQA.withModule support to download and initialize the Nominatim support module similar to the example
//above. However, in this case, multiple results are returned and all are added to the map.
MQA.withModule('nominatim', function() {
	
  /*Executes a Nominatim search and adds result to the map*/
  map.nominatimSearchAndAddLocation("McDonalds, lancaster, pa, us", null);

});

Show me the code

Play with the code


Nominatim Reverse Lookup

Nominatim also provides reverse geocoding and address lookups. Reverse geocoding generates an address from a latitude and longitude.

 
//This uses the MQA.withModule support to download and initialize the Nominatim support module. Reverse geocoding
//is unlike the above searches because we are providing a latitude and longitude instead. 
MQA.withModule('nominatim', function() {

  /*Executes a Nominatim Reverse Geocode and adds result to the map*/
  map.nominatimReverseAndAddLocation({lat: 39.7391536, lng: -104.9847034}, null);
 
});

Show me the code

Play with the code



Next Section: Routing



  © MapQuest, Inc. All rights reserved.    Privacy Policy | Terms of Use