如何使用getRadius()以米为单位获取圆的光线 [英] how to get the ray of a circle in meters using getRadius()

查看:611
本文介绍了如何使用getRadius()以米为单位获取圆的光线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ol.geom.Circle类的getRadius()方法返回圆的半径; 如何将该值转换为米?

the method getRadius() of class ol.geom.Circle returns the radius of a circle ; how can I convert this value into meters ?

我使用特定的投影(例如球形墨卡托,兰伯特等)在地图上绘制一个圆 然后我将此几何图形转换为度数以进行进一步处理,例如测试一个点(度数)是否在该圆内

I draw a circle on a map using a particular projection (e.g Spherical Mercator, LambertIIe, etc.) then I convert this geometry into degree to process further treatments such as testing if a point (in degrees) is inside this circle

因此以度为单位从几何中获取半径始终在同一单位(米)中将是有用的

so getting the radius always in the same unit (meter) from a geometry in degree would be useful

预先感谢

让·玛丽(Jean-Marie)

Jean-Marie

推荐答案

您可以使用ol.proj.METERS_PER_UNIT表获取以米为单位的半径:

You can use the ol.proj.METERS_PER_UNIT table to get the radius in meters:

var units = map.getView().getProjection().getUnits();
var radiusM = circle.getRadius() * ol.proj.METERS_PER_UNIT[units];

这篇关于如何使用getRadius()以米为单位获取圆的光线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