Javascript 获取屏幕上显示的标记数据

Javascript 获取屏幕上显示的标记数据,javascript,google-maps,openlayers-3,Javascript,Google Maps,Openlayers 3,我用Openlayers 3开发了一个网站,需要你的帮助。 我的网页分为两部分:列表显示和地图显示。 我已经创建了由集群设置动画的标记 var功能=[]; $.ajax({ url:urlUpdate, 数据类型:“json”, async:false, 成功:函数(json1){ $.each(json1,函数(键,数据){ 如果(键=='features'){ $。每个(数据、函数(k、v){ 如果(v.type==='Feature'){ 如果(v.geometry.coordinat

我用Openlayers 3开发了一个网站,需要你的帮助。 我的网页分为两部分:列表显示和地图显示。

我已经创建了由集群设置动画的标记

var功能=[];
$.ajax({
url:urlUpdate,
数据类型:“json”,
async:false,
成功:函数(json1){
$.each(json1,函数(键,数据){
如果(键=='features'){
$。每个(数据、函数(k、v){
如果(v.type==='Feature'){
如果(v.geometry.coordinates.length>1){
特征[k]=新的ol.特征({
几何:新的ol.geom.Point(ol.proj.transform(v.geometry.coordinates,'EPSG:4326','EPSG:3857')),
id:v.properties.id,
名称:v.properties.name,
liue:v.properties.liue,
});   
}
}
});
}
});
}
});        
var source=新的ol.source.Vector({
特色:特色
});
var clusterSource=新的ol.source.Cluster({
距离:40,
资料来源:资料来源
});
var clusters=新的ol.layer.Vector({
资料来源:clusterSource,
款式:A外套款式
});
var oldMarkers=map.getLayers().a[2];
地图移除层(旧标记);

map.addLayer(集群)我已通过以下方式解决问题:


var source=newol.source.Vector({features:features});var bb=source.getExtent();map.getView().fitExtent(bb,map.getSize())我已经通过以下方法解决了我的问题:var source=new ol.source.Vector({features:features});var bb=source.getExtent();map.getView().fitExtent(bb,map.getSize());