How to convert lat, long to x y for plotting on the map?

1 回表示 (過去 30 日間)
Sabereh
Sabereh 2022 年 10 月 8 日
コメント済み: Benjamin Thompson 2022 年 10 月 10 日
I have an 14080*13624 .jpg image that is the country map.
also I know the lat and long of 4 corner of the map.
I have the lat and long of some other point that I want to scatter them on my map.
I used the code below but the result dosen't match the real position of points.
img = imread('map.jpg');
imshow(img);
hold on
%% Desiger point
lat = 32.778473;
lon = 51.648468;
h = 400;
%% center
lat0 = 31.8978;
lon0 = 53.6133;
h0 = 400;
%%
wgs84 = wgs84Ellipsoid;
[xEast,yNorth,zUp] = geodetic2enu(lat,lon,h,lat0,lon0,h0,wgs84);
pix_size_x = 14080/2;
pix_size_y = 13824/2;
stepx = (8.2281e+05)/pix_size_x;
stepy = (9.2292e+05)/pix_size_y;
x = pix_size_x + xEast/stepx;
y = pix_size_y - yNorth/stepy;
scatter(x,y)
axis equal
Would you please help me solve this problem?!
  5 件のコメント
Sabereh
Sabereh 2022 年 10 月 10 日
@Walter Roberson yes,the divided by 2 is because of the refrence point is center.
Benjamin Thompson
Benjamin Thompson 2022 年 10 月 10 日
If you have the Mapping Toolbox you can use makerefmat and latlon2pix.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by