你能帮我把 lla 转换成 xyz 坐标吗?
我在用
earthRadius = 6378.137;
var x = earthRadius * Math.cos(lat)*Math.cos(lon);
var y = earthRadius * Math.cos(lat)*Math.sin(lon);
var z = earthRadius * Math.sin(lat);
Run Code Online (Sandbox Code Playgroud)
此方法转换为 xyz 坐标。但它没有给出我想要的正确结果。地球被定义为 wgs84 对象。
尝试将经纬度坐标映射到 3d 球体上。
我从互联网上尝试了三组不同的方程式,但都没有奏效。有谁知道怎么做。
这些是我尝试过但不起作用的方法。
var phi = (90-lat)*(Math.PI/180),
theta = (lon+180)*(Math.PI/180),
x = -((radius) * Math.sin(phi)*Math.cos(theta)),
z = ((radius) * Math.sin(phi)*Math.sin(theta)),
y = ((radius) * Math.cos(phi));
return new THREE.Vector3(x,y,z);
var height = 600;
var phi = (lat)*Math.PI/180;
var theta = (lon-180)*Math.PI/180;
var x = -(radius+height) * Math.cos(phi) * Math.cos(theta);
var y = (radius+height) * Math.sin(phi);
var z = (radius+height) * Math.cos(phi) * Math.sin(theta);
return new THREE.Vector3(x,y,z);
var x = Math.cos(lon) * Math.sin(lat),
y = Math.sin(lon) * Math.sin(lat),
z = …Run Code Online (Sandbox Code Playgroud) 我在地图上用一组坐标创建了一个多边形。我需要关于在原始多边形边界之外制作一个给定距离的缓冲多边形的帮助。
所以我需要一种具有这种算法的方法,在该方法中我将坐标集作为输入传递,并且应该将缓冲的坐标集作为输出。
我试图通过为 ios 使用 arcgis 库和 AGSGeometryEngine 的 bufferGeometry 方法来实现这一点,但问题是,这是紧密耦合的,只能使用他们的 GIS 地图,但我使用的是 Mapbox,它是不同的地图。所以我想要一种可以独立于地图解决我的问题的通用方法。
首先,我对 C++ 很陌生,所以我可能不得不深入研究伪代码和/或 Python 来解释我想要做什么......
我正在尝试为多个精灵存储动画的每一帧的 X 和 Y 坐标对。我设想这类似于以下内容 - 假设 PLAIN == 1 (使用枚举):
animationFrames[PLAIN][0] = { 20, 50 }
animationFrames[PLAIN][1] = { 25, 55 }
Run Code Online (Sandbox Code Playgroud)
等等。我基本上希望能够使用相关精灵的 ID 查询 animationFrames 并接收一组 X、Y 坐标以进行迭代。我觉得这很棘手。这是我的尝试,但不起作用...
std::vector< std::vector< std::pair<int, int> > > frames = {
{
{ 1, 1 }, { 2, 2 } // two frames for sprite A
},
{
{ 3, 3 }, { 4, 4 } // two frames for sprite B
}
};
Run Code Online (Sandbox Code Playgroud)
这会导致以下错误消息:
prog.cpp: In …Run Code Online (Sandbox Code Playgroud) 我想在 LAT、LNG 的坐标对中计算“曼哈顿距离”,也称为“城市街区距离”。
在这篇文章曼哈顿距离的两个地理位置之后,我使用haversine公式计算了距离:
source = (45.070060, 7.663708)
target = (45.068250, 7.663492)
Run Code Online (Sandbox Code Playgroud)
这是我的计算:
from math import radians, sin, asin, sqrt, atan2
# convert decimal degrees to radians
lat1, lon1, lat2, lon2 = map(radians, [source[0], source[1], target[0], target[1]])
#haversine formula for delta_lat
dlat = lat2 - lat1
a = sin(dlat / 2) ** 2
c = 2 * atan2(sqrt(a), sqrt(1-a)))
r = 6371
lat_d = c * r
# haversine formula for delta_lon
dlon = lon2 - lon1
a …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用clip-path.
#clip span {
padding: 3px 20px;
background-color: #666;
color: white;
display: inline-block;
clip-path: polygon(0 0, 90% 0, 100% 50%, 90% 100%, 0 100%, 10% 50%);
}Run Code Online (Sandbox Code Playgroud)
<div id="clip">
<span>hello</span><span>tiny</span><span>world</span><span>welcome!</span>
</div>Run Code Online (Sandbox Code Playgroud)
这使
虽然我喜欢这种方法的简单性,但问题来自坐标90%,它与单词的长度有关。因此“欢迎!” 没有与“tiny”相同的箭头角度。
当然,我可以在坚持前后跨度的单词之间添加两个空白块,根据需要调整形状。
但是有没有办法为 a 指定类似于 X-Windows 的“几何”坐标样式的polygon东西,例如-10px(从元素的右侧/底部开始计数;因此对于 100px 元素,这将给出 90px,意味着 10px从元素的另一侧)?
因此,“几何”之类的规则类似于(在 css 中不起作用,因为 -10px 从左侧/顶部开始计数)
clip-path: polygon(0 0, -10px 0, 100% 50%, -10px 100%, 0 100%, 10px 50%);
Run Code Online (Sandbox Code Playgroud) 我需要计算栅格质心(长纬度坐标)和参考点之间的旅行时间(例如乘车)。然而,不幸的是,许多栅格质心不在 googlemaps 的覆盖范围内,我想知道是否有一种解决方法可以让我以最快的方式到达参考点(例如结合步行到街道然后开车到参考点),如果是这样,我如何有效地做到这一点?
问题是,当我只是寻找下一个定位点时,我会产生偏差,将到该点的距离作为步行距离,然后从那里到参考点的 googlemaps 行驶距离,因为最近的点可能不是最快路线..
我试图使用 gmapsdistance-function 来做到这一点。下面是一个例子:
library(gmapsdistance)
#While this can be located and works well
> gmapsdistance(origin = "5.600451+-0.202553",
+ destination = "5.591622+-0.187677",
+ mode = "walking")
$Time
[1] 2101
$Distance
[1] 2667
$Status
[1] "OK"
#Changing the origin to other points often does not work as the points cannot be located and results in an NA-output
> gmapsdistance(origin = "7.9254948+-0.6283887",
+ destination = "5.591622+-0.187677",
+ mode = "walking")
$Time
[1] NA
$Distance
[1] NA
$Status
[1] …Run Code Online (Sandbox Code Playgroud) 我正在 Mapbox Studio 中制作地图,以便在带有 Mapbox GL JS 的网络应用程序上使用。我正在寻找一些关于如何像经典印刷地图一样在地图边缘显示坐标的建议:
我目前正在使用这些标签放置在贯穿地图的线上(使用预设样式和经纬网数据集图层),但我希望将它们固定到边缘(跨底部 X 轴的纬度和向下的经度)对)。
这是我正在尝试构建的地图的设计模型,并且我已经构建了除地图边界坐标之外的所有元素:
我对与来自 JS 等的 Mapbox 样式(数据驱动样式、访问图层、功能、DOM 元素等)进行交互非常有信心,但我不确定如何解决这个问题。
理想情况下,每 15 度都会有一个标记,这可能会随着用户缩放而放大/缩小。任何建议将不胜感激。谢谢!
是否可以从 Android 中 TextView 中的字符获取 x 坐标?我不是在寻找 TextView 本身的坐标,我需要 TextView 中最后一个字符的坐标(多行)
提前致谢
我在我的 flutter 应用程序中使用谷歌地图,我想在屏幕中间放置一个指针,这样用户只需移动地图并将指针放在中间就可以轻松选择要查找的位置屏幕指向他们寻找的位置
那么我怎样才能获得位于屏幕中间的坐标,与指针所在的位置完全相同
coordinates ×10
distance ×2
3d ×1
android ×1
arcgis ×1
arrays ×1
breadcrumbs ×1
c++ ×1
char ×1
character ×1
clip-path ×1
css ×1
dom ×1
flutter ×1
geolocation ×1
google-maps ×1
haversine ×1
ios ×1
javascript ×1
labels ×1
mapbox ×1
maps ×1
polygon ×1
python ×1
r ×1
swift ×1
textview ×1
three.js ×1
vector ×1
wgs84 ×1