Geocoding API

All mapping APIs that are used in mobile or web apps need some geo-position coordinates to refer to any given point on the map. Our Geocoding API converts real addresses into these geographic coordinates (latitude/longitude) to be placed on a map, be it for any street, area, postal code, POI or a house number etc.

API URL

  1. Basic URL structure:
     http://apis.mapmyindia.com/advancedmaps/v1/<licence_key>/geo_code?addr=<query>&pin=<query>
  2. Output:The output format would be JSON.
  3. HTTP Request Method: GET

Request Parameters

The following input parameters will be supported in the Geocoding API request

  1. addr: The below are the supported input queries,
      a. eLoc: The 6-digit alphanumeric code for any location. (e.g. mmi000).
      b. address: The address of a location (e.g. 237 Okhla Phase-III).
      c. POI: The name of the location (e.g. MapmyIndia Head Office).
      d. House Number: The house number of the location in case full address is unknown
                                    (e.g. P-  18/114).
  2. pin: The pin-code of area (e.g. 110020).
  3. Licence_key: the REST API licence key allocated to you by signing into our services and registering yourself as a developer (28 Char Alphanumeric).

Response Parameters

The API returns an enveloped response with the geocode data in the results object.

  1. responseCode (int): The response code of the operation. The 400 series is for client side (yours) error while 500 series for server side (ours) error, 200 for success.
  2. version (string): The version of the API you’re connected to.
  3. results (object[ ]): A collection containing a single object of the Geocoded response data consisting of the following properties
    • houseNumber (string): The house number of the location.
    • houseName (string): The name of the location.
    • poi (string): The name of the POI if the location is a place of interest (POI).
    • street (string): The name of the street of the location.
    • subSubLocality (string): The name of the sub-sub-locality where the location exists.
    • subLocality (string): The name of the sub-locality where the location exists.
    • locality (string): The name of the locality where the location exists.
    • village (string): The name of the village if the location exists in a village.
    • district (string): The name of the district in which the location exists.
    • subDistrict (string): The name of the sub-district in which the location exists.
    • city (string): The name of the city in which the location exists.
    • state (string): The name of the state in which the location exists.
    • pincode (string): The pin code of the location area.
    • lat (double): The latitude of the location.
    • lng (double): The longitude of the location.
    • formatted_address: The complete human readable address string that is usually the complete postal address of the result.
    • place_id (string): The eLoc or placeId assigned for a place in map database. An eLoc is the digital identity for an address or business to identify its unique location. For more information on eLoc, click here.
    • type (string): defines the type of location matched (HOUSE_NUMBER, HOUSE_NAME, POI, STREET, SUB_LOCALITY, LOCALITY, VILLAGE, DISTRICT, SUB_DISTRICT, CITY, STATE, SUBSUBLOCALITY, PINCODE)

Please Note: The entire result will be a part of only the first Item of the result collection as it’s the best matched result. In case of items that are not the item of the collection only the formatted_address, type, place_Id would be returned. To get the data about the other responses, pass in the eLoc of the location to the Place Details API. The maximum number of results you will receive is 30.

Performance

The Geocode API must respond within 100 Ms under all circumstances on a stable internet connection although on an unstable one, response times may vary.

Transaction Information

One request using the API link will be considered as one transaction.

Use Cases

  • To do a quick keyword search for a more detailed data on the required location.
  • To perform a search on enter key press if the desired location was not found in the autosuggest.

Example

Input:
http://apis.mapmyindia.com/advancedmaps/v1/<licence_key>/geo_code?addr=saket

Output:

{  "responseCode": "200",  "version": "130.11",  "results": [  {  "houseNumber": "",  "houseName": "",  "poi": "Saket Club",  "street": "",  "subSubLocality": "",  "subLocality": "Saket",  "locality": "Sainikpuri",  "village": "",  "district": "Rangareddy District",  "subDistrict": "Keesara",  "city": "Hyderabad",  "state": "Telangana",  "pincode": "500094",  "lat": "17.502747000000099",  "lng": "78.574045000000098",  "formatted_address": "Saket Club, Saket, Sainikpuri, Keesara, Rangareddy District, Hyderabad, Telangana",  "place_id": "8343AT",  "type": "POI"  },  {  "formatted_address": "Saket J Block Bus Stop, Saket Road, Block J, Saket, Hauz Khas, South District, New Delhi, Delhi",  "place_id": "CF1SC5",  "type": "POI"  },  {  "formatted_address": "Saket Book Depot, Saket Road, Block J Market, Saket, Hauz Khas, South District, New Delhi, Delhi",  "place_id": "754TFE",  "type": "POI"  },  {  "formatted_address": "Saket G Block Bus Stop, Saket Road, Saket, Hauz Khas, South District, New Delhi, Delhi",  "place_id": "444DFS",  "type": "POI"  },  {  "formatted_address": "OyoRooms Premium, Saket Road, Block E, Saket, Hauz Khas, South District, New Delhi, Delhi",  "place_id": "O3AFJG",  "type": "POI"  },  {  "formatted_address": "Saket Towers Apartment, Hajari Road, Saket Complex, Thane West, Thane, Thane District, Thane, Maharashtra",  "place_id": "55TT21",  "type": "POI"  },  {  "formatted_address": "Saket, Jhalrapatan, Jhalawar District, Jhalawar, Rajasthan",  "place_id": "Y3WSP6",  "type": "LOCALITY"  },  {  "formatted_address": "Saket, Hoshangabad, Hoshangabad District, Madhya Pradesh",  "place_id": "1T6SD2",  "type": "VILLAGE"  },  {  "formatted_address": "Saket, Pathariya, Bilaspur District, Chhattisgarh",  "place_id": "6DT846",  "type": "VILLAGE"  },  {  "formatted_address": "Saket Garden, New Saket Colony, Indore, Indore District, Indore, Madhya Pradesh",  "place_id": "3FD446",  "type": "POI"  }  ]  }