[Mapserver-users] <PARAM NAME="PIXEL_SIZE" VALUE="???">
Daniel Morissette
morissette at dmsolutions.ca
Fri Jan 10 12:06:02 PST 2003
> Steve McCrone wrote:
>
> The pixel_size = ([maxx] - [minx])/[width] will give me how many
> degrees (decimal degrees) is each pixel, But some further math has to
> be done to somehow equate this to a distance. Now, I could "inverse"
> between the two extents to get a metres value but I would essentiall
> ybe bypassing the "built-in" measurement
> <PARAM NAME="DIST_MSG" VALUE="Dist: %s m">.
>
> Still puzzled. I may have to resort to PHP mapscript to get further
> control over my app.
>
Ah, your need to convert the pixel size from degrees to meters, and
doing this accurately requires that you use the PROJ library because one
degree of longitude is not the same lenght depending on how far you are
from the equator. So to get an accurate pixel size value you would have
to use MapScript (Perl, PHP, etc.) or the php_proj module that comes in
the php_mapscript directory to calculate the size of one pixel at the
center of your map image.
Now, if you can live with a very rough approximation you can go with the
assumption that 1 degree is approx. 69 miles, or 110 km at the equator.
So the formula becomes:
pixel_size_in_meters = 110000*([maxx] - [minx])/[width]
Daniel
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
More information about the MapServer-users
mailing list