- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在使用这两个函数将 latlng 转换为图 block 坐标。我无法理解的是在缩放级别 1 时是否有 4 个图 block 。那么这些坐标属于哪些瓦片?或者这些属于左上?
public int langtoTileX(Double lng,int zoom)
{
double x;
x = Math.round((256*(Math.pow(2,zoom-1)))+(lng*((256*(Math.pow(2,zoom)))/360)));
return ((int)(x/256));
}
public int lattoTileY(Double lat,int zoom)
{
Double exp = Math.sin(lat*Math.PI/180);
if (exp < -.9999)
exp = -.9999;
if (exp > .9999)
exp = .9999 ;
return (int) (Math.round (256*(Math.pow(2,zoom-1)))+((.5*Math.log((1+exp)/(1-exp)))*((-256*(Math.pow(2,zoom)))/(2*Math.PI))))/256;
}
此示例中使用了相同类型的公式:
https://developers.google.com/maps/documentation/javascript/examples/map-coordinates
最佳答案
很可能是它的左上角图 block 。当您想分割 map 时,使用四叉树会很有用,因此缩放级别 1 有 4 个图 block 。寻找 bing map 四键解决方案:http://msdn.microsoft.com/en-us/library/bb259689.aspx .但是谷歌地图对图 block 使用 x,y 对:How can I get Tile Count, Tile X, Tile Y details without specifying zoom Level (or LevelOfDetails)? .在缩放级别 0 中,在缩放级别 1 中有 1 个图 block ,您可以在两侧看到 4 个图 block 和一些图 block ,等等。链接:http://facstaff.unca.edu/mcmcclur/GoogleMaps/Projections/GoogleCoords.html , http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection .
更新:要从 x,y 对中获取边界框,请使用像这样的矩形 x,x+1,y,y+1: TileProvider method getTile - need to translate x and y to lat/long .但您也可以在 Bing 和 Google map 之间进行转换。替换四键值如下:0=q, 1=r, 2=t, 3=s (?), maybe also 0=q, 1=r, 2=s, 3=t (?) 并将其附加到网址 http://kh.google.com/kh?v=3&;t=quadkey .来源:http://dzone.com/snippets/converting-between-2-google .
更新 2:网址 http://kh.google.com已死,但您仍然可以使用代码段:
def quadtree(x,y, zoom):
out = []
m = {(0,0):'q', (0,1):'t', (1,0):'r', (1,1):'s'}
for i in range(17-zoom):
x, rx = divmod(x, 2)
y, ry = divmod(y, 2)
out.insert(0, m[(rx,ry)])
return 't' + ''.join(out)
def xyzoom(quad):
x, y, z = 0, 0, 17
m = {'q':(0,0), 't':(0,1), 'r':(1,0), 's':(1,1)}
for c in quad[1:]:
x = x*2 + m[c][0]
y = y*2 + m[c][1]
z -= 1
return x, y, z
在 map 中,曲线从右上角开始到右下角到左下角到左上角。因此它看起来像一个倒U形?也许我错了,它是左上角、右上角、左下角、右下角?然后是Z字形。那么 lat,lng 对在左上角的图 block 中?
为了获得边界框,我假设 long 和 lat 以秒为单位给出。
首先,您需要以秒为单位计算矩形的宽度。一秒在赤道上是 30.9 米,对于其他纬度,乘以 cos(lat),因此要将其转换为秒,请执行以下操作:
double widthSeconds = meters / (30.9 * cos(lat));
其次,知道了盒子的中心,就很容易计算出角的坐标:
关于android - 从 latlng 返回的图 block 坐标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18252120/
我必须用小工具制作 map ,这些小工具从上一点获得电压。我的数据库中有纬度和经度的记录。我使用自定义图标和 windowInfo 在 map 上存储带有标记的小工具,但我想获取上一个点的纬度和经度,
我的任务是查找两个纬度和经度坐标之间的行驶距离。我在[此处][1]找到了此链接,但是,我不确定我是否正确实现了它,因为我收到了错误...... Invalid float: "" GeocodingL
我一直致力于 Android 中的 Google map 服务。我想知道是否有一个实用方法可以给出 LatLng 的方向关于另一个。 我想知道一个点是否在 南还是北 东方还是西方 或两者的组合,各取其
LATLNG 无法将参数类型“LatLng”分配给参数类型“LatLng” The argument type 'LatLng (where LatLng is defined in E:\flutt
目标 知道一个坐标点是否在另外两个坐标之间。 背景 我正在制作一个谷歌地图应用程序,我需要知道某个点是否在两个 LatLng 点(起点和终点)之间。 我正在寻找如下函数: var currentCoo
在行“Location.distanceBetween(LatLng.latitude, LatLng.longitude, circle.getCenter().latitude,circle.ge
我可以使用什么算法/公式来计算距离另一个 LatLng 点 5 米的 LatLng 点?我正在尝试编写一个带有 2 个 LatLng 参数的函数,并让它返回一个 LatLng,该 LatLng 距离第
使用文档示例,我尝试放大特定点。所以我这样做: var latlng = L.latLng(50.5, 30.5); $scope.map.setZoomAround(latlng); $scope.
我有 2 个列表。 double pointY[]={105.45526,105.57364,105.53505,105.45523,105.51962,105.77320} double point
假设我有一个关联的纬度/经度 + 名称的 HashMap,以及一个相同纬度/经度的单独 ArrayList,这些纬度/经度已按距离我当前位置最近的位置排序。如何将 HashMap 排序为与 Array
我需要查明某些 LatLng 是否在 Google map 圈内(其中之一:http://code.google.com/apis/maps/documentation/javascript/over
我正在尝试在当前位置设置标记,因此我尝试将 Location 转换为 LatLng 类: LatLng mCurrentPlace= new LatLng(location.getLatitude()
我正在 Flutter 中使用 Leaflet 完成我的第一个婴儿步骤,因此欢迎耐心和教程 URL 等。 我能找到的每一段示例代码都给了我这个错误: The method 'LatLng' isn't
因此,我开始在我的小应用程序中建立并运行我的 map ,当我尝试放入相机移动时,我遇到了一些小障碍。编译器似乎根本不喜欢 LatLng 类。它给了我这个。 The method LatLng(doub
我正在从 MainActivity 向名为 MapClass 的类发送 IntentService 调用。 MapClass 有一个名为 MapClassInner 的内部类,它计算用户的当前坐标。但
我创建了一个函数来返回纬度和经度。 问题是 alert('outside:') 在 geocoder.geocode 之前触发。 查看this similar example ,这个功能应该工作。
在我更改包名称之前,一切都在我的设备上正常工作...一旦更改 pkg,相机就不会移动到初始 latlng。此外,标记不会显示。 package com.vaishnavismeclass.divyad
我有List有位置(超过 2000 个位置)。每个位置有 100 米的距离。但是列表太大所以我想根据位置优先级过滤一些位置(比如访问最多的位置、著名位置、实体名称、城市名称或其他) 实际上,当用户移动
我在使用 latlng 变量在 Leaflet map 上创建新圆时遇到问题。 我有一个包含和输入半径的表单和一个包含几个位置的选择框,选项如下所示: Place Name 单击保存按钮时,将运行以下
我想在 touchmove 事件(传单 map )中获取触摸点的 LatLng。我没有找到解决这个问题的方法。有什么方法可以获取坐标吗? $(document).on('touchmove', '#m
我是一名优秀的程序员,十分优秀!