MapTools.org

[rosa-users] setting the PIXEL_SIZE on-the-fly for the distance tool

Steve McCrone mccrone@pc.jaring.my
Sun, 5 Jan 2003 15:17:02 +0800
This is a multi-part message in MIME format.

------=_NextPart_000_0018_01C2B4CD.7FDEABF0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am working directly with mapserver and so far the applet has been =
excellent. Now, I'm dealing with the distance tool. What I'm thinking is =
this -=20
when my page loads I call - <body onLoad=3D"setPixelSize();"> that calls =
this -=20

<SCRIPT LANGUAGE=3D"JavaScript">
function setPixelSize(){
var aForm =3D document.forms[0]

//I can re-calculate the pixel size by usng the minx, maxx, miny, maxy =
and the distance across (i.e. mapwidth)
//this will give me the pixel-to-geographic conversion value

//i have seen this posted by a previous question -=20

//map_distance =3D (map_width-1)/(MS_PPI*inches_per_unit);
//ground_distance =3D extent_maxx - extent_minx;
//scale =3D ground_distance/map_distance;

//where=20
 // MS_PPI =3D number of pixels per inch for a computer monitor =3D 72;
  //inches_per_unit =3D number of inches per map unit (i.e. UNITS ...)



aForm.pixelSize.value =3D [maxx];
}
</SCRIPT>
I also have declared - <INPUT TYPE=3D"hidden" NAME=3D"pixelSize" =
VALUE=3D"" SIZE=3D10>

Firstly, how do I assign the new value of pixelSize to the statement - =
<PARAM NAME=3D"PIXEL_SIZE" VALUE=3D ???????>=20
I'n not sure what goes in for ???????

Secondly, am I on the right track with the pixelSize calculation?

Thanks for any hints anyone can provide.

Steve







------=_NextPart_000_0018_01C2B4CD.7FDEABF0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am working directly with mapserver =
and so far the=20
applet has been excellent. Now, I'm dealing with the distance tool. What =
I'm=20
thinking is this - </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>when my page loads I call - &lt;body=20
onLoad=3D"setPixelSize();"&gt; that calls this - </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;SCRIPT =
LANGUAGE=3D"JavaScript"&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>function setPixelSize(){<BR>var aForm =
=3D=20
document.forms[0]</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//I can re-calculate the pixel size by =
usng the=20
minx, maxx, miny, maxy and the distance across (i.e. =
mapwidth)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>//this will give me the =
pixel-to-geographic=20
conversion value</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//i have seen this posted by a previous =
question -=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//map_distance =3D=20
(map_width-1)/(MS_PPI*inches_per_unit);<BR>//ground_distance =3D =
extent_maxx -=20
extent_minx;<BR>//scale =3D ground_distance/map_distance;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//where </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;// MS_PPI =3D number of pixels =
per inch for a=20
computer monitor =3D 72;<BR>&nbsp; //inches_per_unit =3D number of =
inches per map=20
unit (i.e. UNITS ...)<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV>
<DIV><BR>aForm.pixelSize.value =3D [maxx];</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}<BR>&lt;/SCRIPT&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I also have declared - &lt;INPUT =
TYPE=3D"hidden"=20
NAME=3D"pixelSize" VALUE=3D"" SIZE=3D10&gt;<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Firstly, how do I assign the new value =
of pixelSize=20
to the statement - &lt;PARAM NAME=3D"PIXEL_SIZE" VALUE=3D=20
???????&gt;&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'n not sure what goes in for =
???????</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Secondly, am I on the right track with =
the=20
pixelSize calculation?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for any hints anyone can=20
provide.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Steve</DIV>
<DIV><BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2><BR>&nbsp;</DIV>
<DIV><BR></DIV></FONT></BODY></HTML>

------=_NextPart_000_0018_01C2B4CD.7FDEABF0--




This archive was generated by Pipermail.