这是一个如何在ol2 http://jsfiddle.net/4S5Ke/166/中编写一个函数来执行此操作的示例.以下是一些代码:
function createGeodesicPolygon(origin, radius, sides, rotation, projection) {
if (projection.getCode() !== "EPSG:4326") {
origin.transform(projection, new OpenLayers.Projection("EPSG:4326"));
}
var latlon = new OpenLayers.LonLat(origin.x, origin.y);
var angle;
var new_lonlat, geom_point;
var points = [];
for (var i = 0; i < sides; i++) {
angle = (i * 360 / sides) + rotation;
new_lonlat = OpenLayers.Util.destinationVincenty(latlon, angle, radius);
new_lonlat.transform(new OpenLayers.Projection("EPSG:4326"), projection);
geom_point = new OpenLayers.Geometry.Point(new_lonlat.lon, new_lonlat.lat);
points.push(geom_point);
}
var ring = new OpenLayers.Geometry.LinearRing(points);
return new OpenLayers.Geometry.Polygon([ring]);
Run Code Online (Sandbox Code Playgroud)
}
什么是OpenLayers.Util.destinationVincenty和OpenLayers.Geometry.LinearRing等函数的传单?知道了,我想我可以使用传单重写函数.救命??