我正在尝试使用OpenLayers在地图上绘制一个圆圈。我希望能够以英里为单位定义圆的半径。像这样:
function generateCircleFeature(lat,lng,radius_in_miles) {
//clever stuff goes here
//calculated_radius = some_function_of radius_in_miles
var circle = new ol.geom.Circle(
ol.proj.transform([lng, lat], 'EPSG:4326', 'EPSG:3857'),
calculated_radius
);
var circleFeature = new ol.Feature(circle);
return circleFeature;
}
我已经搜索并搜索了一个实际可行的简单示例,并且有点疯狂。欢迎所有建议!谢谢: - )