Hi everybody, I try to extract values (lat and lon) of a Geotiff image that contains chlorophyll-a values, I need this information for compare with a MODIS values in MATLAB or another sofware.
Well, another way is to use ArcGIS software. In this software you can go to 'Spatial Analyst' then choose 'Convert' and then select the 'Raster to Feature' option. Under 'Raster to Feature' tool change 'Output Geometry type' to 'Point', select your geotif image under the 'Input Raster' option and finally save the output feature file and hit 'Ok'.
Your geotiff image pixels will be converted into a 'point' shapefile or points. Next open the attributes of your point shapefile and add two new fields namely lat and long. Select the 'lat' column and right click on it . Then from the drop down menu select 'calculate geometry'. Under 'calculate geometry' select 'Y coordinate of point' and select 'Unit' as 'decimal degrees'. Hit 'Ok' and your 'lat' coulmn gets populated with the corresponding values. Repeat the steps for longitude except select 'X coordinate of point' under the 'calculate geometry' option.
It has taken more words to explain the procedure, however if you follow this, it merely takes 2-3 steps and less than a minute to complete the procedure. The conversion may take some time to run depending on the size of your image.
A is the matrix with pixel-color information: 2-dimensional matrix (MxN) if the file contains a grayscale image or data grid. Or 3-dimensional matrix (MxNx3), if the file contains a color image (RGB).
BBOX is a 2x2 matrix containing the coordinates of your image's corner boundaries.
With the coordinates of the boundaries and the number of pixels in the image, the code calculates de delta_x and delta_y as the distance in x and y between each adjacent pixel. From there, is just populate the coords_x and coords_y matrices.
You may plot the image inside matlab to check if everything is right:
Well, another way is to use ArcGIS software. In this software you can go to 'Spatial Analyst' then choose 'Convert' and then select the 'Raster to Feature' option. Under 'Raster to Feature' tool change 'Output Geometry type' to 'Point', select your geotif image under the 'Input Raster' option and finally save the output feature file and hit 'Ok'.
Your geotiff image pixels will be converted into a 'point' shapefile or points. Next open the attributes of your point shapefile and add two new fields namely lat and long. Select the 'lat' column and right click on it . Then from the drop down menu select 'calculate geometry'. Under 'calculate geometry' select 'Y coordinate of point' and select 'Unit' as 'decimal degrees'. Hit 'Ok' and your 'lat' coulmn gets populated with the corresponding values. Repeat the steps for longitude except select 'X coordinate of point' under the 'calculate geometry' option.
It has taken more words to explain the procedure, however if you follow this, it merely takes 2-3 steps and less than a minute to complete the procedure. The conversion may take some time to run depending on the size of your image.
I was trying with another way, that consists in convert the geotiff image to NetCDF format, by this way I extract the Lat and Lon of the geotiff image.
I am working with Landsat 8 and MODIS images for obtain Chlorophyll concentration
I processed Landsat images with ERDAS and get the chlorophyll concentration, (the product was a geotiff image), I want to compare the infomation obtained with MODIS images in MatLab, for this I had to converted the geotiif to Netcdf format with ArcGIS. But this did not work, because I need the raster of Lat, other raster of Lon and one raster of Chlorophyll in the same file .
Center ( 25.2500000, 58.5000000) ( 25d15' 0.00"E, 58d30' 0.00"N)
Band 1 Block=1500x1 Type=Float32, ColorInterp=Gray
aleksei@are3:~$
So I have here coordinates of image corners (degrees east and degrees north), picture size in pixels and also pixel size in degrees is given. I suppose, this info is sufficient for calculating coordinates of all pixels in picture...