[mapserver-users] An intellectual exercise

Hankley, Chip Chip.Hankley at GASAI.Com
Fri Mar 15 08:36:02 PST 2002


Steve,

Following up on Rich's suggestion...

I would do this using the DEM approach. I'll address this using ArcInfo GRID
terms, but I presume you could do the same thing in GRASS, IDRISI, or any
other GIS that supports raster modeling.

In GRID, create a FLOWDIRECTION grid. You would do this by creating a DEM,
then filling it (FILL command), then running the FLOWDIRECTION command.
FLOWDIRECTION creates a grid of values that indicate the direction of flow:

32 64 128
16  x  1
8   4  2

"x" is the cell of focus, if the value of "x" is "1", then flow goes to the
east, if the value of "x" is "2", flow goes to the southeast, if "x" is "4",
flow goes south, etc.

You should be able to convert this dataset to an image, include this in your
mapfile as a layer, then return the value of a "pixel" at the point where
the user clicks. If the return value was 1, you would render a graphic at
that point where the arrow pointed to the right (east).

I'm not sure of the exact mechanics of doing this last part, but I can think
of a couple of ways -

  generate a shapefile on the fly, use a symbol as the graphic (an arrow),
and rotate the symbol (I don't know if you can do this...)
  generate a shapefile on the fly, and use a different symbol based on the 8
possible return values

Hope this helps!

Chip

-----Original Message-----
From: Steven Hayes [mailto:shayes at bigpond.net.au]
Sent: Wednesday, March 13, 2002 5:55 PM
To: Mapserv (E-mail)
Subject: [mapserver-users] An intellectual exercise


Hi All,

I am rolling out a 2m contour layer on an existing application focused on
environmental education. The contours are coloured based on height giving a
quasi 3d effect:

http://www.streamwatch.org.au/gisdemo

It would be a truly fantastic educational resource if a user could click
somewhere on the map and have an arrow drawn showing which way runoff will
flow based on some kind of algorithm that calculates the nearest two contour
lines and works out which is the highest and perhaps their angle with
respect to each other. I am using mapscript and can already return shape
indexes etc (thanks to the help of several on this list) but I am not sure
how to approach this kind of query - if indeed it can be done.

Any ideas anyone?

Regards

Steven Hayes



More information about the MapServer-users mailing list