It might come from an incomplete parsing of your connection paramaters. 
Which would be strange, though, that the complex query works when 
putting the date as fixed string as you mentioned already... I have not 
tried every conceivable complicated sub-sub-subselection and correct 
parsing. You need to check the debug log and the query string that is 
sent to the database server.

armin

On 06/07/2009 10:03, Zafkiel ... wrote:
> Updating the layer shouldn't be a problem because I refresh the whole 
> page. When the user changes the slider's position, a new mapfile and a 
> new config file are created, using mapscript, AJAX and SimpleXML. The 
> page is then refreshed by the window.location method. The new config 
> file is given to the URL (&config=...).
> 
> The only thing that change in the new mapfile is "DATA" from the boats 
> layer, and the only node that changes in the new config file is 
> <mapFile> (with the path of the new mapfile).
> 
> pmapper draws the new mapfile fine. Everything but the search works. The 
> new boats layer is drawn, buttons from the toolbars are working 
> (identify, tooltip...).
> 
> I'm pretty sure the problem comes from the complexity of my request, 
> because the search works if I make it more simple. For example, "geom 
> FROM (SELECT * FROM boat_position AS p WHERE p. <= '$date') as foo using 
> unique pos_id using srid=27582"  (notice that the $date variable is 
> still there).
> 
> I really don't know what to do to solve this problem.
> 
> 
>  > Date: Fri, 3 Jul 2009 18:41:28 +0200
>  > From: armin.bur...@gmail.com
>  > To: zafkie...@hotmail.com
>  > CC: pmapper-users@lists.sourceforge.net
>  > Subject: Re: [pmapper-users] Searchitem won't work with a complex 
> Postgis request
>  >
>  > You are missing half of the story to tell...
>  >
>  > It looks like somewhere in the code you specify an update of the layer
>  > definition via Mapscript. Where, and how it reads the $date, who knows.
>  >
>  > All of these modifications have to be applied on the map object for all
>  > sorts of functions that should be aware of it. Identify uses standard
>  > functions of Mapscript also for Postgis layers, therefore it might work.
>  > For attribute searches on Postgis layers there is a special PGQuery
>  > class in squery.php. You have to ensure that your modifications to the
>  > map/layer object with the $date is also available there.
>  >
>  > Armin
> 
> 
>  > On 03/07/2009 14:47, Zafkiel ... wrote:
>  > > Hello,
>  > >
>  > > I'm trying to add a search function for a layer, using the 
> <searchitem> node. I've already got some layers with that search 
> implemented and it works fine.
>  > >
>  > > Here's the searchitem i've added :
>  > > <searchitem name="Boats" description="Boats">
>  > > <layer type="postgis" name="Boats">
>  > > <field type="n" name="boat_id" description="Boat id" wildcard="0" />
>  > > <field type="s" name="boat_name" description="Boat name wildcard="0"/>
>  > > </layer>
>  > > </searchitem>
>  > >
>  > > Here's the data used for this layer (using Mapscript) :
>  > > $layer->set("data", "geom FROM (SELECT * FROM boat_position AS p 
> WHERE p.date = (SELECT max(c.date) FROM coord_boats AS c WHERE c.date <= 
> '$date' AND c.boat_id = p.boat_id)) as foo using unique boat_id using 
> srid=27582");
>  > >
>  > >
>  > > boat_position is a view where I join data from 'boats' table (id, 
> name...) with their coordinates from 'coord_boats' table (geom, date, 
> angle...)
>  > > The result is the position of the boats which is the closest to the 
> date specified with the $date variable. The date is set with a slider 
> that I've put in the south Layout.
>  > >
>  > > This layer is drawn fine by pmapper, and the request works fine 
> when I test it on phpPgAdmin. But the search won't work. I've done many 
> tests and it seems that the searchitem can't work with postgis data 
> using a SELECT embedded in a WHERE...
>  > > Strangely, the toolbar works fine (you can identify the boats with 
> the identify button of the toolbar). Only the searchitem doesn't work. 
> The search works if I replace the select embedded in the where statement 
> by a random date.
>  > >
>  > > Anyone has an idea on how to solve this problem ?
>  > >
> 
> ------------------------------------------------------------------------
> Windows Liveā„¢: Keep your life in sync. Check it out! 
> <http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009>


------------------------------------------------------------------------------
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to