[Mapserver-users] Geting Image X and Y for dynamically-added points
Erich Schroeder
erich at museum.state.il.us
Tue Sep 16 14:22:42 PDT 2003
Chip,
Thanks, now that you point it out I remember having this shown to me at
MUM. I'll work on this tonight.
Erich
On Tue, 16 Sep 2003, Chip Hankley wrote:
> 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.
>
--
---------------------------------------------------------------------
Erich Schroeder Phone: (217)785-0033
Curator, Information Technologies FAX: (217)785-2857
Illinois State Museum GIS Lab email:erich(at)illinois.state.museum
http://illinois.state.museum/
---------------------------------------------------------------------
More information about the MapServer-users
mailing list