[Geotiff] Conversion from lat/long to PCS to raster

Frank Warmerdam warmerdam at pobox.com
Fri Jan 21 09:53:42 EST 2011


On 11-01-21 06:57 AM, Fernando Cacciola wrote:
> Hi,
>
> I plan to use libgeotiff (never used it beefore) to convert from
> lat/long (GCS) to raster pixels.
>
> IIIUC I need to convert lat/long to northings/eastings first (GCS ->
> PCS), then PCS to Raster space.
>
> I can see in libgeotiff the function GTIFPCSToImage, for PCS->Raster,
> and I can also see a GTIFProj4FromLatLong(), which appears to be for
> GCS to PCS, but I'm not sure how to use it.
>
> Or rather, I can't get it to work: with a test geotiff I have,
> lat/long and northings/eastings end up the same when I call
> GTIFProj4FromLatLong (which of course won't give the correct raster
> coordinates since this geotiff is ModelTypeProjected)
>
> I called GTIFGetProj4Defn(&defn) FWIW.
>
> Is this supported and I'm missing something? Or I cannot do this with
> libgeotiff alone (and need GDAL instead)?

Fernando,

Are you linked against the PROJ.4 library? Without out that the
GTIFFProj4FromLatLong/ToLatLong() functions are NOPs though they
should return FALSE indicating failure.

I would suggest looking at bin/listgeo.c for an example of using
GTIFFProj4ToLatLong().

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 Geotiff mailing list