[ka-Map-users] Problem with Search in KAMAP with Postgis
Melanie Ritzau
MelanieRitz78 at web.de
Sun Jun 17 05:39:30 EDT 2007
After using kaSearch.php from latest CVS-image the Search-function works with the PostGIS-Layer !!
Thanks a lot to Kumar !
Unfortunately now the Search-function does not work anymore with shapefiles. Anybody else having this problem ?
Thanks,
Mel
>
>
> I tested Kumars kaSearch.php from
> http://lists.maptools.org/pipermail/ka-map-users/attachments/20070615/8d56b836/kaSearch.obj
>
> but the search function still doesn't give me any results from PostGIS-Layers. And with the patched kaSearch.php I also don't get search-results from shapefiles (that worked before with unpatched kaSearch.php )
>
> My PostGIS-layer is drawn correctly and also query-function works - only kaSearch doesn't work. If I replace the PostGIS-data with a shapefile (with same data) the (original,unpatched) kaSearch works.
>
> I don't get any errors - so I have no idea what is going wrong.
>
> Mel
>
>
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: Lorenzo Becchi <lorenzo at ominiverdi.com>
> > Gesendet: 15.06.07 19:47:47
> > An: ka-map-users at lists.maptools.org
> > Betreff: Re: [ka-Map-users] Problem with Search in KAMAP with Postgis
>
>
> >
> > 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
> > >
> > >
> > >
> > _______________________________________________
> > ka-Map-users mailing list
> > ka-Map-users at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/ka-map-users
> >
>
>
> __________________________________________________________________________
> Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!
> Mehr Infos unter http://produkte.web.de/club/?mc=021131
>
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
>
_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten!
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114
More information about the ka-Map-users
mailing list