This day, I am starting develop an application to display some “marking” on the google map, I use code igniter frame work, for the google map, I use Google Map Api that can be found at phpinsider. All process work smoothly with guide from code igniter wiki. I sign up for google map key insert into controller, using default example provided by the wiki it work well.
The trouble come when I’m tyring insert garmin GPS data into the script, I have old GPS data from garmin GPS with text format like this :
Waypoint PLACE 20-DEC-05 11:45:26 User Waypoint S7 33.560 E110 49.891 378 ft Symbol & Name Unknown Radio Beacon
The marking function of the google API need longitude and latitude, and I must convert those data in to longitude and latitude format. It’s long time for me tho figureout how to conver the data in to acceptable format for the API.
After couple hour stuck with this conversion I finally could do this conversion, with help of picture below, finaly I can make right longitude and latitude
From my GPS data
E 110 49.891 [East 110 degree 49.891 minute]
Converted to fully degree format, (49.891 devide by 60) got 0,83151
The longitude is 110.83151 degree
S 7 33.560, [South 7 degree 33.560 minute]
Converted to fully degree, the 33.560 devide by 60 got 0.5593
The latitude is -7.5593 degree (this is the important thing, according above picture, because my GPS data use South format it should be negatif)
And the php code :
$this->cigooglemapapi->addMarkerByCoords(110.83151,-7.5593,’some place’,'<b>THE PLACE</b>’);
PS : Need conversion to longitude and latitude ?
Check my conversion tool at http://a3-system.info/demo/longlat