Reputation: 168
I'm using this simple maps plugin on a site that I'm currently building http://simplemap-plugin.com/demo/ It's based on google maps API. I only have Zip (in the UK postcode) input visible so this has to be used as a base for the search. The search functionality works fine if you use a full postcode for example W1U *PZ but if you simply type W1 you end up getting a result for a road in Algeria. Does anyone know if there is away in the gMaps API to only search postcodes and exclude any Roads, so that typing the start of a postcode (the area code) will give the desired result.
Upvotes: 1
Views: 108
Reputation: 2723
Perhaps the simplest way would be to simply limit the results to a specific country, in this case I'm presuming the UK.
https://developers.google.com/maps/documentation/geocoding/#RegionCodes
The problem you're going to have with such a query however is how to decide which result to return, simply querying 'W1' is going to return an series of arbitrary addresses whose postcodes contain 'W1' for example NW1. You may be best specifying a minimum length?
Upvotes: 1