[Mapserver-users] ESRI .prj and PROJ epsg

Paul Ramsey pramsey at refractions.net
Tue Jun 24 13:58:47 EDT 2003


Here's a C++ program Frank gave me which uses OGR:

---


#include "ogr_spatialref.h"
#include "ogr_srs_api.h"
#include "ogr_geometry.h"
#include "ogrsf_frmts.h"
#include "cpl_conv.h"

int main( int nArgc, char ** papszArgv ) {
         OGRSpatialReference oSRS;

         if( nArgc != 2 ) {
                 printf( "Usage: wkt2proj4 [srtext def or srtext file]\n" );
                 exit( 1 );
         }

         if( oSRS.SetFromUserInput(papszArgv[1]) != OGRERR_NONE ) {
                 CPLError( CE_Failure, CPLE_AppDefined,
                         "Error occured translating %s.\n", papszArgv[1] );
         }

         oSRS.morphFromESRI();

         char  *pszProj4 = NULL;

         if( oSRS.exportToProj4( &pszProj4 ) == OGRERR_NONE ) {
                 printf( "%s\n", pszProj4 );
         } else {
                 fprintf( stderr, "exportToProj4() failed.\n" );
         }
}

---

Kieran J. Ames wrote:
> Is anyone aware of a means to translate ESRI's .prj files and find the
> equivalent PROJ epsg entry?
> 
> eg:
> GEOGCS["GCS_North_American_1983",
> DATUM["D_North_American_1983",
> SPHEROID["GRS_1980",6378137,298.257222101]],
> PRIMEM["Greenwich",0],
> UNIT["Degree",0.0174532925199433]]
> 
> How do I know what to assign to variables like
> +proj=
> +lat_1=
> +lat_2=
> +lat_0=
> +lon_0=
> +x_0=
> +y_0=
> +lonc=
> +alpha=
> +k=
> +ellps=
> +datum=
> +units=
> +no_defs
> no_defs
> 
> THANKS!
> Kieran
> 
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users


-- 
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632
      \_




More information about the mapserver-users mailing list