Version 4.4.1 dependency and/or linux platform dependency?

Frank Warmerdam fwarmerdam at GMAIL.COM
Thu Apr 21 11:58:47 EDT 2005


On 4/21/05, Brian Davis <bdavis at usgs.gov> wrote:
> Frank,
> 
> Thanks for your reply.
> Yes, you understood my problem correctly.
> Now, I am trying to understand your response .....
> I AM making wms requests, and if I understand your comments correctly,
> I have to "pre-adjust my bounding box to match the aspect ratio
> of the image size" .... not sure what this means ......
> 
> To avoid this, do I add an entry to my map file like:
> CONFIG MS_NONSQUARE NO
> or
> CONFIG MS_NONSQUARE FALSE
> ?

Brian,

You cannot override MS_NONSQUARE in WMS mode.  The
GetMap request forces it on for WMS protocol compliance.
Basically what I am suggesting is that you either need to 
adjust your BBOX to have the same aspect ratio as your
WIDTH/HEIGHT or you need to adjust the WIDTH/HEIGHT
of your request.  

To get the old behavior, you would need to expand the
BBOX extent in one dimension or the other till you get the
same aspect ratio as the image being requested. 

The following C code from MapServer essentially does this
calculation.  You may want to adapt this approach. I t
basically picks the "maximum" cellsize from the two dimensions
and then recomputes the BBOX around the center of the old
area with the same cellsize in both directions.  

double msAdjustExtent(rectObj *rect, int width, int height)
{
  double cellsize, ox, oy;

  cellsize = MS_MAX(MS_CELLSIZE(rect->minx, rect->maxx, width),
MS_CELLSIZE(rect->miny, rect->maxy, height));

  if(cellsize <= 0) /* avoid division by zero errors */
    return(0);

  ox = MS_MAX((width - (rect->maxx - rect->minx)/cellsize)/2,0); /*
these were width-1 and height-1 */
  oy = MS_MAX((height - (rect->maxy - rect->miny)/cellsize)/2,0);

  rect->minx = rect->minx - ox*cellsize;
  rect->miny = rect->miny - oy*cellsize;
  rect->maxx = rect->maxx + ox*cellsize;
  rect->maxy = rect->maxy + oy*cellsize;

  return(cellsize);
}

I assume you have some JavaScript or Java or something on the
client where you could adjust your bounds? 

> Maybe I can tar up my entire web site, send it to you, go on vacation,
> have you fix everything while I'm gone, then take credit for it when
> I get back?????!!!!!! :)

That is what I have consulting rates for!

More seriously, I am weak on real "application building" with MapServer,
though I can be helpful on input and rendering part of such work.  I 
don't generally like working for governments though.  Too much 
paperwork. :-)  

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    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list