In my application I'm using CEF (chromium embedded framework) to render a webpage into my program. 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. So basically an image is 256x256 pixels and on zoom level 7 one 256x256 tile consist of 64x64 blocks (4x4 chunks by 16x16 blocks). Each block is 1 unit. By empiric tests I've found that 1 lng/lat is approximately 24 blocks, but not exactly. 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)
Many thanks in advance
Cromon
在map
对象上使用latLngToContainerPoint ,以计算与地图元素左上角的偏移量。
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.