Tom
Tom

Reputation: 1

How to get suburbs by postcode?

I search by postcode http://autocomplete.geocoder.api.here.com/6.2/suggest.json?app_id=API_ID&app_code=APP_CODE&query= 3084&country=AUS

Expect results will be all suburbs(Viewbank, Rosanna, Heidelberg ...) have the postcode 3084, but the result is Melbourne in general, these suggestions don't help:

{
    "suggestions": [
        {
            "label": "Australia, VIC, 3084, Melbourne",
            "language": "en",
            "countryCode": "AUS",
            "locationId": "NT_XPjzlLh3Twzu3wr29Eo-cD",
            "address": {
                "country": "Australia",
                "state": "VIC",
                "city": "Melbourne",
                "postalCode": "3084"
            },
            "matchLevel": "postalCode"
        }
    ]
}

And this below results (from addresser install in my local elasticsearch, not from hereapi) are the expected ones:

"suggestions":[  
         {  
            "source":{  
               "postcode":"3084",
            },
            "type":"postcode",
            "display":{  
               "text":"3084"
            }
         },
         {  
            "source":{  
               "postcode":"3084",
               "state":"VIC",
               "name":"Viewbank"
            },
            "type":"suburb",
            "display":{  
               "text":"Viewbank, VIC 3084"
            }
         },
         {  
            "source":{  
               "postcode":"3084",
               "state":"VIC",
               "name":"Heidelberg"
            },
            "type":"suburb",
            "display":{  
               "text":"Heidelberg, VIC 3084"
            }
         },
         {  
            "source":{  
               "postcode":"3084",
               "state":"VIC",
               "name":"Rosanna"
            },
            "type":"suburb",
            "display":{  
               "text":"Rosanna, VIC 3084"
            }
         },
         {  
            "source":{  
               "postcode":"3084",
               "state":"VIC",
               "name":"Eaglemont"
            },
            "type":"suburb",
            "display":{  
               "text":"Eaglemont, VIC 3084"
            }
         }
      ]

Upvotes: 0

Views: 492

Answers (1)

Related Questions