LocateByAttribute in Postgis

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

LocateByAttribute in Postgis

Fons Arts

Hi list,

 

I am added the latest widget (from CVS) locatebyattribute to zoom to values stored in a  Postgis database.

In this test I’m searching for the value OLO00 A 1037 witch exist in a view. After clicking the search button I get no results.

 

Warning: [MapServer Error]: msQueryByAttributes(): No matching record(s) found. in E:\ms4w\chameleon\htdocs\widgets\LocateByAttribute\searchresults.phtml on line 361

No results found for 'OLO00 A 1037'

--------------------------------------------------------------------------------

  kadastraal nummer   aanduid    Find 

Limit search to current map extents 

 

 

My Map file looks like;

 

                        LAYER

                        CONNECTIONTYPE postgis

                        NAME "kadastraal nummer"

                        GROUP "Eigendommen"

                        CONNECTION *************************************************************

                        DATA "wkb_geometry from (select oid, aanduid, eigenaar, wkb_geometry from public.v_kadaster where aanduid = 'OLO00 A 1037') as foo using srid=-1 using unique aanduid"

                        TEMPLATE "dummy.htm"

                        TOLERANCE 10

                        MINSCALE 0

                        MAXSCALE 20000

                        STATUS default

                        TYPE polygon

                        METADATA

                                   SPATIALSEARCH "aanduid"

                        END

                        CLASS

                        NAME 'string'

                                   SIZE 22

                        COLOR 253 239 221

                                   outlineCOLOR 255 255 0

                            MINSCALE 0

                        END

            END

                        END  # LAYER

 

Anybody tips

Thanks

Fons


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

Re: LocateByAttribute in Postgis

Bart van den Eijnden
Hi Fons,

Jacob can probably answer this one best, but I'll give it a try.

First of all, which version of PHP/Mapscript are you currently running?

Secondly, try and log the query that Mapscript sends to PostGIS at the
database, see for instance:

http://www.databasejournal.com/features/postgresql/article.php/3323561

Best regards,
Bart

Fons Arts schreef:

>
> Hi list,
>
> I am added the latest widget (from CVS) locatebyattribute to zoom to
> values stored in a Postgis database.
>
> In this test I’m searching for the value OLO00 A 1037 witch exist in a
> view. After clicking the search button I get no results.
>
> /Warning: [MapServer Error]: msQueryByAttributes(): No matching
> record(s) found. in
> E:\ms4w\chameleon\htdocs\widgets\LocateByAttribute\searchresults.phtml
> on line 361/
>
> /No results found for 'OLO00 A 1037'/
>
> /--------------------------------------------------------------------------------/
>
> / kadastraal nummer aanduid Find /
>
> /Limit search to current map extents /
>
> My Map file looks like;
>
> /LAYER/
>
> / CONNECTIONTYPE postgis/
>
> / NAME "kadastraal nummer"/
>
> / GROUP "Eigendommen"/
>
> / CONNECTION
> *************************************************************/
>
> / DATA "wkb_geometry from (select oid, aanduid, eigenaar, wkb_geometry
> from public.v_kadaster where aanduid = 'OLO00 A 1037') as foo using
> srid=-1 using unique aanduid"/
>
> / TEMPLATE "dummy.htm"/
>
> / TOLERANCE 10/
>
> / MINSCALE 0/
>
> / MAXSCALE 20000/
>
> / STATUS default/
>
> / TYPE polygon/
>
> / METADATA /
>
> / SPATIALSEARCH "aanduid"/
>
> / END/
>
> / CLASS/
>
> / NAME 'string'/
>
> / SIZE 22/
>
> / COLOR 253 239 221 /
>
> / outlineCOLOR 255 255 0 /
>
> / MINSCALE 0/
>
> / END/
>
> / END /
>
> / END # LAYER/
>
> / /
>
> Anybody tips
>
> Thanks
>
> Fons
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Chameleon mailing list
> [hidden email]
> http://lists.maptools.org/mailman/listinfo/chameleon
>  


--
Bart van den Eijnden
OSGIS, Open Source GIS
[hidden email]
http://www.osgis.nl

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

Re: LocateByAttribute in Postgis

Bart van den Eijnden
Just noticed something else, you are using a string column as the unique
column. I believe Mapserver cannot deal with this.

Try USING UNIQUE oid instead

Best regards,
Bart

Bart van den Eijnden (OSGIS) schreef:

