Extrapolate raster coordinates from geographic reference object

5 ビュー (過去 30 日間)
Federico
Federico 2022 年 9 月 19 日
回答済み: Abhishek Tripathi 2022 年 9 月 26 日
I am working the Matlab Hyperspectral Imaging Library and I'm able to import some hyperspectral images into my workspace as well as converting the images' metadata to an actual MapCellsReference object (I can therefore visualize composites of my hyperspectral images using mapshow).
Now, I would like to do some interpolations between different grids, is there any simple way to obtain a vector for longitude and latitude given a MapCellsReference object?
Theoretically it should be easy: the object "knows" the world limits, the intrinsic limits and the raster size (m*n), but still I found no pre-written function that gives me an m-sized vector of one coordinate and a n-sized vector of the other one.
If actually that function does not exist what would be the best method? My guess at the moment would be, given R the MapCellsReference object, something like:
X=linspace(R.XWorldLimits(1),R.XWorldLimits(2),R.RasterSize(2));
Y=linspace(R.YWorldLimits(1),R.YWorldLimits(2),R.RasterSize(1));
Would that make sense?

回答 (1 件)

Abhishek Tripathi
Abhishek Tripathi 2022 年 9 月 26 日
Mapping Tbx has functions which will help you out:
  • The worldGrid function can return grid vectors or full grid coordinates for their MapCellsReference.
  • If you have multiple grids which use the same ProjectedCRS, you can use mapinterp for interpolation. If you need to check if points from one grid are contained in another, you can use contains.
  • It’s unclear how lat/lon fits into their workflow, but if you need to convert coordinates between map x/y and lat/lon you can use projinv and/or projfwd. We don’t have a utility yet to perform a full-grid conversion (i.e., convert MapCellsReference to GeographicCellsReference).

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by