我有一个大小为8576x8576px的图像,我想让坐标与1:1匹配.另外我想要图像中心的坐标0,0(现在中心是-128,128).而且我也希望显示坐标.我想为用户插入坐标放置一个locate按钮,然后在地图上找到它们.像这样的东西:http://xero-hurtworld.com/map_steam.php (我使用相同的图像,但更大).瓷砖尺寸我的268px.
我的代码到目前为止:
https://jsfiddle.net/ze62dte0/
<!DOCTYPE html>
<html>
<head>
<title>Map</title>
<meta charset="utf-8"/>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js" charset="utf-8"></script>
<script>
function init() {
var mapMinZoom = 0;
var mapMaxZoom = 3;
var map = L.map('map', {
maxZoom: mapMaxZoom,
minZoom: mapMinZoom,
crs: L.CRS.Simple
}).setView([0, 0], mapMaxZoom);
window.latLngToPixels = function(latlng){
return window.map.project([latlng.lat,latlng.lng], window.map.getMaxZoom());
};
window.pixelsToLatLng = function(x,y){
return window.map.unproject([x,y], window.map.getMaxZoom());
};
var mapBounds = new L.LatLngBounds(
map.unproject([0, …Run Code Online (Sandbox Code Playgroud) 我正在使用传单JS创建Day Z(游戏)的地图,并希望能够使用游戏坐标系在地图上绘制项目,请参阅 http://dayz.ollieb.net
在游戏中,左上角坐标是000 000,然后是001,001,其中10的单位代表网格,因此010,010将是左上角的"网格"(类似于法令调查).
如何创建一个方法来转换提供的坐标系(点或latlong)以此方式工作.基本上他们只需要从000,000(左上)到145,130(右下).目前我在使用lat/long时遇到问题,因为它曲线可以补偿投影并且每个计算机的点数(x/y)似乎都在变化!
如何获取游戏点并在该点上在地图上创建标记?据推测,我需要告诉Leaflet.js地图左上角和右上角的"数字"是什么?
很抱歉由于缺乏理解,我已经阅读了所有文档,并且看不到像这样提到的任何内容!
在这里查看示例:http: //dabrothas.net/sei/daisy/index.asp?mode = mark&z = 3&x = -109.2294921875&y = 73.49222029152183