[mapserver-users] Examples using projection?

Stephen Lime steve.lime at dnr.state.mn.us
Mon Jul 23 12:55:59 PDT 2001


You have to sample at points along the rectangle and generate
a bounding box from that sample. The C source samples at about
100 intervals per side to do this. Me thinks that interval should be
based on the output cellsize but 100 seems to work ok. The source
is in mapproject.c. Again, if you're using 3.5 you could do something
like:

  $map->setProjection("new output projection");
  $latlon = new projectionObj("whatever definition of lat/lon you use");
  $map->{extent}->project($latlon, $map->{projection});

At least that's how it's intended to work.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> "Mike Neuman" <mcn at engarde.com> 07/23/01 02:45PM >>>

> How are you projecting from old extent to 
> new? Doing just the corners will not work. 

  What is the proper way to do this? My formula is something like:

  lccX1,lccY1 = project(minlat, minlon)
  lccX2,lccY2 = project(minlat, maxlon)
  lccX3,lccY3 = project(maxlat, minlon)
  lccX4,lccY4 = project(maxlat, maxlon)

  new_extent(minx) = MIN(lccX1, lccX2, lccX3, lccX4)
  new_extent(maxx) = MAX(lccX1, lccX2, lccX3, lccX4)

  new_extent(miny) = MIN(lccY1, lccY2, lccY3, lccY4)
  new_extent(maxy) = MAX(lccY1, lccY2, lccY3, lccY4)

  Thanks!

-Mike




More information about the MapServer-users mailing list