[gdal-dev] "Times" projection in GDAL

Even Rouault even.rouault at mines-paris.org
Fri May 2 08:39:03 PDT 2014


Le vendredi 02 mai 2014 16:34:31, Jed O. Kaplan a écrit :
> Dear All,
> 
> I have added the “Times” projection to my private copy of proj4 and tested
> it. It works properly using proj and unproj.
> 
> Could anyone on this list maybe give me a little guidance as to how I can
> make GDAL aware of this new map projection so that I may use it with
> GDAL/OGR utilities?

Below a 'grep' of the places where another projection ("mollweide") is defined. 
Basically you should do similar additions in the same files.

grep -i Mollw ogr/* | grep -v concord | grep -v usg | grep -v panora

ogr/ogr_opt.cpp:    SRS_PT_MOLLWEIDE,
ogr/ogr_opt.cpp:    "Mollweide",
ogr/ogrspatialreference.cpp:        SetMollweide( dfRefLong, 0.0, 0.0 );
ogr/ogrspatialreference.cpp:/*                            SetMollweide()                            
*/
ogr/ogrspatialreference.cpp:OGRErr OGRSpatialReference::SetMollweide( double 
dfCentralMeridian,
ogr/ogrspatialreference.cpp:    SetProjection( SRS_PT_MOLLWEIDE );
ogr/ogrspatialreference.cpp:/*                          OSRSetMollweide()                           
*/
ogr/ogrspatialreference.cpp:OGRErr OSRSetMollweide( OGRSpatialReferenceH hSRS, 
ogr/ogrspatialreference.cpp:    VALIDATE_POINTER1( hSRS, "OSRSetMollweide", 
CE_Failure );
ogr/ogrspatialreference.cpp:    return ((OGRSpatialReference *) hSRS)-
>SetMollweide( 
ogr/ogr_spatialref.h:    /** Mollweide */
ogr/ogr_spatialref.h:    OGRErr      SetMollweide( double dfCentralMeridian,
ogr/ogr_srs_api.h:#define SRS_PT_MOLLWEIDE        "Mollweide"
ogr/ogr_srs_api.h:/** Mollweide */
ogr/ogr_srs_api.h:OGRErr CPL_DLL  OSRSetMollweide( OGRSpatialReferenceH hSRS,
ogr/ogr_srs_proj4.cpp:        SetMollweide( OSR_GDV( papszNV, "lon_0", 0.0 ), 
ogr/ogr_srs_proj4.cpp:    else if( EQUAL(pszProjection,SRS_PT_MOLLWEIDE) )
ogr/ogr_srs_validate.cpp:    SRS_PT_MOLLWEIDE,
ogr/ogr_srs_validate.cpp:    SRS_PT_MOLLWEIDE,


> 
> If everything works, I’ll submit my updates back to the package
> maintainers.
> 
> Many thanks,
> 
> Jed
> 
> On 25 Mar 2014, at 11:49, Even Rouault <even.rouault at mines-paris.org> wrote:
> > Selon Dmitriy Baryshnikov <bishop.dev at gmail.com>:
> >> Hi Even,
> >> 
> >> hfadataset.cpp near 3686 ln
> >> else if( EQUAL(pszProjName, "Times") )
> >> {
> >> sPro.proNumber = EPRJ_TIMES;
> >> sPro.proName = (char*) "Times";
> >> sPro.proParams[4] = oSRS.GetProjParm(SRS_PP_CENTRAL_MERIDIAN)*D2R;
> >> sPro.proParams[6] = oSRS.GetProjParm(SRS_PP_FALSE_EASTING);
> >> sPro.proParams[7] = oSRS.GetProjParm(SRS_PP_FALSE_NORTHING);
> >> }
> >> 
> >> also I try this code
> >> OGRSpatialReference pSpaRef;
> >> const char *pszWkt =
> > 
> > "PROJCS[\"World_Times\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHE
> > ROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNI
> > T[\"Degree\",0.0174532925199433]],PROJECTION[\"Times\"],PARAMETER[\"Centr
> > al_Meridian\",0.0],UNIT[\"Meter\",1.0]]";
> > 
> >> pSpaRef.importFromWkt((char **)&pszWkt);
> >> char *pszPrtWKT = NULL;
> >> pSpaRef.exportToPrettyWkt(&pszPrtWKT );
> >> CPLFree(pszPrtWKT );
> >> 
> >> And OGRSpatialReference eat this WKT.
> > 
> > Ah ok, well it is just that it is valid WKT. But we cannot really tell
> > that GDAL fully supports it currently. For example the Validate() method
> > of OGRSpatialReference would return FALSE since it doesn't know the
> > Times projection method, and which projection parameters are valid with
> > it. And we don't have a OGRSpatialReference.SetTimes() method. And not
> > mentionning importFromProj4/exportToProj4() (but we would need proj.4
> > support of it before of course)
> > 
> >> Best regards,
> >> 
> >>     Dmitry
> >> 
> >> 25.03.2014 12:35, Even Rouault пОшет:
> >>> Dmitriy,
> >>> 
> >>> where did you find reference to the "times" projection in OGR ? I can't
> >> 
> >> find it.
> >> 
> >>> Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list