[gdal-dev] Converting raster pixel space to geospace
Smart, Gary
Gary.Smart at goodrich.com
Mon Jul 20 09:37:47 EDT 2009
OK - I can get it to compile and not crash instantly (bonanza!)
However, when I try to create the OGR transform using importFromWkt,
I get the following:
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
Does anyone know what this means? Is there some part of OGR/GDAL I have yet to install?
My input projection is:
GTiff/GeoTIFF Projection PROJCS["TM D-01",GEOGCS["NAD27",DATUM["North_American_Datum_1927",SPHEROID["Clarke 1866",6378206.4,294.9786982139006,AUTHORITY["EPSG","7008"]],AUTHORITY["EPSG","6267"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4267"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-124.5],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]
...and I am looking to output WGS84 lat/longs.
> -----Original Message-----
> From: Even Rouault [mailto:even.rouault at mines-paris.org]
> Sent: 16 July 2009 19:44
> To: Smart, Gary
> Cc: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] Converting raster pixel space to geospace
>
> Le Thursday 16 July 2009 10:41:02 Smart, Gary, vous avez écrit :
> >
> > But how do I load a OGRSpatialRef object with the output from the
> > GDALApplyGeoTransform? Presumably I can prime the OGRSpatialReference
> > using the result of GDALDataset::GetProjectionRef?
>
> Yes, almost. See below
>
> > I'm not yet sure of my
> > terminology but is the GetProjectionRef supposed to satisfy the OGR
> > importFromWkt (the types seem to clash though - char* vs char**)?
>
> Maybe the doc of OGRSpatialReference::importFromWkt() (see
> http://gdal.org/ogr/classOGRSpatialReference.html#b74cfc985bd05404a4c61d2d
> 633a6343)
> isn't clear enough ? I must confess that the prototype is a bit weird. You
> don't pass the string itself, but a pointer to a string. The pointer will
> be
> modified to point to the remaining (unused) input, what you generally
> don't
> care about.
>
> Ok, here's a sample snippet :
>
> OGRSpatialReferenceH hSRS = OSRNewSpatialReference(NULL);
> const char* pszWkt = GDALGetProjectionRef(hDS);
> OSRImportFromWkt(hSRS, (char**) pszWkt);
>
> (For the purists, a more correct prototype of importFromWkt () would have
> relied on 'const char**' to avoid the above cast)
>
> But a simpler approach would be just :
>
> OGRSpatialReferenceH hSRS;
> hSRS = OSRNewSpatialReference(pszWKT);
>
> which instanciates the OGRSpatialReferenceH object and call internally
> importFromWkt()
>
> >
> > I suspect my output projection could then be set up with
> > SetWellKnownGeogCS("WGS84") in order to convert from whatever input
> > projection prevails, to a standard WGS84 lat/long representation (using
> > OGRCreateCoordinateTransformation::Transform)?
>
> Yes. Actually, it will be long/lat in term of the order of the
> coordinates.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090720/05162a68/attachment.html
More information about the gdal-dev
mailing list