var polygon = OpenLayers.Geometry.Polygon.createRegularPolygon(new OpenLayers.Geometry.Point(6, 49), 2, 18, 0);
            var feature = new OpenLayers.Feature.Vector(polygon);
            var wkt_c = new OpenLayers.Format.WKT();
            var wktString = wkt_c.write(feature);
            var projection = new OpenLayers.Projection("EPSG:4326");
            var testarea = polygon.getGeodesicArea(projection).toFixed(2);
            //var testarea = polygon.getGeodesicArea().toFixed(2); //default:EPSG:4326

创建出来的数据,大概是这个样子:

"POLYGON((6.027164 49.524078,6.088064 49.680508,5.948726 49.772232,5.941587 49.91943,6.03742 50.064381,6.147439 50.130783,6.211109 50.166946,6.312177 50.134426,6.340263 49.998951,6.525142 49.858585,6.734586 49.815399,6.715019 49.685902,6.603117 49.621159,6.636707 49.462303,6.57162 49.490456,6.315996 49.495625,6.027164 49.524078))"

  

  

相关文章:

  • 2022-12-23
  • 2021-12-24
  • 2021-12-26
  • 2021-08-08
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-10
  • 2021-09-21
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
相关资源
相似解决方案