Angularjs 带开放层的线串热图3

Angularjs 带开放层的线串热图3,angularjs,geometry,heatmap,openlayers-3,multilinestring,Angularjs,Geometry,Heatmap,Openlayers 3,Multilinestring,我需要用AngularJS和Open Layers 3制作一个热图,其中包含一组线串。我没有找到任何例子,只是在这里回答了一个问题,但这对我不起作用! 我有一个服务,创建我的地图上的所有图层,我需要这个热图是一个图层,这样我就可以设置它可见或不可见。 层服务: /** * Routes is the list of routes that contains the linestring * inside the "geom" property. */ LayerService.routes

我需要用AngularJS和Open Layers 3制作一个热图,其中包含一组线串。我没有找到任何例子,只是在这里回答了一个问题,但这对我不起作用! 我有一个服务,创建我的地图上的所有图层,我需要这个热图是一个图层,这样我就可以设置它可见或不可见。 层服务:

/**
 * Routes is the list of routes that contains the linestring
 * inside the "geom" property.
 */
LayerService.routesHeatMap = function (routes, blur, radius) {
  const centroids = [];
  routes.forEach(route => {
    const geometry = route.geom;
    if (!!geometry) {
      const point_feature = new ol.Feature({ weight: route.expansion });
      point_feature.setGeometry(new ol.geom.LineString(geometry.coordinates));
      point_feature.setProperties({ projection: "EPSG:4326" });
      centroids.push(point_feature);
    }
  });
  let vector = new ol.layer.Heatmap({
    title: 'Routes. Heatmap',
    source: new ol.source.Vector({
      features: new ol.Collection(centroids),
      overlaps: true,
      opacity: 1,
      visible: false,
      format: new ol.format.GeoJSON({
        dataProjection: 'EPSG:4326'
      })
    }),
    zIndex: 1,
    gradient: ['#007700', '#6ce200', '#efef00', '#ffff00', '#ff6600', '#ff0000'],
    blur: parseInt(blur.value, 10),
    radius: parseInt(radius.value, 10)
  });

  return vector;
};
拥有我的地图的我的控制器:

var blur = document.getElementById('blur');
var radius = document.getElementById('radius');
heat = LayerService.routesHeatMap(response, blur, radius);
vm.map.addLayer(heat);

热图适用于点几何图形。将
ol.geom.LineString
更改为
ol.geom.MultPoint
,它应该可以正常工作,我不确定它是否按照预期的方式工作。问题是,热图现在在我的地图上!但SEM可能缺少预测(EPSG:4326)。我已经把它放在了一个混乱的地方,所有的点都在同一个位置。还有,我如何使模糊和半径工作?是
route.geom.coordinates
lon/lat还是lat/lon?您的视图投影是什么?我不确定它是X-Y还是Y-X,但是我可以尝试使用
.reverse()。我用的是EPSG:4326,但我已经试过“EPSG:4326”、“EPSG:31982”、“EPSG:3857”,但都没用。在
坐标中
我有我的线串,如果我将其作为线串加载,图层将不起作用。如果我使用转换为点作为新代码,它至少会在地图中显示图层。热图使用点几何图形。将
ol.geom.LineString
更改为
ol.geom.MultPoint
,它应该可以正常工作,我不确定它是否按照预期的方式工作。问题是,热图现在在我的地图上!但SEM可能缺少预测(EPSG:4326)。我已经把它放在了一个混乱的地方,所有的点都在同一个位置。还有,我如何使模糊和半径工作?是
route.geom.coordinates
lon/lat还是lat/lon?您的视图投影是什么?我不确定它是X-Y还是Y-X,但是我可以尝试使用
.reverse()。我用的是EPSG:4326,但我已经试过“EPSG:4326”、“EPSG:31982”、“EPSG:3857”,但都没用。在
坐标中
我有我的线串,如果我将其作为线串加载,图层将不起作用。如果我使用转换为点的新代码,它至少会在地图中显示图层。