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 CenterFile Exchange에서 Grid 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