[mapserver-users] Mapscript / Projection Question

Paul Ramsey pramsey at refractions.net
Thu Oct 11 12:31:05 EDT 2001


In answer to my question, I have found that when using perl mapscript
the internal projection and extent seem pretty independant. all that
setProjection() does is change the projection object, it does not alter
any of the associated info, like the extent, to match the new
projection. So, the trick is to always ensure that any extent you set is
in the same projection as the internal one. The order of operations is
like this:

- setProjection (P1)
- new rectObj() with your extent in P1
- $rect->project(P2,P1)
- now set $map->{extent} = $rect

Basically, keep track of what projection corresponds to what object and
do all the transformations by hand, and stuff works.


> Paul Ramsey wrote:
> >
> > OK, to start with, I have a map file with a default planar projection.
> >
> > $map->{extent}->{minx} gives me a nice planar value : 167053
> >
> > I do a $map->setProjection("init=epgs:4269") where EPSG 4269 is a
> > lat/lon projection.
> >
> > $map->{extent}->{minx} *still* gives me a nice planar value : 167053
> >
> > What precisely does setProjection effect? The output image only? If so,
> > how do I specify an input extent? In the default projection only? I
> > *thought* the correct chain of operations was like this:
> >
> > - Mapserver with default projection P1
> > - Given desired extent E1 in projection P2
> >   - $map->setProjection(P2)
> >   - $map->{extent} = E1
> > - Given that one wants output in projection P3
> >   - $map->setProjection(P3)
> >   - $map->draw()
> >
> > So
> >
> > 1) how to I set the projection the output image will be generated in?
> > 2) how do I specify an image extent, given that I am doing something
> > like 1) ?
> >
> > Thanks,
> > Paul
> 
> --
>       __
>      /
>      | Paul Ramsey
>      | Refractions Research
>      | Email: pramsey at refractions.net
>      | Phone: (250) 885-0632
>      \_

-- 
      __
     /
     | Paul Ramsey
     | Refractions Research
     | Email: pramsey at refractions.net
     | Phone: (250) 885-0632
     \_



More information about the mapserver-users mailing list