Pixel to latitude and longitude cordinates

조회 수: 5 (최근 30일)
Antonino Ferola
Antonino Ferola 2022년 7월 12일
답변: Udit06 2023년 9월 29일
I created through the m_map package a spatial distribution map of a certain variable, then through the command:
[x y] = m_contour (lon_sla, lat_sla, SSH, [1.15 1.15], 'color', 'y', 'Linewidth', 2);
With this command I obtain a contour line, whose pixel coordinates are stored in the vector x of size 2 * 12389.
How is it possible to convert these pixel coordinates into geographic coordinates lon and lat, in such a way as to preserve the position vector of the contour?
  댓글 수: 2
KSSV
KSSV 2022년 7월 13일
Your (x,y) should already have the coordinates you want.
Antonino Ferola
Antonino Ferola 2022년 7월 13일
y is a graphic object and in the vector x the coordinates are referred to the image borders, probably the first row represents the distance of a point from the top border of the image and the second row represents the distance from the left border of the image. I would like to convert this coordinates and store them in a vector where the first column is the long and the second is the lat.

댓글을 달려면 로그인하십시오.

답변 (1개)

Udit06
Udit06 2023년 9월 29일
Hi Antonino,
I understand that you want to obtain the geographic coordinates from the pixel coordinates that you obtained using the "m_contour" command. You can follow the following steps to do the same:
  1. Define the transformation function that takes the pixel row and column indices as inputs and returns geographic coordinates as output. The transformation function in this case could be of the form ax+b, where x is the pixel coordinate, a is the scaling factor which corresponds to the region size in degrees and b is a constant.
  2. Apply this transformation function to each pixel coordinate.
  3. Store the results in a new array.
The suggested tranformation is just an example, you can think of other tranformation functions also.
I hope this helps.

카테고리

Help CenterFile Exchange에서 Cartesian Coordinate System Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by