Jump to content

Converting lat/long Degrees minutes to google decimal format


mrking

Recommended Posts

I have a form where you can enter coordinates (values that get written to my MySQL database) in the format of N49 26.222 W122 35.222. We use that format for our group as it is a standard for marking waypoints.

 

Now I am coding some php to plot the MySQL data into a google map API. Everything works great with my test database as I have the coordinate values of 49.437033, -122.587033

 

Now before I set up the database for that style of coords I tested it with writing data to it using my two variable $latitude and $longitude. All worked well.

 

But, I now need an intermediate php function that will take the input form data coords of  N49 26.222 W122 35.222 convert them to decimal format, 49.437033, -122.587033 and then upload the converted coords to the database.

 

I have no idea where to start. Can anyone give me a hand?

 

Cheers,

 

mike

not sure on this one i have done a fasir bit of work with maps an so on and created a system to create postcode into longlat in a way that i could have a database full of postcodes and just convert to decimal (lon and lat) but or a less you can find a way of enter your info into multimap then you can't really parse it.. possibly look for another site that can do it?

 

http://www.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html

 

Looks like that site does it.. you may possibly be able to automate the process via there site or read up further on how to convert yourself.

 

possible helpful links:

http://geography.about.com/library/howto/htdegrees.htm

AND

EVEN a Microsoft article on it :o lol

 

http://support.microsoft.com/kb/213449

 

 

 

Regards

Liam

have a look here, this is a javascript version of what you want, when you view source you get a warning sayin you can use the function, you can then pull it apart and make it a php script here is the link

<a href="http://www.uky.edu/KGS/gis/converter.htm">Lat-Long Converter</a>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.