[Geoserver-devel] Possible bug under GeoServer SLD rendering process with Oracle Spatial.

Hi there:

I detect a possible bug under GeoServer SLD rendering process with Oracle Spatial.

Primary i applyed a classification over a string field in a shapefile.
It was fine and without any problem.

This fiel has values like ‘A’.‘AF’,‘0’,‘EN’…

<?xml version="1.0" encoding="ISO-8859-1"?>

<sld:StyledLayerDescriptor version=“1.0.0”
xsi:schemaLocation=“http://www.opengis.net/sld StyledLayerDescriptor.xsd”
xmlns=“http://www.opengis.net/sld
xmlns:sld=“http://www.opengis.net/sld
xmlns:ogc=“http://www.opengis.net/ogc
xmlns:xlink=“http://www.w3.org/1999/xlink
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”>
sld:NamedLayer
sld:NameMyShape</sld:Name>
sld:UserStyle
sld:NameStyle1</sld:Name>
sld:FeatureTypeStyle
sld:Rule
sld:NameNot assigned</sld:Name>
sld:TitleNot assigned</sld:Title>
ogc:Filter
ogc:PropertyIsEqualTo
ogc:PropertyNameX_TIPLAMP</ogc:PropertyName>
ogc:Literal0</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
sld:PointSymbolizer
sld:Graphic
sld:Mark
sld:WellKnownNamecircle</sld:WellKnownName>
sld:Stroke
<sld:CssParameter name=“stroke”>#000000</sld:CssParameter>
<sld:CssParameter name=“stroke-width”>1</sld:CssParameter>
<sld:CssParameter name=“stroke-opacity”>1.0</sld:CssParameter>
</sld:Stroke>
</sld:Mark>
sld:Size18</sld:Size>
sld:Rotation0</sld:Rotation>
</sld:Graphic>
</sld:PointSymbolizer>
sld:PointSymbolizer
sld:Graphic
sld:Mark
sld:WellKnownNamecircle</sld:WellKnownName>
sld:Fill
<sld:CssParameter name=“fill”>#000000</sld:CssParameter>
<sld:CssParameter name=“fill-opacity”>1.0</sld:CssParameter>
</sld:Fill>
</sld:Mark>

When i take the same sld and i adapt it to a similar structure in an Oracle Spatial Database, over a similar VARCHAR field and same values, i get the next error at tomcat console:


GetMap Request
version: 1.1.1
output format: image/png
width height: 457,800
bbox: Env[206775.511094 : 280287.579321, 4118932.435112 : 4160926.204087]
layers: topp:X_PUNTOLUZ
styles: INVIEM_CLASIF_ORA_PUNTOLUZ_TIPLAMP
27588110 [GRAVE] org.geotools.data.jdbc.JDBC1DataStore - Error Performing SQL qu
ery: SELECT “X_RID”, “X_TIPLAMPARA”, “GEOMETRY1” FROM “X_PUNTOLUZ” WHERE (SDO_RE
LATE(“GEOMETRY1”,MDSYS.SDO_GEOMETRY(2003,23030,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,
1003,3),MDSYS.SDO_ORDINATE_ARRAY(205121.4895588925,4117278.4135768795,281941.600
85610754,4162580.2256221203)),‘mask=anyinteract querytype=WINDOW’) = ‘TRUE’ AND
(((((((((((“X_TIPLAMPARA” = 0 OR “X_TIPLAMPARA” = ‘F’) OR “X_TIPLAMPARA” = ‘FC’
) OR “X_TIPLAMPARA” = ‘H’) OR “X_TIPLAMPARA” = ‘HM’) OR “X_TIPLAMPARA” = ‘I’) OR
“X_TIPLAMPARA” = ‘IND’) OR “X_TIPLAMPARA” = ‘LM’) OR “X_TIPLAMPARA” = ‘SM’) OR
“X_TIPLAMPARA” = ‘VM’) OR “X_TIPLAMPARA” = ‘VSAP’) OR “X_TIPLAMPARA” = ‘VSBP’))
java.sql.SQLException: ORA-01722: n·mero no vßlido
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStateme
nt.java:1060)
at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.jav
a:830)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1132)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
1272)
at org.geotools.data.jdbc.JDBC1DataStore.executeQuery(JDBC1DataStore.jav
a:926)
at org.geotools.data.jdbc.JDBC1DataStore.getFeatureReader(JDBC1DataStore
.java:669)
at org.geotools.data.jdbc.JDBCFeatureCollection.reader(JDBCFeatureCollec
tion.java:78)


it’s sounds like that if there’s a numeric value in a VARCHAR field, then the sql string is not correct.

see
… X_TIPLAMPARA" = 0 OR “X_TIPLAMPARA” = ‘F’ … in the sample

it should be like

X_TIPLAMPARA" = “0” OR “X_TIPLAMPARA” = ‘F’

In my sld at the moment i’ve changed

ogc:PropertyIsEqualTo
ogc:PropertyNameX_TIPLAMP</ogc:PropertyName>
ogc:Literal0</ogc:Literal>
</ogc:PropertyIsEqualTo>

with

ogc:PropertyIsEqualTo
ogc:PropertyNameX_TIPLAMP</ogc:PropertyName>
ogc:Literal’0’</ogc:Literal>
</ogc:PropertyIsEqualTo>

and works fine

Regards

dlr@anonymised.com
Daniel Luna Rodríguez
GuadalTel s.a.
Pastor y Landero 19
Sevilla - Spain


Sé un Mejor Amante del Cine
¿Quieres saber cómo? ¡Deja que otras personas te ayuden! .

Hi Daniel,

Yeah, you have found a bug with how oracle transforms literals into sql,
its not really taking the target type into account. Instead if tries to
convert to an integer first, if that fails it converts to a string.

