[英]Leaflet lng/lat relative to image
In my application I'm using CEF (chromium embedded framework) to render a webpage into my program. 在我的应用程序中,我正在使用CEF(铬嵌入式框架)将网页渲染到程序中。 So for my worldmap I found leaflet to be pretty awesome.
因此,对于我的世界地图,我发现传单非常棒。 While the mapgeneration works perfect I now try to convert the lat/lng values to the coordinates of my game.
虽然mapgeneration可以完美运行,但我现在尝试将lat / lng值转换为游戏的坐标。 So basically an image is 256x256 pixels and on zoom level 7 one 256x256 tile consist of 64x64 blocks (4x4 chunks by 16x16 blocks).
因此,基本上一幅图像是256x256像素,在缩放级别7上,一个256x256瓦片由64x64块(4x4块乘16x16块)组成。 Each block is 1 unit.
每个块为1个单位。 By empiric tests I've found that 1 lng/lat is approximately 24 blocks, but not exactly.
通过经验测试,我发现1 lng / lat大约是24个街区,但不完全是。 For my application I need the precise values.
对于我的应用程序,我需要精确的值。
So my question is: Is there a way to convert the coordinates from leaflet to the coordinates in my application? 所以我的问题是:有没有办法将传单中的坐标转换为应用程序中的坐标? To recapitulate: On zoom level 7 one 256x256 tile is 64x64 units wide (in game coordinates)
概括一下:在缩放级别7上,一个256x256瓦片的宽度为64x64单位(在游戏坐标系中)
Many thanks in advance 提前谢谢了
Cromon Cromon
在map
对象上使用latLngToContainerPoint ,以计算与地图元素左上角的偏移量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.