【发布时间】:2018-02-16 00:33:01
【问题描述】:
我需要在谷歌地图中添加多个标记(通过使用 googlemap 库添加谷歌地图)。我还在这张地图中添加了一个标记。 对于单个标记代码:
控制器:
$data['tunnels'] = $this->functional->getTunnelData();
$config['center'] = '37.4419, -122.1419';
$config['zoom'] = 'auto';
$this->googlemaps->initialize($config);
$marker = array();
$marker['position'] = 'center';
$this->googlemaps->add_marker($marker);
$data['map'] = $this->googlemaps->create_map();
型号:
$this->db->select('ult_tunnel.*,ult_country.name as country_name,ult_state.name as state_name,ult_city.name as city_name ')
->join('ult_country','ult_country.id = ult_tunnel.country_id')
->join('ult_state','ult_state.id = ult_tunnel.state_id')
->join('ult_city','ult_city.id = ult_tunnel.city_id')
->from('ult_tunnel')
->where('ult_tunnel.status','Active')
->get()->result();
查看:
<div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" id="map">
<?php echo $map['js']; ?>
<?php echo $map['html']; ?>
</div>
请帮我在这个 googlemap 中添加多个标记。 任何帮助将不胜感激。
提前致谢。
已编辑:
表结构: 它包含:
Id(int 主键)
名称(varchar)
国家(整数)
状态(整数)
城市(整数)
状态
我想通过谷歌地图中的名字来标记
【问题讨论】:
标签: javascript php codeigniter google-maps google-maps-api-3