Using the "C API" and modifying the projection...
Frank Warmerdam
warmerdam at POBOX.COM
Thu Jun 21 11:30:52 EDT 2007
Ian Erickson wrote:
> Nope.
>
> So I'm trying to distill this down... There's a bunch going on here so
> I thought I should focus on just the one element that's cauing the
> problem - that being msLoadProjectionString(). So with a simple map
> with a projection specifed as epsg:4326, I figured I'd try to alter the
> projection and then save the output map....
>
> Guess what, the projection remains unchanged.... So there appears to be
> a step (or 5) that I'm missing here...
>
> //-------------------------------------------------------------------
>
> mapObj *map = NULL;
> imageObj *image = NULL;
>
> msSetup();
> map = msLoadMap( "C:\\original.map", NULL );
> if (!map) {
> cout << "There is an error loading the map..." << endl;
> return;
> }
> //Trying to change the projection to epsg:4269 (and then verify it in
> the output.map file)...
> msLoadProjectionString( &(map->projection), "+init=epsg:4269" );
> msSaveMap( map, "C:\\output.map" );
> image = msDrawMap( map );
> msSaveImage( map, image, "C:\\output.png" );
>
> msFreeImage( image );
> msFreeMap( map );
> msCleanup();
> cout << "Complete." << endl;
Ian,
I have reviewed the msLoadProjectionString() code, and I can't really see
how the above could fail to alter the map projection declaration unless
it was originally the same as what you are setting it to or if USE_PROJ
is not defined in the build in which case the original projection
should also not be defined.
What does "mapserv -v" look like? What does the MAP portion of the original
and saved map file look like?
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