[Geoserver-users] CQL Filter Syntax

Hello!

I’m having trouble in using CQL filter with my OpenLayers + Geoserver app
and I’m needing some help…

Maybe I’m making something wrong about the syntax, but I couldn’t find any
help searching for it…

My problem is: when I use a filter like: field = ‘this_value’ or also filed = ‘thisvalue’,
it works fine, but when I use field = ‘this value’ It doesn’t work!!

I tried the same syntax within the Geoserver’s preview page (with the same
layer) and I got the same problem…

Am I buiilding my queries wrong or is there some bug about this??

Regards!

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@anonymised.com
rcantonialli@anonymised.com
Skype: rc_antonialli

Rodrigo ha scritto:

Hello!

I'm having trouble in using CQL filter with my OpenLayers + Geoserver app
and I'm needing some help...

Maybe I'm making something wrong about the syntax, but I couldn't find any
help searching for it...

My problem is: when I use a filter like: field = 'this_value' or also filed = 'thisvalue',
it works fine, but when I use field = 'this value' It doesn't work!!

I tried the same syntax within the Geoserver's preview page (with the same
layer) and I got the same problem..

Am I buiilding my queries wrong or is there some bug about this??

My guess is that you're not url-encoding your request parameters,
but I could be wrong.
I've tried a filter like the one you describe in a GeoServer
demo server here:
http://sigma.openplans.org:8080/geoserver/wms?bbox=-129.5640093481012,3.450477151898794,-62.13726165189879,70.8772248481012&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:states&width=600&height=550&srs=EPSG:4326

and set up the CQL filter as:
STATE_NAME = 'South Dakota'

and it did work fine, only South Dakota was rendered.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea,

I have just noticed that the example you gave me really works, what makes me more
confused!! Because I tried this STATE_NAME = ‘South Dakota’ in the geoserver preview
page at my localhost and it worked fine… then I tried again with the FeatureType I’ve created
and it didn’t work!

My FeatureType has a PostGis Store and one of it’s column is lito_evolt…
Some possible values for this column are: Vulcan_Mesoz, Terciario and
Zonas de Cisalhamento…

When I tried a filter like:

lito_evolt = ‘Vulcan_Mesoz’

it works…

Even a:

lito_evolt = ‘Vulcan_Mesoz’ or lito_evolt = ‘Terciario’

it works!

But when I try:

lito_evolt = ‘Zonas de Cisalhamento’

t doesn’t work!!

And so on… If I use any field value which contains a white space, it fails…

Is it possible to be some problem with the character encoding of my postgre/postgis
table??

Cheers,

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@anonymised.com
rcantonialli@anonymised.com
Skype: rc_antonialli

On Mon, Feb 16, 2009 at 11:21, Andrea Aime <aaime@anonymised.com…> wrote:

Rodrigo ha scritto:

Hello!

I’m having trouble in using CQL filter with my OpenLayers + Geoserver app
and I’m needing some help…

Maybe I’m making something wrong about the syntax, but I couldn’t find any
help searching for it…

My problem is: when I use a filter like: field = ‘this_value’ or also filed = ‘thisvalue’,
it works fine, but when I use field = ‘this value’ It doesn’t work!!

I tried the same syntax within the Geoserver’s preview page (with the same
layer) and I got the same problem…

Am I buiilding my queries wrong or is there some bug about this??

My guess is that you’re not url-encoding your request parameters,
but I could be wrong.
I’ve tried a filter like the one you describe in a GeoServer
demo server here:
http://sigma.openplans.org:8080/geoserver/wms?bbox=-129.5640093481012,3.450477151898794,-62.13726165189879,70.8772248481012&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:states&width=600&height=550&srs=EPSG:4326

and set up the CQL filter as:
STATE_NAME = ‘South Dakota’

and it did work fine, only South Dakota was rendered.

Cheers
Andrea


Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi Rodrigo,
It is probably a problem of url-encoding

You use:
lito_evolt=‘Zonas de Cisalhamento’

But try using:
lito_evolt%3D%27Zonas%20de%20Cisalhamento%27

Check this for explanation:
http://netzreport.googlepages.com/online_tool_for_url_en_decoding.html

Hope this help

my rgds

Milan

Ing. Milan Antonovic
Institute of Earth Sciences
University of Applied Sciences of the South Switzerland - SUPSI
Trevano, C.P. 72, CH-6952 Canobbio, SWITZERLAND
Tel: +41(0)58 666 62 13
E-mail: milan.antonovic@anonymised.com
Skype: milan_antonovic
Web: http://www.ist.supsi.ch

