[ms4w-users] queryByShape() without results

Ludwig Kniprath kniprath.l at wver.de
Tue Nov 7 06:12:47 EST 2006

Hello list,
I'm using ms4w (MapServer version 4.10.0) with phpMapscript on postGIS-Data. 
I try to use a selection on a featurtheme (polygon), optionally buffer the resultshapes and use the shapes for a spatial query on another featuretheme (points e.g. query all supermarkets within a selected municipality).

Code (simplified):

$query_map = ms_newMapObj($query_map_file_path);
$query_map->setExtent($_GET['old_extent_left'], $_GET['old_extent_bottom'], $_GET['old_extent_right'], $_GET['old_extent_top']);
$query_map_image = $query_map->prepareImage();
$source_layer = $query_map->getLayerByName("Gemeindegebiete");
$target_layer = $query_map->getLayerByName("Sonderbauwerke");
$query_shape = $source_layer->getShape(-1, 19);
$query_shape->draw($query_map, $source_layer, $query_map_image);
$query_result = $target_layer->queryByShape($query_shape);

Problem is, that queryByShape (or whichShapes() + nextShape() as alternative) gives no results, allthough there *are* some points within that polygon.
"Warning: [MapServer Error]: msQueryByShape(): No matching record(s) found..."

"Manufacturing" a rectangular $query_shape with 
$query_shape = ms_shapeObjFromWkt("POLYGON((2511877 5622343,2511877 5629144,2518548 5629144,2518548 5622343,2511877 5622343))");
has the same problems...

Is this a bug or am I doing something wrong?

Thanks in advance for your help...


Ludwig Kniprath
c.o. Wasserverband Eifel-Rur
Unternehmensbereich Flussgebietsmanagement
Fachbereich Geografische Informationssysteme

Eisenbahnstraße 5
52353 Düren

Tel.:  02421/494-1041
Fax:  02421/494-1019

kniprath.l at wver.de

More information about the ms4w-users mailing list