saini rahul
saini rahul

Reputation: 41

Google Map - How to save location in DB?

I've recently started working on Google maps. Here is a sample html code:

<div id="locationContainer">
    <input id="startPT" type="text" size="50"/>
    <input id="wayPT" type="text" size="50"/>
    <input id="endPT" type="text" size="50"/>
</div>

I have attached autocomplete feature on all the location input text fields

Now, I have two issues;

  1. How to save the location in a mySQL DB? I mean, should I save just the location on first fetching the coordinates and then save?
  2. Before saving to the DB, I want to validate that the location does exist in Google Maps. So that my system does not blindly save some xyz in DB.

Hope I've made my question understandable.

Thanks

Upvotes: 3

Views: 4375

Answers (1)

user1432516
user1432516

Reputation: 31

1.saving the Latitude Longitude in 2 diffrent fields in the mysql database seems to be the best possibility.

2.the location exists in google maps if it exists in the world. this might give you an answer: http://answers.yahoo.com/question/index?qid=20071121075230AATuvo3

latitude has a minimum of -90 (south pole) and a maximum of 90 (north pole). 0 degrees latitude is the equator.

Longitude has a minimum of -180 (west of the prime meridian) and a maximum of 180 (east of the prime meridian). -180 and 180 are the same line, approached from opposite directions

good luck

Upvotes: 3

Related Questions