将lon / lat转换为x,y [英] Convert lon/lat to x, y

查看:544
本文介绍了将lon / lat转换为x,y的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我如何根据经度和纬度得到x,y?

假设我有地球同步图像数据(float * data = new float [2750 * 2750])和我想要提取一些我的数据。



我尝试过:



为了做到这一点,我使用的是Proj4库。

  double  dCenterLon = < span class =code-digit> 80 ; 
QString strProj = QString( + proj = geos + h = 35785831.0 + lon_0 =%1 + a = 6400000)。arg(dCenterLon);

projCtx _ctx = pj_ctx_alloc();
projPJ _projection = = pj_init_plus_ctx(_ctx,qPrintable(strProj));

int vLon; //
int vLat; //
int x; // 我必须计算这个
int y; // 我必须计算这个
int nResolution; //
int dColumnOffset; //
int dLineOffset; // 我有

projUV数据;
data.u = vLon * DEG_TO_RAD;
data.v = vlat * DEG_TO_RAD;
data = pj_fwd(data,_projection);

x =(data.u / nResolution)+ dColumnOffset + 0 5 ;
y =(data.v / nResolution * - 1 )+ dLineOffset + 0 5 ;

解决方案

经度和纬度是全局数字,用于绘制地点标记在地图上

所以那些不能转换为X和Y

我们怎么样?



图片是小物质而Long / Lat是地球上的全球号码(世界地图)



by这里的方式是关于你正在使用的图书馆的几个链接 -

proj.4 - proj.4 4.9.3文档 [ ^ ]



< a href =https://github.com/OSGeo/proj.4> [ ^ ]



所以链接我发现了你的问题吗?

协调转换 [ Coordinate Conversions ]



将纬度和经度转换为XY坐标 [ ^ ]

Hello everyone, how can i get the x, y based on longitude and latitude?
Lets say i have geostationary image data ( float* data = new float[ 2750* 2750] ) and i want to extract the some are of my data.

What I have tried:

In order to do this i am using the Proj4 library.

double dCenterLon = 80;
QString strProj = QString( "+proj=geos +h=35785831.0 +lon_0=%1 +a=6400000" ).arg( dCenterLon );

projCtx _ctx = pj_ctx_alloc();
projPJ _projection = = pj_init_plus_ctx( _ctx, qPrintable( strProj ) );

int vLon;            //I have
int vLat;            //I have
int x;             //I have to calculte this
int y;             //I have to calculte this
int nResolution;     //I have
int dColumnOffset;   //I have
int dLineOffset;     //I have

projUV data;
data.u = vLon * DEG_TO_RAD;
data.v = vlat * DEG_TO_RAD;
data = pj_fwd( data, _projection );

x=( data.u / nResolution ) + dColumnOffset + 0.5;
y=( data.v / nResolution * -1 ) + dLineOffset + 0.5;

解决方案

longitude and latitude are global numbers , to plot your place mark on map
so those can't be converted to X and Y
how can we?

Image is small substance whereas Long / Lat are global number on map (world map)

by the way here are few links about library you are using -
proj.4 — proj.4 4.9.3 documentation[^]

[^]

so link I found simillar to your questions -
Coordinate Conversions[Coordinate Conversions]

Converting Latitude And Longitude to an X Y Coordinates[^]


这篇关于将lon / lat转换为x,y的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