Version 4.4.1 dependency and/or linux platform dependency?

Brian Davis bdavis at USGS.GOV
Fri Apr 22 14:12:30 EDT 2005


Frank, et. al.,

I have decided to put the adjust extent fuctionality in my javascript,
which calls java to do the actual drawing.
I want the java to know the exent as defined in the current context
of its invocation, and not have to worry about dynamic adjustments.
My .js calls it each time we make a change, so I'll leave it alone,
and just send a new set of valid corner coordinates. (assuming I
can figure out how to do that based on your example ........)

My question is, I can figure out how to do a max in javascript,
how do I do a:
MS_CELLSIZE?

Thanks again.

Brian


On Thu, 21 Apr 2005 14:33:28 -0500, Brian Davis <bdavis at USGS.GOV> wrote:

>Frank,
>Thanks for the info.
>I just wanted to make sure of the situation before
>I went of and wrote software to do this manually.
>
>Now you'll know to get ready to duck if you see any more postings by me ...
>
>Brian
>
>
>
>On Thu, 21 Apr 2005 11:58:47 -0400, Frank Warmerdam <fwarmerdam at GMAIL.COM>
>wrote:
>
>>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