[Gdal-dev] Re: Coordinate to pixel space? (C#)

Frank Warmerdam warmerdam at pobox.com
Thu Aug 23 09:26:52 EDT 2007


Tomas R wrote:
> Tomas R skrev:
>> This I should have asked a long time ago.
>>
>> Can GDal give me a translation from the maps coordinate space to/from 
>> pixel space? That is if I Gdal has a dataset of a map with known 
>> projection and known edge coordinates.
>>
>> As simple as that.
>>
>> /Tomas
> I missed a bit of data above. The real question is if it is possible to 
> get the the pixel coordinate given a projection and map data (edge 
> coordinates, resolution) of a given coordinate in projection space when 
> using Gdal with the C# bindings? If there exists  a function which can 
> do this?
> 
> And vice versa. If I have a pixel in the map, can I call a function 
> which gives me the coordinates in projection space for that pixel?
> 
> 
> Ok, perhaps not so hard to implement myself but still, why do it if Gdal 
> can?

Tomas,

Pixel locations and georeferenced coordinates are normally related by the
affine "GeoTransform" that can be fetched using the GetGeotransform()
method on a GDALDataset.

It's use is discussed briefly in the section labelled "Affine GeoTransform"
in the data model document:

   http://www.gdal.org/gdal_datamodel.html

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list