简体   繁体   中英

how to get co-ordinates of vector layer line points from openlayers?

I am not able to find out how to get lat-lon values of all the points in the drawn line in the openlayer vector layer, like this openlayer-example . please help me where to search...?

http://dev.openlayers.org/releases/OpenLayers-2.9/doc/apidocs/files/OpenLayers-js.html

Get layer instance(OpenLayers.Layer.Vector) from map.layers array. Iterate over features(OpenLayers.Feature.Vector) in layer.features. Access geometry(OpenLayers.Geometry) of feature using feature.geometry. This can be any type of geometry. For line the type is OpenLayers.Geometry.LineString. Use getVertices function to get array of all points(OpenLayer.Geometry.Point) in teh line.

你可以通过使用feature.getGeometry().getCoordinates()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM