[mapserver-users] Getteing the intersection of two layers

Steve Lime Steve.Lime at dnr.state.mn.us
Thu Nov 6 11:42:40 PST 2008


You could try a feature query in MapServer/MapScript. First step is to do a query that
selects the polygons (probably by attribute) and then do a queryByFeatures() query
on the point layer. The result would be a set of points that are contained in your 
polygon features. Be sure to set the TOLERANCE in the point layer to 0 if you want
the points to be in the selection polygons.

The advantage here is that you don't have to do any up front geometry computations
on your polygons. It boils down to a bunch of point-in-polygon computations which are
relatively fast.

Steve

>>> On 11/6/2008 at 10:19 AM, in message
<aa5471510811060819t5ec5d06tba2476c5650f022 at mail.gmail.com>, "Christian Jauvin"
<cjauvin at gmail.com> wrote:
> Hi Everyone,
> 
> I have two layers that I want to intersect: one with points, and one
> with multiple polygons representing the regions of a territory.
> 
> The first approach I just tried is doing it programmatically, through 
> Python/MS:
> 
> I first union all the region polygons, and then get the convex hull of
> this super-shape. I then restrict the points to those inside this
> convex hull.
> 
> The problem is that it is really too slow.. I'm aware that I could do
> it through PostGIS, and that performance would surely much better, but
> I'd rather stay with a more generic solution, that is applicable to
> shapefile data sources as well.
> 
> Would someone be aware of a better method, maybe one involving only
> mapfile directives?
> 
> Thank you,
> 
> Christian
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org 
> http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the MapServer-users mailing list