If you could file this bug in the bug tracker for us that would be great.

-Justin

Daniel Luna wrote:

Hi there:

I detect a possible bug under GeoServer SLD rendering process with
Oracle Spatial.

Primary i applyed a classification over a string field in a shapefile.
It was fine and without any problem.

This fiel has values like 'A'.'AF','0','EN'....

<?xml version="1.0" encoding="ISO-8859-1"?>
<sld:StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld&quot;
xmlns:sld="http://www.opengis.net/sld&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  <sld:NamedLayer>
    <sld:Name>MyShape</sld:Name>
    <sld:UserStyle>
      <sld:Name>Style1</sld:Name>
      <sld:FeatureTypeStyle>
        <sld:Rule>
          <sld:Name>Not assigned</sld:Name>
          <sld:Title>Not assigned</sld:Title>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>X_TIPLAMP</ogc:PropertyName>
              <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <sld:PointSymbolizer>
            <sld:Graphic>
              <sld:Mark>
                <sld:WellKnownName>circle</sld:WellKnownName>
                <sld:Stroke>
                  <sld:CssParameter name="stroke">#000000</sld:CssParameter>
                  <sld:CssParameter name="stroke-width">1</sld:CssParameter>
                  <sld:CssParameter
name="stroke-opacity">1.0</sld:CssParameter>
                </sld:Stroke>
              </sld:Mark>
              <sld:Size>18</sld:Size>
              <sld:Rotation>0</sld:Rotation>
            </sld:Graphic>
          </sld:PointSymbolizer>
          <sld:PointSymbolizer>
            <sld:Graphic>
              <sld:Mark>
                <sld:WellKnownName>circle</sld:WellKnownName>
                <sld:Fill>
                  <sld:CssParameter name="fill">#000000</sld:CssParameter>
                  <sld:CssParameter
name="fill-opacity">1.0</sld:CssParameter>
                </sld:Fill>
              </sld:Mark>
.....

When i take the same sld and i adapt it to a similar structure in an
Oracle Spatial Database, over a similar VARCHAR field and same values, i
get the next error at tomcat console:

************************************************************

GetMap Request
version: 1.1.1
output format: image/png
width height: 457,800
bbox: Env[206775.511094 : 280287.579321, 4118932.435112 : 4160926.204087]
layers: topp:X_PUNTOLUZ
styles: INVIEM_CLASIF_ORA_PUNTOLUZ_TIPLAMP
27588110 [GRAVE] org.geotools.data.jdbc.JDBC1DataStore - Error
Performing SQL qu
ery: SELECT "X_RID", "X_TIPLAMPARA", "GEOMETRY1" FROM "X_PUNTOLUZ" WHERE
(SDO_RE
LATE("GEOMETRY1",MDSYS.SDO_GEOMETRY(2003,23030,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,
1003,3),MDSYS.SDO_ORDINATE_ARRAY(205121.4895588925,4117278.4135768795,281941.600
85610754,4162580.2256221203)),'mask=anyinteract querytype=WINDOW') =
'TRUE' AND
((((((((((("X_TIPLAMPARA" = 0 OR "X_TIPLAMPARA" = 'F') OR
"X_TIPLAMPARA" = 'FC'
) OR "X_TIPLAMPARA" = 'H') OR "X_TIPLAMPARA" = 'HM') OR "X_TIPLAMPARA" =
'I') OR
"X_TIPLAMPARA" = 'IND') OR "X_TIPLAMPARA" = 'LM') OR "X_TIPLAMPARA" =
'SM') OR
"X_TIPLAMPARA" = 'VM') OR "X_TIPLAMPARA" = 'VSAP') OR "X_TIPLAMPARA" =
'VSBP'))
java.sql.SQLException: ORA-01722: n·mero no vßlido
        at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
        at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
        at
oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
        at
oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStateme
nt.java:1060)
        at
oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.jav
a:830)
        at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1132)
        at
oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
1272)
        at
org.geotools.data.jdbc.JDBC1DataStore.executeQuery(JDBC1DataStore.jav
a:926)
        at
org.geotools.data.jdbc.JDBC1DataStore.getFeatureReader(JDBC1DataStore
.java:669)
        at
org.geotools.data.jdbc.JDBCFeatureCollection.reader(JDBCFeatureCollec
tion.java:78)

************************************************************

it's sounds like that if there's a numeric value in a VARCHAR field,
then the sql string is not correct.

see
.... X_TIPLAMPARA" = 0 OR "X_TIPLAMPARA" = 'F' ... in the sample

it should be like

X_TIPLAMPARA" = "0" OR "X_TIPLAMPARA" = 'F'

In my sld at the moment i've changed

       <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>X_TIPLAMP</ogc:PropertyName>
              <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsEqualTo>

with

            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>X_TIPLAMP</ogc:PropertyName>
              <ogc:Literal>'0'</ogc:Literal>
            </ogc:PropertyIsEqualTo>

and works fine

Regards

dlr@anonymised.com <mailto:dlr@anonymised.com>
Daniel Luna Rodríguez
GuadalTel s.a.
Pastor y Landero 19
Sevilla - Spain

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

Sé un Mejor Amante del Cine
¿Quieres saber cómo? ¡Deja que otras personas te ayuden!
<http://us.rd.yahoo.com/mail/es/tagline/beabetter/*http://advision.webevents.yahoo.com/reto/entretenimiento.html&gt;\.
!DSPAM:4007,46fbda6d215682458217002!

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

-------------------------------------------------------------------------
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/

!DSPAM:4007,46fbda6d215682458217002!

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

_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

!DSPAM:4007,46fbda6d215682458217002!

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