How to select the best result from multiple possibles in the response.

5 posts / 0 new
Last post
gokulakrishnan
How to select the best result from multiple possibles in the response.

I need to select the best result from the Geocode API when there is a multiple possibles in the response.

Geocode API returns multiple responses with same GeoQualityCode "B1AAA" and different latitude and longitude for provided location "Glenarm Place, Denver, CO".

How to select one best result from the response based on their accuracy?

 

 

{

  "info": {

    "statuscode": 0,

    "copyright": {

      "text": "© 2018 MapQuest, Inc.",

      "imageUrl": "http://api.mqcdn.com/res/mqlogo.gif",

      "imageAltText": "© 2018 MapQuest, Inc."

    },

    "messages": []

  },

  "options": {

    "maxResults": -1,

    "thumbMaps": false,

    "ignoreLatLngInput": false

  },

  "results": [

    {

      "providedLocation": {

        "location": "Glenarm Place, Denver, CO"

      },

      "locations": [

        {

          "street": "[2000 - 3099] Glenarm Pl",

          "adminArea6": "",

          "adminArea6Type": "Neighborhood",

          "adminArea5": "Denver",

          "adminArea5Type": "City",

          "adminArea4": "Denver",

          "adminArea4Type": "County",

          "adminArea3": "CO",

          "adminArea3Type": "State",

          "adminArea1": "US",

          "adminArea1Type": "Country",

          "postalCode": "80205",

          "geocodeQualityCode": "B1AAA",

          "geocodeQuality": "STREET",

          "dragPoint": false,

          "sideOfStreet": "M",

          "linkId": "rnr4257651",

          "unknownInput": "",

          "type": "s",

          "latLng": {

            "lat": 39.747766,

            "lng": -104.985355

          },

          "displayLatLng": {

            "lat": 39.747766,

            "lng": -104.985355

          }

        },

        {

          "street": "[1300 - 1899] Glenarm Pl",

          "adminArea6": "",

          "adminArea6Type": "Neighborhood",

          "adminArea5": "Denver",

          "adminArea5Type": "City",

          "adminArea4": "Denver",

          "adminArea4Type": "County",

          "adminArea3": "CO",

          "adminArea3Type": "State",

          "adminArea1": "US",

          "adminArea1Type": "Country",

          "postalCode": "80202",

          "geocodeQualityCode": "B1AAA",

          "geocodeQuality": "STREET",

          "dragPoint": false,

          "sideOfStreet": "M",

          "linkId": "rnr4257619",

          "unknownInput": "",

          "type": "s",

          "latLng": {

            "lat": 39.743535,

            "lng": -104.990809

          },

          "displayLatLng": {

            "lat": 39.743535,

            "lng": -104.990809

          }

        },

        {

          "street": "[1101 - 1398] Glenarm Pl",

          "adminArea6": "",

          "adminArea6Type": "Neighborhood",

          "adminArea5": "Denver",

          "adminArea5Type": "City",

          "adminArea4": "Denver",

          "adminArea4Type": "County",

          "adminArea3": "CO",

          "adminArea3Type": "State",

          "adminArea1": "US",

          "adminArea1Type": "Country",

          "postalCode": "80204",

          "geocodeQualityCode": "B1AAA",

          "geocodeQuality": "STREET",

          "dragPoint": false,

          "sideOfStreet": "M",

          "linkId": "rnr4269002",

          "unknownInput": "",

          "type": "s",

          "latLng": {

            "lat": 39.740774,

            "lng": -104.9944

          },

          "displayLatLng": {

            "lat": 39.740774,

            "lng": -104.9944

          }

        }

      ]

    }

  ]

}


MQBrianCoakley
Since no address was provided
Since no address was provided, any of the similarly quality coded results can be chosen. Generally, results are returned in order of confidence and granularity. The order was chosen to handle user input on MapQuest.com and takes into consideration user input from the beginning of MapQuest.com. In this case, any can be chosen since they're all along Glenarm Pl. Anytime there is not a single exact result, ambiguous results can be returned.

gokulakrishnan
Thanks for your help.

Thanks for your help.


gokulakrishnan
Thanks for your help.

Thanks for your help.


MQBrianCoakley
You're welcome.
You're welcome.