views:

1166

answers:

2

I am currently working on a project where users need to be able to enter geological data (such as a certain street name) into a website which will be put into a database and then retrieved and displayed on a Google map for all users to see.

I've done a little research and so far it looks like the best way to do this is to use a php script for getting data and sending it to a mySQL database where it can then be retrieved by another php script and then passed to javascript to display on the map.

From a big picture standpoint is this the best way to do things?

Thanks in advance!

+3  A: 

Looks like your problem has a few separate steps:

  1. Sign up for a Google Maps API key.

  2. Write something that lets the user input the address and save it in the database.

  3. The same script should convert the address to a coordinate using Geocodeing. The result should (must) be saved in the database as well since Google will only accept 15k Geocode queries per ip per day. Since you will be saving the results it would only be a problem if you are going to add more than 15k items to your map in one day.

  4. Write the script that generate the map. There may be some cool Google API calls, if not you will have to do do some work yourself. Cache the map with a time-stamp so you can save some processor / time.

  5. Create an interface that will display the map, integrate with step 2a, and call step 3.

Phil
Looks like I'm on the right track, thanks for the help.
Shraptnel
I hope it goes well for you, if you get stuck I might be interested in giving some more help with it. You have an interesting project. My website (in profile) has contact info.
Phil
+1  A: 

@Phil's response is good. Here are a few of my additions:

Google geocoding doesn't have to be done server side. The 15k limit counts against the client ip not the server ip. If it did, a single malicious client could use up the host site's limit and effectively DOS the site's geocoding features.

http://code.google.com/support/bin/answer.py?answer=93464&topic=12266

One reason to perform the geocoding server-side before storing the db result is it may make it easier to validate the user's entry to make sure the address they enter is, in fact, geocodable. In that case you are subject to a 15k query host limit. If you put the validation code on the client you spread the request out to all the clients.

There are some nifty Google API calls. A quick peek through the docs will reveal a straightforward process of:

  • Fetch the address from the db
  • Geocode it into a GPoint
  • Center the map on the GPoint
  • And possibly drop a marker on the GPoint

These types of things are covered in the docs pretty completely.

http://code.google.com/apis/maps/documentation/examples/

Also, to directly answer your question. Yes, it looks like you are on the right track.

GloryFish