Justin Erswell
Justin Erswell

Reputation: 708

PHP Results and Google Maps

Hi I have a database with a list of contacts in which I am displaying onto a page in a list.

As part of this result set I have a post code, is it possible to generate a google map from that postcode and display it as part of the result?

If it is can any one help me get started?

Upvotes: 1

Views: 177

Answers (2)

Kevin Strong
Kevin Strong

Reputation: 126

You can use the post code as the location for your map and google will usually be able to find it.

For example, using the static maps API, the following url will give you a map for the zip code 92117 (which is in San Diego, CA): http://maps.googleapis.com/maps/api/staticmap?center=92117&size=400x400&sensor=false

You can also do something along the lines of what primehunter326 was suggesting and reverse geocode using the javascript API. Which approach is best depends on what you are trying to do.

Start here for info on how to use the various Google Maps APIs: http://code.google.com/apis/maps/index.html

Upvotes: 2

primehunter326
primehunter326

Reputation: 2902

Yes it is possible. The basic idea is that you use geocode to get longitude and latitude coordinates for the address. You can then use javascript to display a map on your page with all the points as markers. I'll try to find a link with that goes over it in more detail.

Here is a link which goes over geocoding

You'll need an API key in order to use their services, here

Upvotes: 0

Related Questions