[Mapserver-users] setprojection, need clarification

Daniel Morissette morissette at dmsolutions.ca
Sat Apr 26 11:08:21 PDT 2003


Hi Debbie,

You could pass bSetUnitsAndExtents as MS_TRUE in this case and
MapSscript would set the $map->units and reproject the current extents
for you.

The problem in your case may be that you put quotes around the MS_METERS
constant in $map->set("units","MS_METERS");.  It should be:

  $map->set("units", MS_METERS);

Daniel


Debbie Pagurek wrote:
> 
> I am looking at the php/mapscript documentation at:http://mapserver.gis.umn.edu/doc36/phpmapscript-class-guide.html
> and I'd like some clarification about setProjection.
> 
>   int setProjection(string proj_params, boolean bSetUnitsAndExtents)
>          Set map projection and coordinate system.  Parameters are given as
>          a single string of comma-delimited PROJ.4 parameters.
>          The argument bSetUnitsAndExtents is used to automatically update
>          the map units and extents based on the new projection. Possible
>          values are MS_TRUE and MS_FALSE. By default it is set to MS_FALSE.
> 
> When would you use the "boolean bSetUnitsAndExtents" parameter and set it to MS_TRUE?
> 
> Just wondering because I have a map file that is in decimal degrees (proj=latlong).  In an application, I am changing the projection to Robinson on the fly (proj=robin,lon_0=0,x_0=0,y_0=0) and all is working fine, except that the scalebar is not appearing correctly.  I have made sure to change the overall map units to meters ( $map->set("units","MS_METERS");  ) and I am also updating the mapextents with appropriate extents in meters.  As I said, the actual map is appearing just fine, it's just the scalebar that isn't making sense - showing something as 360km when it really should be more like 10000+ km.
> 
> Any help would be much appreciated!
> 
> D. Pagurek
>



More information about the MapServer-users mailing list