[postgis-users] Projection help (please)
Chapman, Martin
MChapman at sanz.com
Wed Oct 27 08:21:50 PDT 2004
Frank,
Ah, that is good to know. Thank you very much.
Martin
-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com]
Sent: Wednesday, October 27, 2004 9:18 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Projection help (please)
Chapman, Martin wrote:
> Brent,
>
> #include "ogrsf_frmts.h"
> #include "gdal_priv.h"
>
> char* pszWks = "the text from the .prj file goes here";
> OGRSpatialReference spatialReference(pszWks); OGRErr err =
> spatialReference.morphToESRI(); // needed if the using an esri .prj
> file if (err != OGRERR_NONE) throw (char*) CPLGetLastErrorMsg();
>
> char* pszProj4 = NULL; spatialReference.exportToProj4(&pszProj4);
Folks,
I think you should be using "morphFromESRI()" not "morphToESRI()". The
FromESRI() version converts ESRI style WKT into OGR style WKT. It
may not matter much for a given WKT value of course since they are
pretty similar.
Something similar can also be implemented in Python for the C++ adverse.
> -- there you go
> -- p.s I think the pszProj4 variable should be freed with
> CPLFree(pszProj4); -- not sure though, see the on-line docs for that
Yes, it should be freed with CPLFree(), though free() would actually
work fine *most* of the time.
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
_______________________________________________
postgis-users mailing list postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list