Reputation: 73
How to get distance from draw circle feature,?
const radius = feature.getGeometry().getRadius();
The radius can be obtained. (Is this pixel?)
want a meter.
thanks.
Upvotes: 0
Views: 240
Reputation: 17982
The result will be in the units used by the projection you are displaying it in. Typically that will be EPSG:3857 web mercator which uses meters as nominal units, but that is a true scale only at the equator - at 60 degrees north things appear twice the true size, so you should adjust your result for point resolution, and also explicitly specify meters if your projection uses a different unit:
ol.proj.getPointResolution(map.getView().getProjection(), feature.getGeometry().getRadius(), feature.getGeometry().getCenter(), 'm')
Upvotes: 1