如何在codeigniter中使用google地图连接多个标记?
我必须连接多个标记点才能在谷歌地图上显示方向。我用过codeigniter。我已经提到这一点 在标记之间没有连接路线的示例。请帮帮我 控制器:如何在codeigniter中使用google地图连接多个标记?,codeigniter,google-maps-api-3,google-maps-markers,Codeigniter,Google Maps Api 3,Google Maps Markers,我必须连接多个标记点才能在谷歌地图上显示方向。我用过codeigniter。我已经提到这一点 在标记之间没有连接路线的示例。请帮帮我 控制器: public function geoLocation(){ $this->load->library('googlemaps'); $config['center'] = '37.4419, -122.1419'; $config['zoom'] = 'auto'; $co
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'] = 'Bavdhan, Pune, India';
$this->googlemaps->initialize($config);
$data['map'] = $this->googlemaps->create_map();
$this->load->view('google-map', $data);
}
我更新的控制器方法:
public function index()
{
$this->load->library('googlemaps');
$config['center'] = 'Pune, India';
$config['zoom'] = 'auto';
$config['directionsMode']="WALKING";
$config['directionsWaypointArray'] = array('Hadapsar, Pune, India','Swargate, Pune, India','Bavdhan, Pune, India');
$this->googlemaps->initialize($config);
$marker = array();
$marker['position'] = 'Hadapsar, Pune, India';
//$marker['onmouseover'] = 'ahssdfsdf';
$marker['infowindow_open']= true;
$this->googlemaps->add_marker($marker);
$marker['position'] = 'Bavdhan, Pune, India';
$this->googlemaps->add_marker($marker);
$data['map'] = $this->googlemaps->create_map();
$this->load->view('welcome_message', $data);
}
}
这是我的html代码:
<?php echo $map['js']; ?>
<div id="nevi">
<div id="menu">
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex="0" style="font-size:14px" id="today_st">Today's status </li>
<li class="TabbedPanelsTab" id="report" tabindex="0" style="font-size:14px">Reports</li>
</ul>
<div class="TabbedPanelsContentGroup" style="margin-top:74px;">
<div class="TabbedPanelsContent">
<?php echo $map['html']; ?>
</div>
</div>
</div>
</div>
</div>
您需要指定以下内容:
directionsWaypointArray
根据:
航路点是起点和终点之间的位,因此我假设您只需要执行以下操作:
$config['directionsStart'] = 'Hadapsar, Pune, India';
$config['directionsEnd'] = 'Bavdhan, Pune, India';
$config['directionsWaypointArray'] = array("swargate, Pune, India");
这不是在这个网站上提问的方式。向我们展示您的代码和您尝试过的内容。此外,还不清楚你在问什么。是要使用方向显示管线,还是要通过直线多段线链接多个标记。在任何情况下,您问题中链接上的文档都包含您需要的所有内容。我能在不到一分钟内找到它。我已经附上了我的代码。我想用3个位置上的标记点显示路线方向。Hadapsar是我的起点,swargate是我的中点,Bavdhan是我的终点。使用这三个,我必须在它们之间显示方向。PS:文档中没有给出任何使用DirectionsWayPointArraI的示例,我已经尝试过了。但不幸的是,它不起作用。请更新其他方法。您能否更新您的问题,以显示如何添加waypoints数组以及生成的Javascript?我已经更新了一个代码。你能看一下吗。啊,你仍然需要指定方向开始和方向结束。我将更新我的代码,给出一个我认为可行的示例
$config['directionsStart'] = 'Hadapsar, Pune, India';
$config['directionsEnd'] = 'Bavdhan, Pune, India';
$config['directionsWaypointArray'] = array("swargate, Pune, India");