[ka-Map-users] query in ka-map with mapserver
王连波
happyforev1 at gmail.com
Fri Dec 25 18:29:06 EST 2009
Hi all,
I added TEMPLATE to my mapfile and changed the codes in the
tools/search/kaSearch.php file to the following: if($oLayer->connectiontype
== MS_POSTGIS){
$searchstring = "($szSearchfield ilike '%$psearch%')";
} else {
$searchstring = "\"".$szSearchfield."~*
'".$psearch."'\"";
}
And now I am so happy to tell you that it is ok to search with ka-map from
Postgis although it still does not work with shapefile data source. Even so,
when I search with ka-map the database system gives the following error:
ERROR: type "ilike" does not exist at character 225
STATEMENT: select
encode(AsBinary(force_collection(force_2d("the_geom")),'NDR'),'base64') as
geom,"gid" from xzqj_s where the_geom && GeomFromText('POLYGON((120 39,120
43,124 43,124 39,120 39))',find_srid('','xzqj_s','the_geom')) and ilike
'%jinzhou%'
if I take the integer field as the search string, then there is another
error:
ERROR: operator does not exist: integer ~~* unknown at character 230
HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.
STATEMENT: select
"gid",encode(AsBinary(force_collection(force_2d("the_geom")),'NDR'),'base64')
as geom,"gid" from hl_l where the_geom && GeomFromText('POLYGON((120 39,120
43,124 43,124 39,120 39))',find_srid('','hl_l','the_geom')) and gid ilike
'%23%'
Maybe the database server takes the number I input as a string, I will study
on it. BTW, the searching results can not output Chinese, because the
database in postgis is encoded in EDU_CN while my FreeBSD operating system'
locale is UTF-8. I tried HEADER encoding in the PHP file. and ICONV(
"EUC_CN","UTF-8",$ResultString), neigther of them is useful, anybody know a
simple way to resolve this problem, thank you in advance.
2009/12/24 王连波 <happyforev1 at gmail.com>
> Thank you, Hajime.
> I have just tried what you indicated me. But, nothing is changed and I
> still can not get "no matching results". Some other suggestion, please?
>
>
> On Thu, Dec 24, 2009 at 6:24 PM, Hajime TANAKA <hajime.tanaka at tufts.edu>wrote:
>
>> Please give a try of setting
>>
>> CLASSITEM
>> and
>> EXPRESSION in the CLASS
>>
>> 2009/12/24 王连波 <happyforev1 at gmail.com>:
>> > Hi all,
>> > I am really anxious about ka-map query and search now. In my mapfile I
>> > configured a layer as follows and it displayed a city's boundary
>> constituted
>> > of 68 lines. Then I think it is valid to select some of the lines and
>> get
>> > their id from the table where the_geo DATA is stored in my database.
>> > However, when I finished the query just get "no matching results". I
>> have
>> > read the script file "map_query_float.php" and found nothing special.
>> Should
>> > I configure the mapfile to tell ka-map which table in postgis is going
>> to be
>> > looked for? If so, how? If not, why I can not get what I want ? Thank
>> you
>> > for any clues.
>> >
>> > a querable layer of my mapfile
>> > LAYER
>> > METADATA
>> > 'queryable' 'true'
>> > fields "bound_id:BID"
>> > hyperlink "cat|myurl"
>> > "searchfield" "gid"
>> > END
>> > NAME xzqj_x
>> > group "xzqj"
>> > STATUS ON
>> > TYPE line #if POINT is used,every polygon is white
>> and
>> > label is ineffective
>> > CONNECTIONTYPE POSTGIS
>> > CONNECTION "dbname=*** host=*** user=*** password=*** port=***"
>> > DATA "the_geom from xzqj_x"
>> > # labelitem cname
>> > CLASS
>> > NAME xzqj_x
>> > STYLE
>> > symbol dashed1
>> > size 3
>> > color 100 100 100
>> > END
>> > END
>> > END
>> >
>> >
>> >
>>
>>
>>
>> --
>> Hajime Tanaka
>> _______________________________________________
>> ka-Map-users mailing list
>> ka-Map-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/ka-map-users
>>
>
>
>
> --
> 天道酬勤
>
--
天道酬勤
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20091226/fcc886bf/attachment.htm
More information about the ka-Map-users
mailing list