【发布时间】:2018-03-20 17:52:48
【问题描述】:
我正在尝试使用 Openlayers 3 的地理定位服务来映射用户的移动并根据距离收集坐标,然后提供将显示在地图上的测量值或多边形形状。
我进行了大量研究,但没有发现任何可以真正让我开始实现最终目标的东西。这对 OpenLayers 3 可行吗?是否有一些已经内置的东西我可以使用,或者我必须使用 OpenLayers 3 组件从头开始构建它。
我目前的代码只是通过浏览器打开 OpenLayers 定位服务并跟踪位置。
new ol.Geolocation({
projection: mapObj.getView().getProjection(),
tracking: true,
trackingOptions: {
enableHighAccuracy: true
}
})
.on('change', function () {
geoLocationPosition = this.getPosition();
geoLocationHeading = this.getHeading() || 0;
mapObj.getView().setCenter(geoLocationPosition);
var trackerStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#383838',
width: 1
}),
fill: new ol.style.Fill({
color: '#319FD3'
})
});
geoLocationCircle.setStyle(trackerStyle);
geoLocationCircle.setGeometry(
new ol.geom.Circle(geoLocationPosition, 5)
);
})
};
感谢任何帮助引导我朝着正确方向前进!
【问题讨论】:
标签: openlayers openlayers-3 angular-openlayers