Hi Milan,

I tried the example you gave, but it didn’t work too…

I’m trying to fix all the character encoding… Geoserver uses UTF-8 and the
Postgis database uses LATIN1 (ISO-8859-1)…

My regards,

Rodrigo

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@anonymised.com
rcantonialli@anonymised.com
Skype: rc_antonialli

On Mon, Feb 16, 2009 at 14:28, Milan Antonovic <milan.antonovic@anonymised.com> wrote:

Hi Rodrigo,
It is probably a problem of url-encoding

You use:

lito_evolt=‘Zonas de Cisalhamento’

But try using:
lito_evolt%3D%27Zonas%20de%20Cisalhamento%27

Check this for explanation:
http://netzreport.googlepages.com/online_tool_for_url_en_decoding.html

Hope this help

my rgds

Milan

Ing. Milan Antonovic
Institute of Earth Sciences
University of Applied Sciences of the South Switzerland - SUPSI
Trevano, C.P. 72, CH-6952 Canobbio, SWITZERLAND
Tel: +41(0)58 666 62 13
E-mail: milan.antonovic@anonymised.com
Skype: milan_antonovic
Web: http://www.ist.supsi.ch

Hello Everyone!!

We have made some advance here…

A value called: “Depósitos do Quaternário” didn’t work because
the characters: ó and á… we changed these in the table and then
it worked fine… so, I believe that CQL doesn’t recognize accented
characters like á, é, ó… (that we have in Portuguese and I believe
that English doesn’t have)… Is this right??

Thanks the helps!!!

Regards,

Rodrigo

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@anonymised.com
rcantonialli@anonymised.com
Skype: rc_antonialli

On Mon, Feb 16, 2009 at 14:59, Rodrigo <rca.cirdan@anonymised.com4…> wrote:

Hi Milan,

I tried the example you gave, but it didn’t work too…

I’m trying to fix all the character encoding… Geoserver uses UTF-8 and the
Postgis database uses LATIN1 (ISO-8859-1)…

My regards,

Rodrigo

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@…84…
rcantonialli@anonymised.com
Skype: rc_antonialli

On Mon, Feb 16, 2009 at 14:28, Milan Antonovic <milan.antonovic@anonymised.com> wrote:

Hi Rodrigo,
It is probably a problem of url-encoding

You use:

lito_evolt=‘Zonas de Cisalhamento’

But try using:
lito_evolt%3D%27Zonas%20de%20Cisalhamento%27

Check this for explanation:
http://netzreport.googlepages.com/online_tool_for_url_en_decoding.html

Hope this help

my rgds

Milan

Ing. Milan Antonovic
Institute of Earth Sciences
University of Applied Sciences of the South Switzerland - SUPSI
Trevano, C.P. 72, CH-6952 Canobbio, SWITZERLAND
Tel: +41(0)58 666 62 13
E-mail: milan.antonovic@anonymised.com
Skype: milan_antonovic
Web: http://www.ist.supsi.ch

Rodrigo ha scritto:

Hello Everyone!!

We have made some advance here...

A value called: "Depósitos do Quaternário" didn't work because
the characters: ó and á... we changed these in the table and then
it worked fine... so, I believe that CQL doesn't recognize accented
characters like á, é, ó... (that we have in Portuguese and I believe
that English doesn't have)... Is this right??

Actually the CQL module was created by a spanish developer, but
I'll have a look, I have some tables around with various kinds
of accents.
Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Thank you very much Andrea =)

For now we decided to remove all accents of our table
then we don

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@anonymised.com
rcantonialli@anonymised.com
Skype: rc_antonialli

On Mon, Feb 16, 2009 at 17:23, Andrea Aime <aaime@anonymised.com…> wrote:

Rodrigo ha scritto:

Hello Everyone!!

We have made some advance here…

A value called: “Depósitos do Quaternário” didn’t work because
the characters: ó and á… we changed these in the table and then
it worked fine… so, I believe that CQL doesn’t recognize accented
characters like á, é, ó… (that we have in Portuguese and I believe
that English doesn’t have)… Is this right??

Actually the CQL module was created by a spanish developer, but
I’ll have a look, I have some tables around with various kinds
of accents.

Cheers
Andrea


Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

