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

_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to