[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    RE: [postgis-users] Projection help (please, now thankyou!)
From:       "Chapman, Martin" <MChapman () sanz ! com>
Date:       2004-10-27 4:27:26
Message-ID: ED3A48B9840E594890A2BC172D119465E63BD6 () mailman ! san ! com
[Download RAW message or body]

Brent,

You could also make a UDF (user defined function) in PostgreSQL and put the code in \
there.  Then you could call that function using sql (like you call PostGIS functions \
ie. intersects(), overlaps()...), passing it the .prj file path or contents, do the \
conversion in the function, and then return the proj4 string.  Then it could be \
integrated with the rest of your sql code.  Although, you might want to check and \
make sure that function isn't there already...I don't know PostGIS that well. :)

Martin


-----Original Message-----
From:	Brent Wood [mailto:pcreso@pcreso.com]
Sent:	Tue 10/26/2004 8:44 PM
To:	PostGIS Users Discussion
Cc:	
Subject:	RE: [postgis-users] Projection help (please, now thankyou!)

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@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@pcreso.com] 
> Sent: Tuesday, October 26, 2004 5:05 PM
> To: postgis-users@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@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 


_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic