Zoom to Real Point

Eric Katherman vaiod at BERLOY.COM
Mon Oct 18 20:21:15 PDT 2004


Yea the example I posted was the math that seems to work, albeit conceptually
wrong. I initially started doing exactly what you are talking about 800/2 =
400 so add 400 to the right and subtract from the left and apply the same
concept to top/bottom.  It worked kind of but centered the point on the
bottom right corner.  I must  be overlooking something but what I have seems
to work for whatever reason... I wonder why there isn't a builtin function
for that e.g. pointcenter(x,y) that would make this easy.

Eric

> I am not sure I follow your code exactly but I think you are
> multiplying by two when you should be dividing eg:
>
> $right_brdr = ($link[0] + ($_COOKIE["CTRENCH_GIS_CONF-WIDTH"] /2));
> $left_brdr = ($link[0] - ($_COOKIE["CTRENCH_GIS_CONF-WIDTH"] /2));
> $top_brdr = ($link[1] + ($_COOKIE["CTRENCH_GIS_CONF-HEIGHT"] /2));
> $bottom_brdr = ($link[1] - ($_COOKIE["CTRENCH_GIS_CONF-HEIGHT"] /2));
>
> If I follow your intent correctly you want to set the border extents
> equal to "CTRENCH_GIS_HEIGHT" x "CTRENCH_GIS_WIDTH" so you want to add
> half the height to the top, subtract half the height from the bottom,
> add half the width to the right and subtract half the width from the
> left.  By multiplying by two instead of dividing you are positioning
> your desired point 1/4 of the way across the screen.
>
> But it is the end of a long day and I might be code drunk
>
> -Mike



More information about the MapServer-users mailing list