我是HERE API的新手(仍在测试中) 我有两个问题:
我在地图上有很多图钉。您可以通过脚本自动找到引脚位置的中心吗?
对于每个引脚,我都有一个带信息的div框(每个div具有唯一的ID)。我可以单击图钉,页面将滚动到右侧的div /位置吗? 在此处查看带有Google地图的示例: http://www.followmyroutes.com/index.php?page=itinPage&itinID=16
此致
Roi
答案 0 :(得分:1)
缩放到一组标记很容易。想法是在地图实例上使用方法setViewBounds
。
// some examples marker
var toronto = new H.map.Marker({lat:43.7, lng: -79.4});
var boston = new H.map.Marker({lat:42.35805, lng: -71.0636}),
var washington = new H.map.Marker({lat:38.8951, lng: -77.0366}),
// a group object to contain the markers
var group = new H.map.Group();
// add markers to the group
group.addObjects([toronto, boston, washington]);
// add the group to the map instance
map.addObject(group);
// get geo bounding box for the group and zoom into it
map.setViewBounds(group.getBounds());