[Mapserver-users] Drawquery issue
Frank Broniewski
Frank.Broniewski at mnha.etat.lu
Thu Jul 22 01:53:23 PDT 2004
Hello
Thank you for your tip, but that didn't do anything. I am unsure why I
have to use Open() twice in my SEARCHBYNAME function. But if I skip the
second Open() in the second foreach, I get the Error: msLayerGetShape():
Shapefile layer has not been opened. But why, I don't understand, since
I already opened it. Does getItems() close the layer automatically?
Well, for the hiliting of the shapefiles, I just found the solution.
Since I query one item of a shapefile after another, the result gets
overwritten, if the following item has no match (or result). Therefor
the query gets not drawn, since the (last) query had no success -> map
stays blank!
I will have to prevent that somehow
Greetings
Frank Broniewski
Musée National d'Histoire et d'Art
Section Préhistoire / Projet EPC
-----Message d'origine-----
De : mapserver-users-admin at lists.gis.umn.edu
[mailto:mapserver-users-admin at lists.gis.umn.edu] De la part de Ryan,
Adam Envoyé : Mittwoch, 21. Juli 2004 17:28 À : Frank Broniewski;
mapserver-users at lists.gis.umn.edu Objet : RE: [Mapserver-users]
Drawquery issue
Frank
Try removing the first $myLayer->Close() in your SEARCHBYNAME code.
Adam
-----Original Message-----
From: Frank Broniewski [mailto:Frank.Broniewski at mnha.etat.lu]
Sent: Wednesday, July 21, 2004 8:04 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [Mapserver-users] Drawquery issue
Hello List
I'm using two methods of querying my Map - querybypoint and
querybyattribute. Both use similar code to query the layers, please see
below. My problem is, that the drawquery - method with the querybypoint
does work, while with the querybyattribute doesn't. And I simply can't
figure out why :-)
Here comes my code
---------------------------------------------
SEARCHBYNAME:
...
foreach ($MapLayers as $layer) {
$myLayer = $MapObj->getLayerByName($layer);
$myLayer->set("status",1);
$myLayer->Open();
$dbheaders = $myLayer->getItems();
$myLayer->Close();
foreach ($dbheaders as $spaltenname) {
if (@$myLayer->queryByAttributes($spaltenname,
$SuchOrt,"MS_MULTIPLE") == MS_SUCCESS) {
$NumResults = $myLayer->getNumResults();
$myLayer->Open();
for ($i=0; $i < $NumResults; $i++) {
$result = $myLayer->getResult($i);
$data = $myLayer->getShape($result->tileindex,
$result->shapeindex);
$erg[] = $layer;
$erg[] = $data->values;
$data->free();
}
$myLayer->Close();
}
}
}
return $erg;
SEARCHBYPOINT:
...
foreach ($MapLayers as $layer) {
$myLayer = $MapObj->getLayerByName($layer);
$myLayer->set("status",1);
if (@$myLayer->queryByPoint($myPoint, "MS_MULTIPLE", 0) ==
"MS_SUCCESS") {
$NumResults = $myLayer->getNumResults();
$myLayer->Open();
for ($i=0; $i < $NumResults; $i++) {
$result = $myLayer->getResult($i);
$data = $myLayer->getShape($result->tileindex,
$result->shapeindex);
$erg[] = $layer;
$erg[] = $data->values;
$data->free();
}
$myLayer->Close();
}
}
return $erg;
As you can see, both get the selected maplayers to work with.
SEARCHBYNAME get the Attributenames from the shapefile via getItems and
queries each Attribute seperately. The rest of the code works quite
similar. Does anybody have a clue why SEARCHBYNAME doesnt draw the
query? Maybe I have coded some logical error, since I read the
attributes( and their
values) from the shapefile for each layer correctly.
Many thanks in advance
Frank Broniewski
Musée National d'Histoire et d'Art
Section Préhistoire / Projet EPC
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list