[mapserver-users] PHP mapscript $shape->buffer() takes a longtime

Steve Lime Steve.Lime at dnr.state.mn.us
Wed Nov 18 09:35:15 EST 2009


You may not need to buffer at all. The shape query honors layer tolerances so
you can find parcels within a certain distance. So if $layer->{tolerance} is 500
and $layer->{toleranceunits} is 'meters' then your shape query will find all 
features within 500 meters. If you don't need to draw the buffered shape then
this might be a good option.

Steve

>>> "Worth Lutz" <wal3 at mindspring.com> 11/18/09 8:23 AM >>>
I'm learning a lot here.

I now understand how to get the buffered geometry quickly.

I am using the buffered geometry to use PHP mapscript to select parcel
intersecting the buffered geometry.

$layer->queryByShape($bufferedShape);

Are you telling me that there is a better/faster way to do this?



-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Ludwig
Kniprath
Sent: Wednesday, November 18, 2009 3:01 AM
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] PHP mapscript $shape->buffer() takes a
longtime

We had the same problem. In deed the buffer-algorithm is very expensive,
especially with large polygons and a large buffer-radius. If you use
Postgis, you can simplify the Polygon with ST_Simplify or
ST_SimplifyPreserveTopology in dependency from scale and buffer-radius, this
will make the buffer-process much faster without significant loss of
quality. You can do this on runtime on your original data with dynamic
PostGIS-queries. If you don't use PostGis, you have to create simplified
layers.

Pseudo-PHP-PostGIS-SQL:
SELECT ...
ST_SetSRID(ST_BUFFER(ST_SIMPLIFY($geometery_field,$simplify_tolerance),$buff
er_radius, $number_of_segments),$srid)::geometry ...FROM...

And don't use the buffered polygon for geo-queries, there are faster ways in
PostGIS and Mapserver.

Regards
Ludwig Kniprath 

>
>I'm trying to buffer a shape returned from a point query on a polygon layer
>of parcels.
>
> 
>
>When I try to use:
>
> 
>
>$bufferedShape = $shape->buffer(200);
>
> 
>
>I get back a fatal error: Maximum execution time of 30 seconds exceeded.
>
>I know that this is a php error message and that I could increase the
>allowable execution time.
>
> 
>
>If I use a buffer distance of 175 I get results.
>
> 
>
>Should it take such a long time to but a buffer around this parcel?  It is
a
>large parcel with one corner being a long curve like a quarter of a circle
>and another section on one side being a half circle.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
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