[Mapserver-users] Geting Image X and Y for dynamically-added points
Chip Hankley
Chip.Hankley at rmtinc.com
Tue Sep 16 13:25:07 PDT 2003
Erich -
You just need to work backwards. You will know the extent of your image
in real coordinates, and the size of your image in pixels. Once you know
these, it's pretty straightforward to solve for the pixel coordinates:
ImgX = ((MapX - MapMinX)/(MapMaxX - MapMinX)) * ImgWidth
The components of this are:
((MapX - MapMinX)/(MapMaxX - MapMinX)) gives you the % in the X
direction, multiplied by the ImgWidth gives you the pixel number
so if you're point is located 50% along the current mapextent, and your
image is 500 pixels wide, the ImgX location will be 0.5 * 500 = 250.
Do a similar thing for ImgY, but remember that ImgY STARTS at the top
and increases down.
Chip
Outgoing messages, along with any attachments, are scanned for viruses at RMT prior to sending.
------------------------------------------------------------------------------
NOTICE--This email may contain confidential and privileged information
for the sole use of the intended recipient. Any review or distribution
by others is strictly prohibited. If you are not the intended recipient,
please contact the sender immediately and delete all copies.
More information about the MapServer-users
mailing list