[Gdal-dev] Projection SOMERC

Frank Warmerdam warmerdam at pobox.com
Wed Oct 18 10:07:54 EDT 2006


nic wrote:
> I tried to use gdalwarp with the option
> 
> +proj=somerc
> (swiss oblique mercator projection)
> 
> it seems that gdal doesn't know this projection. Is there a way to add 
> this to a initialization file? The proj library works perfectly with somerc

Nic,

There is some support for handling proj=somerc in GDAL/OGR since late 2004.
Can you provide some specifics of what does not work and what error you get?
The logic for converting to/from proj.4 looks like this:

     else if( EQUAL(pszProj,"somerc") )
     {
         SetHOM( OSR_GDV( papszNV, "lat_0", 0.0 ),
                 OSR_GDV( papszNV, "lon_0", 0.0 )+dfFromGreenwich,
                 90.0,  90.0,
                 OSR_GDV( papszNV, "k", 1.0 ),
                 OSR_GDV( papszNV, "x_0", 0.0 ),
                 OSR_GDV( papszNV, "y_0", 0.0 ) );
     }

     else if( EQUAL(pszProjection,SRS_PT_HOTINE_OBLIQUE_MERCATOR) )
     {
         /* not clear how ProjParm[3] - angle from rectified to skewed grid -
            should be applied ... see the +not_rot flag for PROJ.4.
            Just ignoring for now. */

         /* special case for swiss oblique mercator : see bug 423 */
         if( fabs(GetNormProjParm(SRS_PP_AZIMUTH,0.0) - 90.0) < 0.0001
             && fabs(GetNormProjParm(SRS_PP_RECTIFIED_GRID_ANGLE,0.0)-90.0) < 
0.0001 )
         {
             sprintf( szProj4+strlen(szProj4),
                      "+proj=somerc +lat_0=%.16g +lon_0=%.16g"
                      " +x_0=%.16g +y_0=%.16g ",
                      GetNormProjParm(SRS_PP_LATITUDE_OF_ORIGIN,0.0),
                      GetNormProjParm(SRS_PP_CENTRAL_MERIDIAN,0.0),
                      GetNormProjParm(SRS_PP_FALSE_EASTING,0.0),
                      GetNormProjParm(SRS_PP_FALSE_NORTHING,0.0) );
         }
         else
         {
             sprintf( szProj4+strlen(szProj4),
                      "+proj=omerc +lat_0=%.16g +lonc=%.16g +alpha=%.16g"
                      " +k=%.16g +x_0=%.16g +y_0=%.16g ",
                      GetNormProjParm(SRS_PP_LATITUDE_OF_ORIGIN,0.0),
                      GetNormProjParm(SRS_PP_CENTRAL_MERIDIAN,0.0),
                      GetNormProjParm(SRS_PP_AZIMUTH,0.0),
                      GetNormProjParm(SRS_PP_SCALE_FACTOR,1.0),
                      GetNormProjParm(SRS_PP_FALSE_EASTING,0.0),
                      GetNormProjParm(SRS_PP_FALSE_NORTHING,0.0) );
         }
     }


So somerc (Swiss Oblique Mercator) is represented in Well Known Text format
as Hotine Oblique Mercator, and it seems that specific parameter values
are mapped to somerc on the "way back" to proj.4.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list