[GIS] Looking for an API that will autocomplete adresses, and split them up into parts

addressgoogle-maps-apijavascriptjson

I'm kinda new to the whole GIS thing, and found that is necessary for onw of my web apps. It's come to my attention that some people don't know what a proper physical address looks like, and so I'd like to make life a little easier.

I have an app that requests a person's physical address. Instead of typing in the full thing, I'd like to use an autocomplete service. I'm in South Africa, so AfriGIS seems to be the best bet. However, I can't seem to find a service that will autocomplete an address for me, and split that same address (result) into it's parts. For example, in JSON:

{
    'address': {
        'streetNumber': 12,
        'streetName': 'Main Street',
        'suburbTown': 'Kensington',
        'city': 'Johannesburg',
        'province': 'Gauteng'
        'streetCode': '2094',
        <etc>
    }
}

Are there any services that support this functionality (for South Africa, of course)?

Update:

This is very close to what I'm looking for: https://google-developers.appspot.com/maps/documentation/javascript/examples/full/places-autocomplete-addressform

However, it is not very accurate in terms of complete addresses. In the above case, Google will not return the suburb. In South Africa, suburbs are areas, and not city outskirts. Also, the Zip codes it returns are wrong.

Best Answer

If you had the data yourself then there are many javascripts and jquery libraries that do autocomplete like these

http://jqueryui.com/autocomplete/

But one of the best examples I have seen recently is Bryan McBride's Bootleaf demo which is here

http://bmcbride.github.io/bootleaf/

If you use the search box and the top and start typing Museums you will see an autocomplete list with graphics and if you pick one it zooms the map. This data comes from a geojson file which is searched by using an automcplete javascript library called TypeAhead that Twitter released as part of Bootstrap but there is also a standalone version.

http://twitter.github.io/typeahead.js/

However, if you do not have the data yourself then there are standard geocoding services from Google, yahoo, Bing that you could put a jquery wrapper around to help with the autocomplete

Related Question