react-native-geocoder icon indicating copy to clipboard operation
react-native-geocoder copied to clipboard

Receiving response in an array

Open simonlc opened this issue 7 years ago • 2 comments

Not sure if this intended or not, but unlike the README, I seem to be getting a response within an array.

[
    { 
        streetName: 'Stockton St',
        subLocality: 'Union Square',
        formattedAddress: '1000 Stockton St, San Francisco, CA  94108, United States',
        feature: '1000 Stockton St',
        adminArea: 'CA',
        position: { lng: -122.4065285, lat: 37.7858515 },
        postalCode: '94108',
        countryCode: 'US',
        subAdminArea: 'San Francisco',
        streetNumber: '1000',
        country: 'United States',
        locality: 'San Francisco' 
    } 
]

Is it possible that there is more than one item in this array?

simonlc avatar Jun 16 '17 07:06 simonlc

I am also getting array of response for following code.

       var NY = {
                lat: position.coords.latitude,
                lng:position.coords.longitude
              };

              Geocoder.geocodePosition(NY).then(response => {
                console.log("NY:"+JSON.stringify(response));
         })

The Array of Response [{"streetName":"East Street","feature":null,"locale":"en_US","locality":"XXX city","position":{"lng":80.2582576,"lat":12.9861768},"adminArea":"XXX state","streetNumber":"36","country":"XXX country","countryCode":"XXX country code","postalCode":"null","subAdminArea":"XXX city","formattedAddress":"xxx addr","subLocality":"xxx"}, {"streetName":null,"feature":"yyyy","locale":"en_US","locality":"XXX city","position":{"lng":80.2582576,"lat":12.9861768},"adminArea":"XXX state","streetNumber":null,"country":"XXX country","countryCode":"XXX country code","postalCode":null,"subAdminArea":"XXX city","formattedAddress":"xxx addr","subLocality":"xxx"}, {"streetName":null,"feature":"yyy","locale":"en_US","locality":"XXX city","position":{"lng":80.2565256,"lat":12.9855131},"adminArea":"XXX state","streetNumber":null,"country":"XXX country","countryCode":"XXX country code","postalCode":null,"subAdminArea":"XXX city","formattedAddress":"xxx addr","subLocality":"xxx"}, {"streetName":null,"feature":"xxx","locale":"en_US","locality":"XXX city","position":{"lng":80.2594001,"lat":12.9830269},"adminArea":"XXX state","streetNumber":null,"country":"XXX country","countryCode":"XXX country code","postalCode":null,"subAdminArea":"XXX city","formattedAddress":"xxx addr","subLocality":"xxx"}, {"streetName":null,"feature":null,"locale":"en_US","locality":"XXX city","position":{"lng":80.2707184,"lat":13.0826802},"adminArea":"XXX state","streetNumber":null,"country":"XXX country","countryCode":"XXX country code","postalCode":null,"subAdminArea":"XXX city","formattedAddress":"xxx addr","subLocality":null}, {"streetName":null,"feature":"600041","locale":"en_US","locality":"XXX city","position":{"lng":80.2582576,"lat":12.9861768},"adminArea":"XXX state","streetNumber":null,"country":"XXX country","countryCode":"XXX country code","postalCode":"600041","subAdminArea":null,"formattedAddress":"xxx addr","subLocality":null}, {"streetName":null,"feature":"XXX city","locale":"en_US","locality":null,"position":{"lng":80.254435,"lat":13.0587471},"adminArea":"XXX state","streetNumber":null,"country":"XXX country","countryCode":"XXX country code","postalCode":null,"subAdminArea":"XXX city","formattedAddress":"xxx addr","subLocality":null}, {"streetName":null,"feature":"xxx","locale":"en_US","locality":null,"position":{"lng":80.2321313,"lat":13.1262694},"adminArea":null,"streetNumber":null,"country":null,"countryCode":null,"postalCode":null,"subAdminArea":null,"formattedAddress":"xxx addr","subLocality":null}, {"streetName":null,"feature":"XXX state","locale":"en_US","locality":null,"position":{"lng":78.6568942,"lat":11.1271225},"adminArea":"XXX state","streetNumber":null,"country":"XXX country","countryCode":"XXX country code","postalCode":null,"subAdminArea":null,"formattedAddress":"xxx addr","subLocality":null}, {"streetName":null,"feature":"XXX country","locale":"en_US","locality":null,"position":{"lng":78.96288,"lat":20.593684},"adminArea":null,"streetNumber":null,"country":"XXX country","countryCode":"XXX country code","postalCode":null,"subAdminArea":null,"formattedAddress":"XXX country","subLocality":null}]

for a single request i am getting array of response which contain 10 array of objects.

In the above response the 0th index array object only contain values, which becomes null in the last nth index array object and also the nth index array object lng and lat values is different from 0th index array object.

Asha-Nellaiappan avatar Aug 03 '17 09:08 Asha-Nellaiappan

+1 when querying via text search I also get only one suggestion back

victorbadila avatar Sep 11 '17 13:09 victorbadila