> Hi Fons,
>
> Jacob can probably answer this one best, but I'll give it a try.
>
> First of all, which version of PHP/Mapscript are you currently running?
>
> Secondly, try and log the query that Mapscript sends to PostGIS at the
> database, see for instance:
>
> http://www.databasejournal.com/features/postgresql/article.php/3323561
>
> Best regards,
> Bart
>
> Fons Arts schreef:
>>
>> Hi list,
>>
>> I am added the latest widget (from CVS) locatebyattribute to zoom to
>> values stored in a Postgis database.
>>
>> In this test I’m searching for the value OLO00 A 1037 witch exist in
>> a view. After clicking the search button I get no results.
>>
>> /Warning: [MapServer Error]: msQueryByAttributes(): No matching
>> record(s) found. in
>> E:\ms4w\chameleon\htdocs\widgets\LocateByAttribute\searchresults.phtml
>> on line 361/
>>
>> /No results found for 'OLO00 A 1037'/
>>
>> /--------------------------------------------------------------------------------/
>>
>>
>> / kadastraal nummer aanduid Find /
>>
>> /Limit search to current map extents /
>>
>> My Map file looks like;
>>
>> /LAYER/
>>
>> / CONNECTIONTYPE postgis/
>>
>> / NAME "kadastraal nummer"/
>>
>> / GROUP "Eigendommen"/
>>
>> / CONNECTION
>> *************************************************************/
>>
>> / DATA "wkb_geometry from (select oid, aanduid, eigenaar,
>> wkb_geometry from public.v_kadaster where aanduid = 'OLO00 A 1037')
>> as foo using srid=-1 using unique aanduid"/
>>
>> / TEMPLATE "dummy.htm"/
>>
>> / TOLERANCE 10/
>>
>> / MINSCALE 0/
>>
>> / MAXSCALE 20000/
>>
>> / STATUS default/
>>
>> / TYPE polygon/
>>
>> / METADATA /
>>
>> / SPATIALSEARCH "aanduid"/
>>
>> / END/
>>
>> / CLASS/
>>
>> / NAME 'string'/
>>
>> / SIZE 22/
>>
>> / COLOR 253 239 221 /
>>
>> / outlineCOLOR 255 255 0 /
>>
>> / MINSCALE 0/
>>
>> / END/
>>
>> / END /
>>
>> / END # LAYER/
>>
>> / /
>>
>> Anybody tips
>>
>> Thanks
>>
>> Fons
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Chameleon mailing list
>> [hidden email]
>> http://lists.maptools.org/mailman/listinfo/chameleon
>>  
>
>


--
Bart van den Eijnden
OSGIS, Open Source GIS
[hidden email]
http://www.osgis.nl

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

RE: LocateByAttribute in Postgis

Delfos, Jacob
In reply to this post by Fons Arts
Hi Fons,
 
I have only implemented the functionality with PostGIS recently, but I do believe it should work the way you are using it.
There were some issues with Mapserver queries to PostGIS and quotes in version 4.10, but I have put a fix in for that last week (additional quotes around query). On my end, I can do a query on a string attribute without problems (partial match also works, e.g. 'OLO00' in your case). But my data statements are very simple. There have been several messages lately about quotes, and things that don't work like before, so perhaps it is related somehow..... Try putting quotes everywhere :)
 
Make sure you have the latest version of the widget (> 25 Oct), because this is when I applied the quote fix.
 
Try what Bart said (capturing the query), and let me know what it says. By the way, do any queries work for you with this widget?
 
regards,

Jacob
 
 
 
 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Fons Arts
Sent: 31 October 2006 23:08
To: [hidden email]
Subject: [Chameleon] LocateByAttribute in Postgis

Hi list,

 

I am added the latest widget (from CVS) locatebyattribute to zoom to values stored in a  Postgis database.

In this test I’m searching for the value OLO00 A 1037 witch exist in a view. After clicking the search button I get no results.

 

Warning: [MapServer Error]: msQueryByAttributes(): No matching record(s) found. in E:\ms4w\chameleon\htdocs\widgets\LocateByAttribute\searchresults.phtml on line 361

No results found for 'OLO00 A 1037'

--------------------------------------------------------------------------------

  kadastraal nummer   aanduid    Find 

Limit search to current map extents 

 

 

My Map file looks like;

 

                        LAYER

                        CONNECTIONTYPE postgis

                        NAME "kadastraal nummer"

                        GROUP "Eigendommen"

                        CONNECTION *************************************************************

                        DATA "wkb_geometry from (select oid, aanduid, eigenaar, wkb_geometry from public.v_kadaster where aanduid = 'OLO00 A 1037') as foo using srid=-1 using unique aanduid"

                        TEMPLATE "dummy.htm"

                        TOLERANCE 10

                        MINSCALE 0

                        MAXSCALE 20000

                        STATUS default

                        TYPE polygon

                        METADATA

                                   SPATIALSEARCH "aanduid"

                        END

                        CLASS

                        NAME 'string'

                                   SIZE 22

                        COLOR 253 239 221

                                   outlineCOLOR 255 255 0

                            MINSCALE 0

                        END

            END

                        END  # LAYER

 

Anybody tips

Thanks

Fons


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

Re: LocateByAttribute in Postgis

Delfos, Jacob
In reply to this post by Fons Arts
Hi Fons,
 
That error is because the query result tries to outline the polygon using a circle symbol. Obviously that symbol ought to be defined on the fly, in case it doesn't exist in the symbolset. But for some reason I forgot to implement that for polygon layer results (I did for line and points). Bit stupid. I have fixed this in CVS.
 
I will send you an updated file off-list.
 
regards,
 
Jacob
 
 


From: GISArts [mailto:[hidden email]]
Sent: 2 November 2006 15:48
To: Delfos, Jacob; 'Bart van den Eijnden (OSGIS)'
Cc: [hidden email]
Subject: RE: [Chameleon] LocateByAttribute in Postgis

Hi Bart, Jacob,

Thanks for the tips,

 

The first thing I tried I followed the advise from Bart.

Just noticed something else, you are using a string column as the unique column. I believe Mapserver cannot deal with this.

 

Try USING UNIQUE oid instead

 

I changed the string field column to a unique one. (USING UNIQUE oid) and I got one match returned, so this problem is fixed.

The map doesn’t yet zoom to that location. Some errors about, (Warning: [MapServer Error]: msLoadMap(): Undefined overlay symbol "circle" in class 0, style 0 of layer Queryresult. In) I’ll haven’t got the time to look into that.

 

Fons

 

 

 

 

 

 


 


_______________________________________________
Chameleon mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/chameleon