谷歌地图php mysql导航

I had a small project:

  • agent has android application, that send his coordinates (latitude,longitude) to mysql database

  • the table is

gps_position

CREATE TABLE IF NOT EXISTS `gps_position` (
  `gps_id` int(11) NOT NULL AUTO_INCREMENT,
  `device_id` varchar(50) NOT NULL,
  `latd` varchar(50) NOT NULL,
  `lotd` varchar(50) NOT NULL,
  `address` varchar(200) NOT NULL,
  `jam` datetime NOT NULL,
  PRIMARY KEY (`gps_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;

I need a web report Php (map) to view current location of my agent by read from my table above. if he/she moves from a place. the web will show his/her movement

I would use Google Maps' JavaScript API to display the current location, and jquery on the backround querying a php file to get the current pos stored in the database every 20 seconds.

So you need: - Implement a simple map with Google Maps API (https://developers.google.com/maps/documentation/javascript), which is able to show specific coordinates on your map.

  • Create a php file that returns the coordinates of a specific user (the one you want to display) when queried.

  • A jQuery function doing an http request to that file (AJAX request), and getting back the coordinates every x seconds. When you get them, use GMaps JavaScript API to set again the coordinates the map is pointing at.

Hope that helps!