counting pixel values within polygons

teb teb at mallit.fr.umn.edu
Fri Jan 26 14:43:19 EST 2001


>Date: Fri, 26 Jan 2001 13:27:33 -0500
>From: Michael Hearne <Michael.Hearne at noaa.gov>
>X-Accept-Language: en
>MIME-Version: 1.0
>CC: mapserver-users at lists.gis.umn.edu
>Subject: counting pixel values within polygons
>Content-Transfer-Encoding: 7bit
>
>Mapserver users - We're in the midst of planning a project here dealing
>with raster data analysis.
>
>I wrote a quick (read: cheesy) C routine that counts the pixels in an
>image that have the value X.  I can (and probably will) extend this to
>be able to get some subset of that image and count the pixels in that
>subset.  This all should be easy.  My users, however, would like to see
>all of the pixels inside of a particular polygon (shapefile).  There is
>an article on the web talking about various solutions to the
>"point-in-a-polygon" problem - 
>
>http://home.earthlink.net/~bobstein/inpoly/
>
>and just stealing that code looks pretty easy.
>
>What I am more uncertain about is the process of extracting all of the
>nodes (is that the right word?) of a shapefile polygon and passing them
>to one of these "point-in-a-polygon" routines.  Does the mapserver
>source code include a routine that would make this simple, or is there
>other stuff out there to simplify this process?
>
>I have a fairly short amount of time that I'll be allowed to devote to
>this process, so the easier the better.
>

You should also note that raster data query and analysis capability is a 
focus of the TerraSIP project's enhancements to MapServer. To see a couple 
examples: <http://terrasip.gis.umn.edu/projects/egis/avhrr/>, 
<http://terrasip.gis.umn.edu/projects/egis/knn/index.html>. The hooks for 
this are in the MapServer distribution (I believe). We can make the 
additional code available to anyone who asks.

TOm




More information about the mapserver-users mailing list