I need to display a map on a web page - I have the user's address info, but for security purposes I need the map to be centered on the centroid point of their zip code or city, not their specific address.
Is it possible to submit only a zip code to the Google maps V3 API and have it return a map of a postal code / zip-code?
Or do I have to first geocode the zip code and submit the lat/long?
This is how I was doing it using Yahoo...
//assign the zipcode from the database to the zipcode variable
zipCode = oUser("zipCode")
// create the container
<div id="map" class="map">
// Create a map object
var map = new YMap(document.getElementById('map'));
// Display the map centered on the zipcode
If you go to google.com/maps and enter a 5 digit US zip code, the website will return a map that is centered on the central point of that zip code. The script above did the same thing on my website (until Yahoo discontinued its map service).
I’d like to do the same thing using the Google API – but everything I’ve seen so far indicates that I have to send the long/lat string of the zip-code centroid point to the API - which is fine (we have a zip-code/long/lat table in the database) – it just requires more server work on our end – or on Google’s if I geocode a zipcode on the fly). I’d like to keep this as efficient as possible and send only the postal_code if possible.
Can that be done?