queryByShape() without results

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

queryByShape() without results

Ludwig Kniprath-2
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->setSize($_GET['new_map_width'],$_GET['new_map_height']);
$query_map->setExtent($_GET['old_extent_left'], $_GET['old_extent_bottom'], $_GET['old_extent_right'], $_GET['old_extent_top']);
$query_map->preparequery();
$query_map_image = $query_map->prepareImage();
$source_layer = $query_map->getLayerByName("Gemeindegebiete");
$target_layer = $query_map->getLayerByName("Sonderbauwerke");
$source_layer->open();
$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..."

Hint:
"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

------------------------------------
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

[hidden email]
http://www.wver.de


_______________________________________________
ms4w-users mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/ms4w-users
Reply | Threaded
Open this post in threaded view
|

re: queryByShape() without results

Ludwig Kniprath-2
Hello list,
some "errors" (especially own errors) are really hard to find...

Problem was the order of functioncall:
1. $query_shape->draw($query_map, $source_layer, $query_map_image);
2. $query_result = $target_layer->queryByShape($query_shape);


After Step 1 the $query_shape is no more useable for further tasks like spatial queries (perhaps a bug, should be mentioned in the doku ...).

As workaround:
Allways *first* $target_layer->queryByShape($query_shape), *afterwards* $query_shape->draw().

bye...

Ludwig


_______________________________________________
ms4w-users mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/ms4w-users