MapTools.org

[rosa-users] Distance Tool

Silke Reimer silke@intevation.de
Tue, 8 Oct 2002 09:02:14 +0200
--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hallo Bryan,

On Mon, Sep 30, 2002 at 08:30:09AM -0400, Bryan Tolka wrote:
> My distance tool works great at the full extent of the map. However,=20
> when I zoom in, obviously my pixel size changes, thus miscalculating my=
=20
> distance. Any ideas or suggestions is appreciated.

To get the pixel size for the Rosa Distance Tool we slightly changed the
MapServer code. Internally the pixel size is already used for several
purposes. So the trick was to provide the information to the user.=20


Here is the patch:

--------------------

diff -ur mapserver-3.6.2.orig/maptemplate.c mapserver-3.6.2/maptemplate.c
--- mapserver-3.6.2.orig/maptemplate.c  Mon Aug 12 08:48:30 2002
+++ mapserver-3.6.2/maptemplate.c       Mon Aug 12 08:53:50 2002
@@ -1963,6 +1963,8 @@
  =20
   sprintf(repstr, "%f", msObj->Map->scale);
   outstr =3D gsub(outstr, "[scale]", repstr);
+  sprintf(repstr, "%f", msObj->Map->cellsize);
+  outstr =3D gsub(outstr, "[cellsize]", repstr);
  =20
   sprintf(repstr, "%.1f %.1f", (msObj->Map->width-1)/2.0,
(msObj->Map->height-1)/2.0);
   outstr =3D gsub(outstr, "[center]", repstr);
----------------------------------------------

So you just have to add 2 lines to maptemplate.c. Afterwards you can
include the pixel size with the [cellsize] tag in the template. I hope this
helps.

Greetings,

	Silke

--=20
Silke Reimer

Intevation GmbH                      http://intevation.de/
FreeGIS                                http://freegis.org/


--IS0zKkzwUGydFO0o
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9ooL21W4oD4nfjasRAt4AAJ90fjV4DEdVjPekmdo7M8zIFSQ6rQCfcJT5
N84q71qEVj+bDhjgwZWts00=
=OmiW
-----END PGP SIGNATURE-----

--IS0zKkzwUGydFO0o--


This archive was generated by Pipermail.