我有以下表格中提供的GPS信息:
36°57'9"N 110°4'21"W
我可以使用Chris Veness的javascript函数将度,分和秒转换为数字度,但首先需要将GPS信息解析为单独的纬度和经度字符串(带有NSEW后缀).我已经阅读了stackoverflow上的相关帖子,但我不是正则表达式专家(也不是程序员),需要一些解析函数的帮助.将此字符串解析为纬度和经度以便在转换函数中使用的最佳方法是什么?
所有这些的结果将是一个Web链接,人们可以单击该链接以查看位置的Google地图表示.
我在地球上有一个线段(大圆圈部分).线段由其末端的坐标定义.显然,两个点定义了两个线段,所以假设我对较短的线段感兴趣.
我得到了第三点,我正在寻找线和点之间的(最短)距离.
所有坐标均以经度\纬度(WGS 84)给出.
我该如何计算距离?
任何合理的编程语言都可以使用解决方案.
我想将GPS位置(纬度,经度)转换为x,y坐标.我找到了许多关于这个主题的链接并应用了它,但它没有给我正确的答案!
我按照这些步骤来测试答案:(1)首先,我采取两个位置并使用地图计算它们之间的距离.(2)然后将两个位置转换为x,y坐标.(3)然后再次计算x,y坐标中两点之间的距离,看它是否在点(1)给出了相同的结果.
我发现以下解决方案之一,但它没有给我正确的答案!
latitude = Math.PI * latitude / 180;
longitude = Math.PI * longitude / 180;
// adjust position by radians
latitude -= 1.570795765134; // subtract 90 degrees (in radians)
// and switch z and y
xPos = (app.radius) * Math.sin(latitude) * Math.cos(longitude);
zPos = (app.radius) * Math.sin(latitude) * Math.sin(longitude);
yPos = (app.radius) * Math.cos(latitude);
Run Code Online (Sandbox Code Playgroud)
我也试过这个链接,但仍然不能与我合作!
任何帮助如何从(纬度,经度)转换为(x,y)?
谢谢,
如何以度/弧度转换纬度和经度?你们有任何公式或任何想法吗?我想在MapKit上显示它.谢谢.....
我有纬度和经度值的文件,我想以km为单位转换x和y我想测量每个点的距离.
例如我制作纬度和经度的第一个点(分别是51.58,-124.6)
到(0,0)我的x和y系统所以基本上我想找出其他点是什么和他们从原点的位置所以我想找到什么51.56(纬度)-123.64(长)在(x) ,y)以km为单位,依此类推文件的其余部分.
我想在python中完成所有这些,是否有一些排序代码?
例如,我在网上找到了网站
http://www.whoi.edu/marine/ndsf/cgi-bin/NDSFutility.cgi?form=0&from=LatLon&to=XY
我想要做什么,我只是不知道他们是怎么做的.
我下载了天气数据,它有经度(十进制)、纬度(十进制)和海拔(米)值。没有有关所使用的坐标系的信息。我如何将其转换为笛卡尔坐标?我的尝试如下。但是,我的问题是找到正确的公式
def cartesian(self,longitude,latitude, elevation):
R = 6378137.0 + elevation # relative to centre of the earth
X = R * math.cos(longitude) * math.sin(latitude)
Y = R * math.sin(longitude) * math.sin(latitude)
Z = R * math.cos(latitude)
def cartesian3(self,longitude,latitude, elevation):
X = longitude * 60 * 1852 * math.cos(latitude)
Y = latitude * 60 * 1852
Z = elevation
return X,Y,Z
Run Code Online (Sandbox Code Playgroud)
Daphna Shezaf的回答使用了不同的公式。但是,它不使用高程。如果有人能消除我的困惑,我将不胜感激,是否应该使用海拔来从长/纬度转换?正确的公式是什么?我尝试使用特定的经度、纬度、海拔来比较我在该网站上的代码的结果。我上面的两种方法的结果与从网站获得的结果相差甚远
我想分享我的问题的解决方案。我已经在Python中实现了Matlab中的lla2ecef函数。它允许将弧度经度、纬度和海拔(高度以米为单位)转换为笛卡尔坐标。我只需要将纬度和经度转换为弧度,前提是它们是十进制的:
latitude = (lat * math.pi) / 180 #latitude in radian, and lat …
Run Code Online (Sandbox Code Playgroud) 我想知道我的球体的纹理是否以某种方式未正确应用,如果我能以某种方式抵消它?我试图通过提供纬度/经度并转换为笛卡尔xyz坐标在澳大利亚悉尼放置一个盒子.但是,该框不在正确的位置.我的猜测是因为原始图像是墨卡托地图,当它应用于球体时,纬度/经度中心点不正确.
下面的代码是一个最小的可重复生成的例子.
可重复生成的代码
var img;
var theta = 0;
var r = 400;
function preload() {
img = loadImage('https://eoimages.gsfc.nasa.gov/images/imagerecords/79000/79765/dnb_land_ocean_ice.2012.3600x1800.jpg');
}
function setup() {
createCanvas(1600, 1200, WEBGL);
}
function draw() {
background(0);
rotateY(theta);
theta += 0.01;
texture(img);
sphere(r);
//Sydney, Australia Latitude/Longtidue
var lat = radians(33.8688);
var lon = radians(151.2093);
//cartesian coordinates
var x = r * Math.cos(lat) * Math.cos(lon);
var y = r * Math.cos(lat) * Math.sin(lon);
var z = r …
Run Code Online (Sandbox Code Playgroud)我有一个纬度/经度小数点坐标,我想将其转换为适合iPad坐标系区域的点.
我的代码采用纬度/经度坐标并将它们转换为笛卡尔坐标(基于此问题:转换为笛卡尔坐标)转换结果为(2494.269287,575.376465).
这是我的代码(没有编译或运行时错误):
#define EARTH_RADIUS 6371
- (void)drawRect:(CGRect)rect
{
CGPoint latLong = {41.998035, -116.012215};
CGPoint newCoord = [self convertLatLongCoord:latLong];
NSLog(@"Cartesian Coordinate: (%f, %f)",newCoord.x, newCoord.y);
//Draw dot at coordinate
CGColorRef darkColor = [[UIColor colorWithRed:21.0/255.0
green:92.0/255.0
blue:136.0/255.0
alpha:1.0] CGColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, darkColor);
CGContextFillRect(context, CGRectMake(newCoord.x, newCoord.y, 100, 100));
}
-(CGPoint)convertLatLongCoord:(CGPoint)latLong
{
CGFloat x = EARTH_RADIUS * cos(latLong.x) * cos(latLong.y);
CGFloat y = EARTH_RADIUS * cos(latLong.x) * sin(latLong.y);
return CGPointMake(x, y);
}
Run Code Online (Sandbox Code Playgroud)
如何将小数点坐标转换为将显示在iPad屏幕上的坐标?
python ×3
geometry ×2
geospatial ×2
gis ×2
gps ×2
ios ×2
javascript ×2
distance ×1
geocoding ×1
geolocation ×1
iphone ×1
k-means ×1
mapkit ×1
mapping ×1
objective-c ×1
p5.js ×1
processing ×1
python-2.7 ×1
regex ×1
xcode ×1