[Gdal-dev] How to get georeferenced pixel?

Frank Warmerdam warmerdam at pobox.com
Thu Nov 6 10:23:57 EST 2003


Michal wrote:
> Hi!
> I think this is very simple question. I need to get pixel value, but I have 
> lattitude and longitude and not row and column information. Image is in UTM 
> but I know latlong info only. 
>  
> I hope somebody can help me.

Michal,

Not really that simple a question.  Andrew has posted a nice example
of reading invidual pixels based on the georeferenced location as long as
the georeferenced coordinate system is in the same coordinate system as the
image.  I would suggest you get that working smoothly, and then move on to
a step to reproject your lat/long locations into UTM.  Hopefully the OGR
Projections Tutorial will be helpful in this:

   http://www.remotesensing.org/gdal/ogr/osr_tutorial.html

You might also find the GDALInfoReportCorner() code in gdal/apps/gdalinfo.c
helpful.  That code goes the other way, from image georef coordinates (ie.
UTM) to lat/long but should show an example of deriving the lat/long
projection, creating a coordinate transformer, and then using it.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list