[ka-Map-users] Problem with Search in KAMAP with Postgis
Lorenzo Becchi
lorenzo at ominiverdi.com
Fri Jun 15 13:34:49 EDT 2007
Thank you Kuros,
I've uploaded your patch on CVS.
I've read the code and make sense to me but I've not the time to test it
in this days.
please, send back feedback if it works fine or not
ciao
Lorenzo
Kumar wrote:
>
> I found the same problem and made it work with couple of small fix and
> it works for me now.
>
> 1. I found that the parsing part of the search string was inside a
> for loop for each layer hence $searchstring = "\"".$szSearchfield."~*
> '".$searchstring."'\""; kept expanding for each for loop. I fixed that by
>
> $psearch = $searchstring; *// Around line 67*
>
> if($oLayer->connectiontype == MS_POSTGIS){ // *Around Line 144*
>
> $searchstring = "($szSearchfield ilike '%$psearch%')";
>
> } else {
>
> $searchstring = "\"".$szSearchfield."~* '".$psearch."'\"";
>
> }
>
> 2. Also modified the search string for postgis layer little bit.
> Also included in code above.
>
> 3. Around line 180 where the heading of the field were retrieved,
> *oResultCache* was grabbing the result using the layer index, so it
> there was just 1 result and the layer index was 3 it produced a error.
> I fixed that by changing such that it grabs the first result
>
> *Orginal*
>
> if ($totR) {
>
> $oResultCache = $oLayer->getResult($i);
>
> $oShape = $oLayer->getShape($oResultCache->tileindex,
> $oResultCache->shapeindex);
>
>
>
> * Modified*
>
> * *if ($totR) {
>
> $oResultCache = $oLayer->getResult(0);
>
> $oShape =
> $oLayer->getShape($oResultCache->tileindex, $oResultCache->shapeindex);
>
>
>
>
>
> I was working from version 1.5. I have also attached the php file
> along. But I think it is more efficient using within() function rather
> than querybyshape.
>
>
>
> - kumar
>
>
>
> -----Original Message-----
> From: ka-map-users-bounces at lists.maptools.org
> [mailto:ka-map-users-bounces at lists.maptools.org] On Behalf Of Lorenzo
> Becchi
> Sent: Friday, June 15, 2007 12:26 PM
> To: ka-map-users at lists.maptools.org
> Subject: [ka-Map-users] Problem with Search in KAMAP with Postgis
>
>
>
> > I will hazard a guess (although I have not checked the code) that the
>
> > search
>
> > function is using the MapScript queryByShape method, which doesn't
>
> > work when
>
> > using PostGIS for some reason. You can easily use PostGIS to perform a
>
> > similar function using within() which when proceeded by an extent query
>
> > actually seems to be more efficient than queryByShape anyway.
>
>
>
> Thanks Chris,
>
> who would be so kind to make a patch for this?
>
>
>
> ciao
>
> Lorenzo
>
>
>
>
>
> _______________________________________________
>
> ka-Map-users mailing list
>
> ka-Map-users at lists.maptools.org
>
> http://lists.maptools.org/mailman/listinfo/ka-map-users
>
>
>
More information about the ka-Map-users
mailing list