[Mapserver-users] querybyshape failing
AARON KONING
aaronkoning at shaw.ca
Mon Apr 12 13:51:55 PDT 2004
Hi List,
I am having a problem with the php mapscript querybyshape method of the layerobj (and mapobj). When I create a polygon outlining the entire layer I get the 'No matching record(s) error even though I assume that the query should have found all records. Does querybyshape check for features contained/intersected/? and why is the following code failing.
Thanks,
Aaron
|------------------------------------------------
<?php
// Include the PHP MapScript module
dl('php_mapscript.so');
// Create map (and draw it or else nothing works)
$map = ms_newMapObj('testmap.map');
$image = $map->draw();
// create the lines for the polygon
$line = ms_newLineObj();
$line->addXY(100000,100000);
$line->addXY(100000,2000000);
$line->addXY(2000000,2000000);
$line->addXY(2000000,100000);
$line->addXY(100000,100000);
// create the polygon shape and add the above line to it
$shape = ms_newShapeObj(MS_SHAPE_POLYGON);
$shape->add($line);
// get a layer to query on
$layer = $map->getLayerByName('test_layer');
// draw the shape (or nothing works)
$shape->draw($map, $layer, $image);
// perform query on layer
$layer->queryByShape($shape);
// save the image for display
$imageUrl = $image->saveWebImage(MS_PNG,1,1,0);
?>
<img src="<?php echo $imageUrl; ?>" />
|--------------------------------------------------
OUTPUTS:
Warning: [MapServer Error]: msQueryByShape(): No matching record(s) found. in /var/www/html/test/shapeobj.php on line 29
More information about the MapServer-users
mailing list