don`t have problems if cql and other things we are working here

Sorry… wrong key typed so mail was sent =P

Regards,

Rodrigo

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@anonymised.com
rcantonialli@anonymised.com
Skype: rc_antonialli

On Mon, Feb 16, 2009 at 18:47, Rodrigo <rca.cirdan@anonymised.com4…> wrote:

Thank you very much Andrea =)

For now we decided to remove all accents of our table
then we don

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@…84…
rcantonialli@anonymised.com
Skype: rc_antonialli

On Mon, Feb 16, 2009 at 17:23, Andrea Aime <aaime@anonymised.com> wrote:

Rodrigo ha scritto:

Hello Everyone!!

We have made some advance here…

A value called: “Depósitos do Quaternário” didn’t work because
the characters: ó and á… we changed these in the table and then
it worked fine… so, I believe that CQL doesn’t recognize accented
characters like á, é, ó… (that we have in Portuguese and I believe
that English doesn’t have)… Is this right??

Actually the CQL module was created by a spanish developer, but
I’ll have a look, I have some tables around with various kinds
of accents.

Cheers
Andrea


Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime ha scritto:

Rodrigo ha scritto:

Hello Everyone!!

We have made some advance here...

A value called: "Depósitos do Quaternário" didn't work because
the characters: ó and á... we changed these in the table and then
it worked fine... so, I believe that CQL doesn't recognize accented
characters like á, é, ó... (that we have in Portuguese and I believe
that English doesn't have)... Is this right??

Actually the CQL module was created by a spanish developer, but
I'll have a look, I have some tables around with various kinds
of accents.

So I tried with a shapefile that I have around with lots of
Finnish words that do have various kinds of accents over the
character.
The shapefile worked fine the first time I tried. Then I
imported it into postgis, and found shp2pgsql did not work.
The thing is, the dbf was encoded in ISO-8859-15 and the database
was UTF-8, and the result was that accented chars were not
accepted by PostgreSQL on input.
All I had to do was to add a charset parameter to my import
statement:

shp2pgsql -s 2391 -I -W ISO-8859-15 finnish.shp finnish | psql finnishdb

After that the import went fine, and my sql queries from the
map preview worked just fine as well. Stuff like:
address = 'PÅLSBÖLEVÄGEN 247'
returned the expected records (note the three decorations
over the A and O and the space in the middle).

So I don't know, maybe you have some charset issue in the
setup of your database?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

I once had problems with Finnish words when using CQL. Are you running your Geoserver under Tomcat?

  • mika -

BTW: that Finnish word Pålsbölevägen is a Swedish one. We have Swedish as our second official langauge. But never mind :wink:

Andrea Aime kirjoitti:

Lehtonen, Mika ha scritto:

I once had problems with Finnish words when using CQL. Are you running your Geoserver under Tomcat?

I was running it under Jetty, but it should not make a difference.

- mika -

BTW: that Finnish word Pålsbölevägen is a Swedish one. We have Swedish as our second official langauge. But never mind :wink:

Deh, sorry, I'm northern Europe language ignorant :slight_smile:

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

It may do. Check this thread.

http://www.nabble.com/charset-encoding-issue-td21015285.html

- mika -

Andrea Aime kirjoitti:

Lehtonen, Mika ha scritto:

I once had problems with Finnish words when using CQL. Are you running your Geoserver under Tomcat?

I was running it under Jetty, but it should not make a difference.

- mika -

BTW: that Finnish word Pålsbölevägen is a Swedish one. We have Swedish as our second official langauge. But never mind :wink:

Deh, sorry, I'm northern Europe language ignorant :slight_smile:

Cheers
Andrea

Andrea, Mika,

My table is using the LATIN1 char set, which means it’s set to use ISO-8859-1,
at least it’s what I’ve read at postgre docs…

I also tried to change the char set of Geoserver to ISO-08859-1 and even LATIN1,
but it didn’t work…

But, when I did the conversion of shp files, I’m not sure I’ve used the -W param…
I’ll check this out and take a look at tomcat char set too!

If I have some advance here, I’ll tell you =)

Thank you for your help!

Regards,

======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 9757-0370
rca.cirdan@anonymised.com
rcantonialli@anonymised.com
Skype: rc_antonialli

On Tue, Feb 17, 2009 at 07:57, Lehtonen, Mika <mika@anonymised.com…> wrote:

It may do. Check this thread.

http://www.nabble.com/charset-encoding-issue-td21015285.html

  • mika -

Andrea Aime kirjoitti:

Lehtonen, Mika ha scritto:

I once had problems with Finnish words when using CQL. Are you running your Geoserver under Tomcat?

I was running it under Jetty, but it should not make a difference.

  • mika -

BTW: that Finnish word Pålsbölevägen is a Swedish one. We have Swedish as our second official langauge. But never mind :wink:

Deh, sorry, I’m northern Europe language ignorant :slight_smile:

Cheers
Andrea