[mapserver-users] Finding pixel location from decimal degrees
Stephen Woodbridge
woodbri at swoodbridge.com
Wed Apr 17 07:29:53 PDT 2002
You should be able to find it by simple ratios. Your map EXTENTS are
minx miny maxx maxy so your width = maxx - minx; height = maxy -miny;
your image is SIZE ix iy so:
px = (long - minx) / width * ix
py = (lat - miny) / height * iy
Should do it. You might need to deal with the fact that LAT increase
moving up the map and pixel address increases moving down the map.
-Steve
"Kieran J. Ames" wrote:
>
> Hello list,
>
> I'd like to know if anyone can share some wisdom with me.
>
> I typically would make a map of a polygon and a point, using a decimal
> degrees. I'd like to now look at the resulting gif image from a pixel
> perspective and, knowing the latitude and longitude of the point I
> originally made, again find that point by referencing its location by
> the number of pixels right and down of the top-left pixel in the image
> (or whatever other referencing means is appropriate).
>
> Any guidance appreciated.
>
> Thanks,
> Kieran
More information about the MapServer-users
mailing list