简体   繁体   English

相对于图像的单张lng / lat

[英]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.

相关问题 在 leaflet map 点击事件上保存 lat 和 lng - Save lat and lng on leaflet map click event 传单地理搜索:从找到的地址事件中返回经纬度 - Leaflet geosearch: return lat/lng from address found event 如何在传单地图上正确绘制多边形(纬度/经度顶点和旋转度)? - How to correctly draw a polygon (lat/lng vertices and rotation) on a Leaflet map? Leaflet 在显示位置重复时提供无效的 Lng/Lat 坐标 - Leaflet Providing invalid Lng/Lat coordinates when location duplicates on display 将Lat Lng从另一个功能推入Street View Image API - Push Lat Lng from another function into Street View Image API Leaflet js:如何在地图上绘制任何标记结束时获取 Lat 和 lng - Leaflet js: How to get Lat and lng at the end of drawing any marker on Map 本地存储中的传单标记,如何获取标记经度并从存储中排除? - Leaflet markers on localstorage, how to get marker lat lng and exclude from storage? 带有弹出窗口和缩放到针脚的传单聚类标记在相同纬度时关闭针脚 - Leaflet Clustering markers with popups and zoom to pin closes the pin when at same lat lng 在单独的 AJAX function / ZDB974238714CA8DE63ZA7CE1 中使用现有的 lat/lng leaflet 标记 - Using existing lat/lng leaflet markers in separate AJAX function / API call 地理位置导出纬度和经度 - Geolocation Export lat and lng
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM