Polygon Buffer Query

Lowell Filak lfilak at MEDINACO.ORG
Wed Sep 7 09:14:32 EDT 2005


The following message was sent by Abe Gillespie
<abe.gillespie at GMAIL.COM> on Sun, 4 Sep 2005 16:31:59 -0400.

> Is there a way to do this?  queryByPoint has the ability to supply a
> radius but queryByShape does.  I thought that setting the layer's
> TOLERANCE and TOLERANCEUNITS would help, but it doesn't seem to.  If
> this isn't built in functionality, could anyone point me to an
> algorithm that I can use to manually buffer a polygon before I supply
> it to queryByShape?

Abe,

You will need to compile mapserver with GEOS support and use the
'$shape->buffer()' on the existing shape to buffer it and then use the
new shape ($bshape) to do the query.
One thing I noticed in using it - turn on the error reporting before
using shapeObj->buffer as there are a slew of things that can cause it
not to work:

my $geoserr = new mapscript::errorObj();
my $bshape = $shape->buffer($bdistance);
print "ERROR: $geoserr->{message}\n";
$bshape->setBounds();

HTH

Lowell



More information about the mapserver-users mailing list