[gdal-dev] Add Mercator_variant_A method?

Even Rouault even.rouault at spatialys.com
Mon Apr 6 04:56:16 PDT 2015


Le lundi 06 avril 2015 13:26:11, Brad Hards a écrit :
> I'm looking at geopackage support, and particularly at the NGA's draft
> "profile".
> 
> It defines (and references) some spatial reference systems, including some
> interesting variations that will require more work later. For tonight, lets
> look at just one case:
> PROJCS["WGS 84 / World Mercator",
> 	GEOGCS["WGS 84",
> 		DATUM["World Geodetic System 1984",
> 			SPHEROID["WGS 84",6378137,298.257223563,
> 				AUTHORITY["EPSG","7030"]],
> 			AUTHORITY["EPSG","6326"]],
> 		PRIMEM["Greenwich",0,
> 			AUTHORITY["EPSG","8901"]],
> 		UNIT["degree",0.0174532925199433,
> 			AUTHORITY["EPSG","9122"]],
> 		AUTHORITY["EPSG","4326"]],
> 	PROJECTION["Mercator_variant_A",
> 		AUTHORITY["EPSG","9804"]],
> 	PARAMETER["Latitude of natural origin",0],
> 	PARAMETER["Longitude of natural origin",0],
> 	PARAMETER["Scale factor at natural origin",1],
> 	PARAMETER["False easting",0],
> 	PARAMETER["False northing",0],
> 	UNIT["metre",1,
> 		AUTHORITY["EPSG","9001"]],
> 	AXIS["Easting",EAST],
> 	AXIS["Northing",NORTH],
> 	AUTHORITY["EPSG","3395"]]
> 
> The problematic part is that "PROJECTION" definition. I was originally
> going to argue it should be Mercator_1SP, but it looks like the EPSG
> decided to change it (in EPSG::2010.058) to this new "Mercator_variant_A"
> form, and keep the "Mercator_1SP" form as an alias.
> 
> Should we add the new form, with a change like:

The issue with this is that you only fix the exportToProj4(). But there are 
other places in the code base where SRS_PT_MERCATOR_1SP is tested (for example 
when creating a dataset in other formats). It would be annoying to test in all 
those places both variants. Why not "normalizing"  "Mercator_variant_A" into 
"Mercator_1SP" on ingestion of GeoPackage WKT ? This would be a bit similar to 
all the tricks we do when ingesting ESRI WKT.

> 
> diff --git a/gdal/ogr/ogr_srs_api.h b/gdal/ogr/ogr_srs_api.h
> index 04dcf04..4349c06 100644
> --- a/gdal/ogr/ogr_srs_api.h
> +++ b/gdal/ogr/ogr_srs_api.h
> @@ -136,6 +136,8 @@ typedef enum {
>                                  "Lambert_Azimuthal_Equal_Area"
>  #define SRS_PT_MERCATOR_1SP     "Mercator_1SP"
>  #define SRS_PT_MERCATOR_2SP     "Mercator_2SP"
> +#define SRS_PT_MERCATOR_VARIANT_A                                       \
> +                                "Mercator_variant_A"
>  // Mercator_Auxiliary_Sphere is used used by ESRI to mean EPSG:3875
>  #define SRS_PT_MERCATOR_AUXILIARY_SPHERE                                 \
>                                  "Mercator_Auxiliary_Sphere"
> diff --git a/gdal/ogr/ogr_srs_proj4.cpp b/gdal/ogr/ogr_srs_proj4.cpp
> index 002ef07..32772ba 100644
> --- a/gdal/ogr/ogr_srs_proj4.cpp
> +++ b/gdal/ogr/ogr_srs_proj4.cpp
> @@ -1650,7 +1650,7 @@ OGRErr OGRSpatialReference::exportToProj4( char **
> ppszProj4 ) const
>                   GetNormProjParm(SRS_PP_FALSE_NORTHING,0.0) );
>      }
> 
> -    else if( EQUAL(pszProjection,SRS_PT_MERCATOR_1SP) )
> +    else if( EQUAL(pszProjection,SRS_PT_MERCATOR_1SP) ||
> EQUAL(pszProjection,SRS_PT_MERCATOR_VARIANT_A) )
>      {
>          if( GetNormProjParm(SRS_PP_LATITUDE_OF_ORIGIN,0.0) == 0.0 )
>              CPLsprintf( szProj4+strlen(szProj4),
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list