[Mapserver-dev] Re: Rect in polygon function

Steve Lime steve.lime at dnr.state.mn.us
Mon Feb 10 12:47:02 EST 2003

That specific function doesn't exists, but all the pieces do. It should
be easy, just 2 steps:

  1) test each rectangle vertex with a point in polygon check
  2) test each rectangle segment  for intersection against all polygon segments

If a rectangle passes all those then it's completely inside the polygon. The point in
polygon and segment intersection functions have already been written and are
in mapsearch.c. There are also several functions in that same source file that
demonstrate looping through a shape's line segments.


>>> Daniel Morissette <morissette at dmsolutions.ca> 02/08/03 04:29PM >>>
Steve, all,

We are looking for a function that would tell us if a rectangle is
comprised completely inside a polygon, is such a function already
available in MapServer or anywhere else?  What we're trying to do is
find out if the current map view (a rectangle), is completely contained
inside a polygon that represents available raster coverage.  If the map
view is completely contained inside the raster coverage then we want to
use a raster layer as the map, otherwise we want to use vector data.  We
want to avoid having both the raster and vector layers showing up in the
same map image, that's why we need this function to test if the current
map view is completely contained inside the polygon defining the raster
layer's coverage.

Thanks in advance for any help/pointers.

 Daniel Morissette               morissette at dmsolutions.ca 
 DM Solutions Group              http://www.dmsolutions.ca/ 

More information about the mapserver-dev mailing list