OpenLayers从多边形顶点获取纬度和经度
我正在尝试使用openlayers中的方形多边形来获取边界框。我需要从框中获取北、南、西和东的值。现在我正在使用:OpenLayers从多边形顶点获取纬度和经度,openlayers,polygon,latitude-longitude,vertices,Openlayers,Polygon,Latitude Longitude,Vertices,我正在尝试使用openlayers中的方形多边形来获取边界框。我需要从框中获取北、南、西和东的值。现在我正在使用: var topleft = vectors.features[0].geometry.getVertices()[0]; 获取左上角的顶点。但是,它返回如下值: POINT(-13393350.718762 4024321.5982824) 如何从该返回点获取lat和lon值?一个选项是使用getVertices()[I]生成点 var myPoint = new OpenLa
var topleft = vectors.features[0].geometry.getVertices()[0];
获取左上角的顶点。但是,它返回如下值:
POINT(-13393350.718762 4024321.5982824)
如何从该返回点获取lat和lon值?一个选项是使用getVertices()[I]生成点
var myPoint = new OpenLayers.Geometry.Point(vectors.features[0].geometry.getVertices()[0].x,
vectors.features[0].geometry.getVertices()[0].y )
然后变换该点,得到Lat和Long,如下所示
var myLatLonPoint = myPoint.transform( map.getProjectionObject(),
new OpenLayers.Projection("EPSG:4326"));
然后,你应该能够抓住从这些点的横向和纵向
另一种可能更可取的选择是变换边界,然后拉出各个顶点
var myLatLonSquare = vectors.features[0].geometry.transform( map.getProjectionObject(),
new OpenLayers.Projection("EPSG:4326"));
然后使用以下工具拉出顶点的横向长度:
myLatLonSquare.getVertices()[0].x myLatLonSquare.getVertices()[0].y
OpenLayers地图的投影是什么?@AlexC它使用墨卡托投影。我不需要帮助转换。我只想知道如何从返回值“POINT(-13393350.718762 4024321.598282824)”中获取lat/long值