Map scale on Gmap.net

huangapple go评论67阅读模式
英文:

Map scale on Gmap.net

问题

如何在Gmap.net上获取地图比例尺?
我需要比例尺来计算图像相对于地图尺寸的尺寸。
在Gmap.net上是否有可能获取这些数据?

英文:

How to get the map scale on Gmap.net?
I need the scale to calculate the dimensions of an image in relation to the map dimension.
Is it possible to obtain this data on Gmap.net?

答案1

得分: 0

我在尝试向GMap添加自定义标记时遇到了相同的问题(缩放宽度、高度、画笔大小等)。您可以使用下面的代码获取GMap.Net的覆盖层(Overlayer)比例值。

double scale = Overlay.Control.MapProvider.Projection.GetGroundResolution((int)Overlay.Control.Zoom, Position.Lat));

然后使用下面的代码来缩放您的尺寸。

var h = Height/scale;
var w = Width/scale;
Pen pen = new Pen(Color.Red, 10/scale);

我希望这对您有所帮助。

英文:

I had same problem when I went to add custom marker to GMap(scaling width, height, pen size, ...). You can use below code to get GMap.Net Overlayer scale value.

double scale = Overlay.Control.MapProvider.Projection.GetGroundResolution((int)Overlay.Control.Zoom, Position.Lat));

And use below to scaling your dimensions.

var h = Height/scale;
var w = Width/scale;
Pen pen = new Pen(Color.Red, 10/scale);

I hope this help

huangapple
  • 本文由 发表于 2020年1月6日 22:29:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/59613840.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定