Pixel to latitude and longitude cordinates
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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:
- 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.
- Apply this transformation function to each pixel coordinate.
- 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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cartesian Coordinate System Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!