Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 795
saini rahul Avatar asked Jan 19 '26 12:01

saini rahul


1 Answers

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

like image 196
user1432516 Avatar answered Jan 22 '26 05:01

user1432516



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!