Questions about mapserver C API 'projectionObj_new' replacement

Frank Warmerdam warmerdam at POBOX.COM
Wed Mar 28 17:00:21 EDT 2007


pw wrote:
> Hello,
> 
> I am upgrading some mapserver source that is based on mapserver
> version 4.2.3 up to the current version 4.10.1.
> 
> In my old code I am calling:
> 
> projectionObj *pj=projectionObj_new(mapObj_getProjection(..yada..))
> 
> The API has now changed and 'projectionObj_new' is no longer available
> from what I am seeing.
> 
> How has this been replaced and what is the method I should use
> to create a projection object using a copy constructor?

Peter,

Perhaps that was a local addition?  There does not seem to be a
creator method for projectionObj.  I think the creator code in
mapscript/swiginc/projection.i pretty much shows the steps expected.

         int status;
         projectionObj *proj=NULL;

         proj = (projectionObj *)malloc(sizeof(projectionObj));
         if (!proj) return NULL;
         msInitProjection(proj);

         status = msLoadProjectionString(proj, proj4);
         if (status == -1) {
             msFreeProjection(proj);
             free(proj);
             return NULL;
         }

         return proj;

This is an example of the fact that the "C API" in MapServer is a byproduct
of internal use rather than careful planning for external developers.

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 mapserver-dev mailing list