[mapserver-users] buffer bounds (PHP Mapscript)
Armin Burger
armin.burger at gmx.net
Fri Apr 11 10:36:13 PDT 2008
Carlo
I don't know if this behaviour is a feature or a bug of PHP Mapscript (I
have not tested it with SWIG versions of Mapscript). A workaround is to
project the buffer in the same projection as the layer. Then the extent
is returned correctly. Something like
$prj = ms_newprojectionobj($queryLayer->getProjection());
$buffer_polygon=$selected_shape->buffer($buffer_width);
$buffer_polygon->project($prj, $prj);
$shapebounds=$buffer_polygon->bounds;
Armin
On 11/04/2008 14:20, Carlo Pelliconi wrote:
> Hi.
> I'm trying to obtain automatic zoom on a buffer (which I want to see in
> map - and I do that) created around a selected feature.
> I use
>
> $selected_shape=$queryLayer->getShape(...);
> $buffer_polygon=$selected_shape->buffer($buffer_width);
> $shapebounds=$buffer_polygon->bounds;
>
> This doesn't work: $buffer_shapebounds (which is a rectobj) is set to -1
> -1 -1 -1 and used in setExtent it doesn't work.
> If I apply the same code to a "real" shapefile (eg. the result of a
> getShape, without the buffer around), it works:
>
> $selected_shape=$queryLayer->getShape(...);
> $shapebounds=$selected_shape->bounds;
>
> In this case $shapebounds is well defined and used in setExtent it works.
>
> Any idea or suggestion?
> Thanks in advance
>
More information about the MapServer-users
mailing list