Questions about extents and projections

Sean Gillies sgillies at FRII.COM
Thu Feb 2 17:15:19 EST 2006


On Jan 31, 2006, at 2:33 PM, Brian Peschel wrote:

> I have taking the 4.6.2 version of MapServer and (using the makefile)
> building as a C library and linking into a custom application I  
> have.  I am
> using the MapServer code to generate JPG images.
>
> I am trying to create a cube of images that I can then stitch  
> together.
> Something like:
> ABC
> DEF
> GHI
>
> Every image should have the same number of pixels, so I am  
> overriding the
> map file by resetting the value in the loaded mapObj ojbect by:
> map->height = 354;
> map->width = 609;
> I know the lat/lons of every corner of each image, so I am  
> overriding the
> map file by resetting the extent in the loaded mapObj object by:
> map->extent.minx = corner[SW].x();
> map->extent.maxx = corner[SE].x();
> map->extent.miny = corner[NW].y();
> map->extent.maxy = corner[SW].y();
>
> I then create the 9 images.  If I then paste the 9 images together  
> I would
> expect a seamless connection (labels might be messed up).  I am not  
> seeing
> this.  The stitching is working on the same row.  A + B + C looks  
> good, D +
> E + F looks good and G + H + I looks good.  Hoever the columns are  
> wrong.  A
> + D + G has overlap on the top an bottom of the image.
>
> I used to do this manually (using GD) by converting the lat/lon  
> coordinates
> to pixels and calling GD methods to draw lines.  Comparing my older  
> images
> to the new MapServer images, it looks like the image is being  
> stretched in
> both Y directions (miny and maxy are both changing).
>
> Based on the tutorial I worked through and O'Reily's book, I  
> expected the
> features draw to be 'stretched' to match the number of pixels I  
> requested.
> I at least expected one of the y values to be correct, not both of  
> them.
>
> Any ideas here?  I am not actually using any projection in my map  
> file.  I
> am requesting lat/lon in the same projection a the shp file.  There  
> are no
> PROJECTION blocks in my map file at all.
>
> I can provide a copy of my map file and C code if it will help.  I  
> can also
> provide a image of the stiched images.

Brian,

Unless you're going through the WMS dispatcher, msDrawMap will fudge  
and adjust the spatial extents of your map in order to preserve a 1:1  
pixel aspect ratio. Look for the calls to msAdjustExtent.

Sean

---
Sean Gillies
sgillies at frii dot com
http://zcologia.com/news



More information about the mapserver-dev mailing list