[Geoserver-users] SLD Filter problem

Hi,

I am trying to apply an SLD filter to a feature based on a specific field. The field in question, 'rte', contains values such as 001, 002, 010, 100, etc. and is defined in the database (Postgres/PostGIS) as a varchar. My SLD filter does not seem to work for any record that has a leading zero in the 'rte' field. Is there something wrong with my syntax? Here are a couple of examples.

This does not work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>004</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

But this does work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>110</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

My Geoserver version is 1.6.0 b1.

Regards,
Nathan

Nathan Banks
Portland, Oregon

Hi Nathan,

Your syntax looks fine. I have a sneaking suspicion that those values
are getting converted to integers somewhere in the process... which is
killing the leading zero's and throwing off the comparison.

I will try it out later today. Can you file an issue in the bug tracker
so I dont forget :).

Thanks,

-Justin

Banks, Nathan wrote:

Hi,

I am trying to apply an SLD filter to a feature based on a specific field. The field in question, 'rte', contains values such as 001, 002, 010, 100, etc. and is defined in the database (Postgres/PostGIS) as a varchar. My SLD filter does not seem to work for any record that has a leading zero in the 'rte' field. Is there something wrong with my syntax? Here are a couple of examples.

This does not work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>004</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

But this does work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>110</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

My Geoserver version is 1.6.0 b1.

Regards,
Nathan

Nathan Banks
Portland, Oregon

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,46eac6b0213455409313003!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Banks, Nathan ha scritto:

Hi,

I am trying to apply an SLD filter to a feature based on a specific field. The field in question, 'rte', contains values such as 001, 002, 010, 100, etc. and is defined in the database (Postgres/PostGIS) as a varchar. My SLD filter does not seem to work for any record that has a leading zero in the 'rte' field. Is there something wrong with my syntax? Here are a couple of examples.

This does not work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>004</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

But this does work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>110</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

My Geoserver version is 1.6.0 b1.

Hmm, beta1? Quite a bit old. Can you try a nightly from here, it's
pretty close to beta3 anyways:
http://geo.openplans.org/nightly/trunk/

Cheers
Andrea

Saul has already fixed it, it's in the nightly build he says....

Banks, Nathan wrote:

Hi,

I am trying to apply an SLD filter to a feature based on a specific field.
The field in question, 'rte', contains values such as 001, 002, 010, 100,
etc. and is defined in the database (Postgres/PostGIS) as a varchar. My
SLD filter does not seem to work for any record that has a leading zero in
the 'rte' field. Is there something wrong with my syntax? Here are a
couple of examples.

This does not work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>004</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

But this does work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>110</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

My Geoserver version is 1.6.0 b1.

Regards,
Nathan

Nathan Banks
Portland, Oregon

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
View this message in context: http://www.nabble.com/SLD-Filter-problem-tf4444199.html#a12680586
Sent from the GeoServer - User mailing list archive at Nabble.com.

I'm using GS 1.4 and had the same problem. From what I understand (I'm a
'user', not a developer) when the literal looks at the lieteral and
determines on it's own if it is char or numeric, without looking at the
datatype in the db. I was told this would be fixed for 1.6....they may just
not have gotten to it yet.

My workaround was to make a new column with a leading 'z' so it wouldn't be
fooled.

Steve

Stephen Crawford
Center for Environmental Informatics
The Pennsylvania State University

-----Original Message-----
From: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net] On Behalf Of Banks,
Nathan
Sent: Friday, September 14, 2007 1:34 PM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] SLD Filter problem

Hi,

I am trying to apply an SLD filter to a feature based on a specific field.
The field in question, 'rte', contains values such as 001, 002, 010, 100,
etc. and is defined in the database (Postgres/PostGIS) as a varchar. My SLD
filter does not seem to work for any record that has a leading zero in the
'rte' field. Is there something wrong with my syntax? Here are a couple of
examples.

This does not work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>004</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

But this does work:
<ogc:Filter>
<ogc:PropertyIsEqualTo>
  <ogc:PropertyName>rte</ogc:PropertyName>
  <ogc:Literal>110</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

My Geoserver version is 1.6.0 b1.

Regards,
Nathan

Nathan Banks
Portland, Oregon

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users