[postgis-users] Projection help (please, now thankyou!)

Brent Wood pcreso at pcreso.com
Tue Oct 26 19:44:04 PDT 2004


Arrgghh... Now I have to learn C++!!!!

(actually I just got someone here to do it for me :-)

So my first play with C++, with a bit of help, & it works perfectly,

I just cat the prj file at the program to get the proj4 equivalent.

absolutely wunnerful....

Much appreciated. (& better support than I tend to get for commercial
packages!!)


Cheers

   Brent


--- "Chapman, Martin" <MChapman at sanz.com> 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);
> 
> -- 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
> 
> Martin
> 
> -----Original Message-----
> From: Brent Wood [mailto:pcreso at pcreso.com] 
> Sent: Tuesday, October 26, 2004 5:05 PM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] Projection help (please)
> 
> 
> 
> I have been given a Mapinfo binary map with CCAMLR data around
> Antarctica.
> 
> ogr2ogr turned it into a shapefile which is more useful I want to import
> this into a PostGIS table, but need to sort out the projection details
> to overlay it with other data in the database.
> 
> The shapefile version includes a .prj file, which I'm assuming will have
> the necessary info to locate or create the appropriate entry in the
> spatial_ref_sys table.
> 
> The contents of this file are below, can anyone help me translate this
> into a proj4text string?
> 
> 
> Thanks,
> 
>    Brent Wood
> 
> 
> more CCAMLR/Subareas_new_2003.prj
> PROJCS["unnamed",GEOGCS["unnamed",DATUM["North_American_Datum_1927",SPHE
> ROID["C
> larke
> 1866",6378206.4,294.9786982],TOWGS84[-8,160,176,-0,-0,-0,0]],PRIMEM["Gre
> e
> nwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Azimuthal_Equid
> istant"
> ],PARAMETER["latitude_of_center",-90],PARAMETER["longitude_of_center",0]
> ,PARAME
> TER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1.0]]
> 
> _______________________________________________
> postgis-users mailing list postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> 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