我节省每15分钟的纬度和经度。我需要在codeigniter中的谷歌地图上绘制一条带有已保存数据标记的路线。给出起点和终点的一些例子,但我需要在地图上显示我的数据库值。请提出一些有关此主题的解决方案。
控制器方法:
public function geoLocation(){
$this->load->library('googlemaps');
$config['center'] = '37.4419, -122.1419';
$config['zoom'] = 'auto';
$config['directions'] = TRUE;
$config['directionsStart'] = 'Hadapsar, Pune, India';
//$config['directionsDivID'] = 'swargate, Pune, India';
$config['directionsEnd'] = 'swargate, Pune, India';
$config['directionsStart'] = 'swargate, Pune, India';
//$config['directionsDivID'] = 'swargate, Pune, India';
$config['directionsEnd'] = 'Bavdhan, Pune, India';
$this->googlemaps->initialize($config);
$data['map'] = $this->googlemaps->create_map();
$this->load->view('google-map', $data);
}
我的观点:
<html>
<head><?php echo $map['js']; ?></head>
<body><?php echo $map['html']; ?></body>
<div id="directionsDiv"></div>
</html>
检查上面我有三点:Hadapsar,swargate,Bavdhan。我想在三个车站画路线。
答案 0 :(得分:0)
感谢您使用我的图书馆。你看过航点了吗?
这可能是您正在寻找的。只有我能想到的其他事情是,不要使用方向,使用折线:
http://biostall.com/demos/google-maps-v3-api-codeigniter-library/polyline
答案 1 :(得分:0)
我想要相同的结果我有一系列的方向,我想要绘制路线 我选择这个代码
$this->load->library('googlemaps');
$config['center'] = 'udaipur, rajasthan, india';
$config['zoom'] = 'auto';
$config['directions'] = TRUE;
$config['directionsMode'] = "WALKING";
$config['directionsStart'] = '24.5862087,73.6937057';
$config['directionsWaypointArray'] = array(
"24.5866843,73.6890816",
"24.5878709,73.6878411",
"24.5900044,73.6896301",
"24.5973893,73.6857516"
);
$config['directionsEnd'] = '24.6045763,73.6853708';
$config['directionsDivID'] = 'directionsDiv';
$this->googlemaps->initialize($config);
$data['map'] = $this->googlemaps->create_map();
$this->load->view('welcome_message', $data);