0

I have a shapefile with points (in WGS84) that overlap with a raster layer (also in WGS84) and for each point I want to calculate the corresponding col and row raster coordinates. I work on Matlab 2015a and to avoid writing my own function I tried to use the existing geographicToDiscrete function, which returns the indices corresponding to the geographic coordinates lat and lon in a geographic raster R. However the result I get is not correct. For instance, using the following geographic raster object:

R = georasterref('RasterSize',[93, 61],...
         'LatitudeLimits',[50.9500,51.5584],...
         'LongitudeLimits',[3.9550,4.8790],...
         'ColumnsStartFrom','north',...
         'RowsStartFrom','west');

and a point with lat = 51.2167 and lon = 4.400, when I use the function

[col, row] = geographicToDiscrete(R,lat,lon)

I get that the col value is 53 and the row 30, while the correct values are 45 and 35, respectively. Do you know why there is this difference? What do I miss?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.