[Geoserver-users] SLD PropertyIsEqualTo

Hallo Liste,

Ich hab ein Problem mit der Filterung meiner Daten.

Ich möchte aus einer Postgres/Postgis Datenbank meine Geometrien anhand eines Schlüssels in der Spalte strasse filtern. Ich habe mir folgenden Filter erstellt:

ogc:Filter
ogc:PropertyIsEqualTo
ogc:PropertyNamestrasse</ogc:PropertyName>
ogc:Literal00669</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

Das Problem ist nun das der Schlüssel für die Straße als 5-stelliger String in der Datenbank abgelegt ist. Die meisten dieser Schlüssel beginnen mit einer 0 (Null) und genau hier liegt mein Problem. Wenn ich den Filter nun so anwende, findet er keine Datensätze. Ich habe mal ein paar Datensätze geändert und aus der ersten 0 ein A gemacht und schon funktioniert der Filter so wie er soll. Ich kann leider die Schlüssel nicht verändern und bin daher auf der suche nach einer Lösung, um diese Daten doch noch gefiltern zu bekommen.

Für Hilfe und Anregungen wäre ich sehr dankbar.

Gruß Thomas

Janßen, Thomas ha scritto:

Hallo Liste,

Ich hab ein Problem mit der Filterung meiner Daten.

Hi,
this is an english only mailing list... happily the internet
provides some automated translation tools that seem
to work fine for your mail, here is the translation offered
by BabelFish:

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

Hello list, I have a problem with the filtering of my data. I would like to filter my geometry from a Postgres/Postgis data base on the basis a key in the column road. I provided myself the following filter:

  <ogc:Filter>
  <ogc:PropertyIsEqualTo>
  <ogc:PropertyName>strasse</ogc:PropertyName>
  <ogc:Literal>00669</ogc:Literal>
  </ogc:PropertyIsEqualTo>
  </ogc:Filter>

The problem is now that the key for the road as stringer with 5 digits is put down in the data base. Most this key begin with 0 (zero) and lie exactly here my problem. If I use the filter in such a way now, he does not find data records. I changed times a few data records and from the first 0 a A made and already function the filter as he am. I can unfortunately not change the keys and am from there on look for a solution, in order to nevertheless still get these data gefiltern. For assistance and suggestions I would be very grateful. Greeting Thomas

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

I see, this is a known problem in older GeoServer versions, but
it should have been fixed in more recent ones. Have you tried
out a late 1.6.x (e.g., 1.6.5) or 1.7.0-RC4?

Cheers
Andrea

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

Hi,

I know very little about SLD, but I wonder if it has something in common with WFS filters? If it does, then isn't PropertyIsLike filter more suitable for string comparisons?

-Jukka Rahkonen-

-----Alkuperäinen viesti-----
Lähettäjä: Andrea Aime [mailto:aaime@anonymised.com]
Lähetetty: ma 13.10.2008 16:15
Vastaanottaja: "Janßen, Thomas"
Kopio: geoserver-users@lists.sourceforge.net
Aihe: Re: [Geoserver-users] SLD PropertyIsEqualTo

Janßen, Thomas ha scritto:

Hallo Liste,

Ich hab ein Problem mit der Filterung meiner Daten.

Hi,
this is an english only mailing list... happily the internet
provides some automated translation tools that seem
to work fine for your mail, here is the translation offered
by BabelFish:

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

Hello list, I have a problem with the filtering of my data. I would like
to filter my geometry from a Postgres/Postgis data base on the basis a
key in the column road. I provided myself the following filter:

  <ogc:Filter>
  <ogc:PropertyIsEqualTo>
  <ogc:PropertyName>strasse</ogc:PropertyName>
  <ogc:Literal>00669</ogc:Literal>
  </ogc:PropertyIsEqualTo>
  </ogc:Filter>

The problem is now that the key for the road as stringer with 5 digits
is put down in the data base. Most this key begin with 0 (zero) and lie
exactly here my problem. If I use the filter in such a way now, he does
not find data records. I changed times a few data records and from the
first 0 a A made and already function the filter as he am. I can
unfortunately not change the keys and am from there on look for a
solution, in order to nevertheless still get these data gefiltern. For
assistance and suggestions I would be very grateful. Greeting Thomas

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

I see, this is a known problem in older GeoServer versions, but
it should have been fixed in more recent ones. Have you tried
out a late 1.6.x (e.g., 1.6.5) or 1.7.0-RC4?

Cheers
Andrea

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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Rahkonen Jukka ha scritto:

Hi,

I know very little about SLD, but I wonder if it has something in
common with WFS filters? If it does, then isn't PropertyIsLike filter
more suitable for string comparisons?

It may be, but the filter as written by Thomas is correct.
In the old GeoServer there was no indication, context, for the
sql encoding, and this resulted into troubles.
Basically, given att = 00123 the encoder would say, ok, I have
the '00123' coming from the xml, but what exactly is this?
Let's try to convert to a date... fails, so no, not a date.
Ok, let's try with a number then... oh, yeah, this really
looks like a number, then the sql will be 'att = 123'.

Nowadays we try to leverage the comparison context, so the
encoder knows that 00123 is compared with a string attribute
and tries to encode it as a string... at least that's the theory,
if Thomas is reproducing this issue on a recent GeoServer
then the bug has raised his head again in some way.

Cheers
Andrea

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

Andrea Aime wrote:

Rahkonen Jukka ha scritto:

Hi,

I know very little about SLD, but I wonder if it has something in
common with WFS filters? If it does, then isn't PropertyIsLike filter
more suitable for string comparisons?

It may be, but the filter as written by Thomas is correct.
In the old GeoServer there was no indication, context, for the
sql encoding, and this resulted into troubles.
Basically, given att = 00123 the encoder would say, ok, I have
the '00123' coming from the xml, but what exactly is this?
Let's try to convert to a date... fails, so no, not a date.
Ok, let's try with a number then... oh, yeah, this really
looks like a number, then the sql will be 'att = 123'.

Nowadays we try to leverage the comparison context, so the
encoder knows that 00123 is compared with a string attribute
and tries to encode it as a string... at least that's the theory,
if Thomas is reproducing this issue on a recent GeoServer
then the bug has raised his head again in some way.

I know this for sure :slight_smile: We have leading zeros in all our major query attributes, and with old Geoserver 1.5.0 production system we had to create a separate query column into all our database tables so that they had a letter on the first place. With 1.6 and now 1.7 series leading zeros have not been any problem. I know that with Oracle backend using PropertyIsLike is leading to query "where id='000111222'" which is correct. I am not sure if using PropertyIsEqualTo is giving "where id=000111222" which will work but is slow, or to correct one with quetes. Geoserver 1.5.0 was sending "where id=111222" and that failed totally, naturally.

-Jukka-

-Jukka-