Hello list

This is the first time I write here, so hello everybody :) 
I have recently started to work in a project using uDig, which works with 
geotools.

The other day I was having an issue with a filter udig was sending to a wfs 
layer. The filter is a fid filter, but geotoool's streaming renderer is adding 
a bbox filter to it, and mapserver is not understanding it probably due to an 
encoding issue. 

This is the filter sent by udig to mapserver (failing it due to the filter tag 
contained in the main filter tag):

http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter=
<Filter>
  <And>
    <Filter>
      <FeatureId fid="PositionReal.3"/>
    </Filter>
    <BBOX>
      <PropertyName>point</PropertyName>
      <Box>
        <coordinates decimal="." cs="," ts=" 
">-100.82219958499486,-57.14285725714286 
100.82219958499486,57.14285725714286</coordinates>
      </Box>
    </BBOX>
  </And>
</Filter>

And this is what mapserver understands:

http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter=
<Filter>
  <And>
    <FeatureId fid="PositionReal.3"/>
    <BBOX>
      <PropertyName>point</PropertyName>
      <Box>
        <coordinates decimal="." cs="," ts=" 
">-100.82219958499486,-57.14285725714286 
100.82219958499486,57.14285725714286</coordinates>
      </Box>
    </BBOX>
  </And>
</Filter>

Joddy Garnett helped me in the udig-devel list and he suggested that it could 
be an encoding issue, and maybe using the FilterEncodingPreProcessor we could 
fix it.

I have tried to understand the FilterEncodingPreProcessor, but I am having some 
dificulties. I have created a filter composed by a fid filter and a comparation 
filter. My goal is to have them encoded on the same xml filter, but no luck. I 
have tried the 3 compliance levels, hoping that after accepting each visitor 
(one for each level) in the filter, I would be able to invoke visitor.getFilter 
and obtain the new filter, hopefully one of them encoded as I want. So I 
printed the xml code of the getFilter() filter of each visitor, but I guess I 
didnt unerstand this correctly, right? 

CODE:

                org.geotools.xml.Configuration conf2 = new 
org.geotools.filter.v1_1.OGCConfiguration();

                FilterFactory2 factory = 
CommonFactoryFinder.getFilterFactory2(null);
                String fid1 = "FID.1";
                Filter fidFilter= createFidFilter("FID.1");
                Filter normalFilter = CQL.toFilter("id = 1");
                Filter filter = factory.and( fidFilter, normalFilter);

                FilterEncodingPreProcessor visitor1 = new 
FilterEncodingPreProcessor(XMLHandlerHints.VALUE_FILTER_COMPLIANCE_LOW);
                FilterEncodingPreProcessor visitor2 = new 
FilterEncodingPreProcessor(XMLHandlerHints.VALUE_FILTER_COMPLIANCE_MEDIUM);
                FilterEncodingPreProcessor visitor3 = new 
FilterEncodingPreProcessor(XMLHandlerHints.VALUE_FILTER_COMPLIANCE_HIGH);
               
                System.out.println("LOW");
                Filters.accept(filter, visitor1);
                org.geotools.xml.Encoder encoder = new 
org.geotools.xml.Encoder(conf2);
                encoder.setIndenting(true);
                encoder.setIndentSize(2);
                encoder.encode(visitor1.getFilter(), 
org.geotools.filter.v1_1.OGC.Filter, System.out );
                encoder = new org.geotools.xml.Encoder(conf2);
                encoder.setIndenting(true);
                encoder.setIndentSize(2);
                encoder.encode( visitor1.getFidFilter(), 
org.geotools.filter.v1_1.OGC.Filter, System.out );
               
                System.out.println("MEDIUM");
                Filters.accept(filter, visitor2);
                encoder = new org.geotools.xml.Encoder(conf2);
                encoder.setIndenting(true);
                encoder.setIndentSize(2);
                encoder.encode( visitor2.getFilter(), 
org.geotools.filter.v1_1.OGC.Filter, System.out );
                encoder = new org.geotools.xml.Encoder(conf2);
                encoder.setIndenting(true);
                encoder.setIndentSize(2);
                encoder.encode( visitor2.getFidFilter(), 
org.geotools.filter.v1_1.OGC.Filter, System.out );
               
                System.out.println("HIGH");
                Filters.accept(filter, visitor3);
                encoder = new org.geotools.xml.Encoder(conf2);
                encoder.setIndenting(true);
                encoder.setIndentSize(2);
                encoder.encode( visitor3.getFilter(), 
org.geotools.filter.v1_0.OGC.Filter, System.out );
                encoder = new org.geotools.xml.Encoder(conf2);
                encoder.setIndenting(true);
                encoder.setIndentSize(2);
                encoder.encode( visitor3.getFidFilter(), 
org.geotools.filter.v1_1.OGC.Filter, System.out );

OUTPUT:


LOW
<?xml version="1.0" encoding="UTF-8"?>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"; 
xmlns:gml="http://www.opengis.net/gml";>
  <ogc:And>
    <ogc:PropertyIsEqualTo matchCase="true">
      <ogc:PropertyName>id</ogc:PropertyName>
      <ogc:Literal>1</ogc:Literal>
    </ogc:PropertyIsEqualTo>
  </ogc:And>
</ogc:Filter>
<?xml version="1.0" encoding="UTF-8"?>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"; 
xmlns:gml="http://www.opengis.net/gml"/>
MEDIUM
<?xml version="1.0" encoding="UTF-8"?>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"; 
xmlns:gml="http://www.opengis.net/gml"/>
<?xml version="1.0" encoding="UTF-8"?>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"; 
xmlns:gml="http://www.opengis.net/gml";>
  <ogc:FeatureId fid="FID.1"/>
</ogc:Filter>
HIGH
<?xml version="1.0" encoding="UTF-8"?>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"; 
xmlns:gml="http://www.opengis.net/gml"/>
<?xml version="1.0" encoding="UTF-8"?>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"; 
xmlns:gml="http://www.opengis.net/gml";>
  <ogc:FeatureId fid="FID.1"/>
</ogc:Filter>

are we on the right track? any close to the solution? 

Thank you!

Joaquín
______________________
This message including any attachments may contain confidential 
information, according to our Information Security Management System,
 and intended solely for a specific individual to whom they are addressed.
 Any unauthorised copy, disclosure or distribution of this message
 is strictly forbidden. If you have received this transmission in error,
 please notify the sender immediately and delete it.

______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
 puede contener informacion clasificada por su emisor como confidencial
 en el marco de su Sistema de Gestion de Seguridad de la 
Informacion siendo para uso exclusivo del destinatario, quedando 
prohibida su divulgacion copia o distribucion a terceros sin la 
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje 
 erroneamente, se ruega lo notifique al remitente y proceda a su borrado. 
Gracias por su colaboracion.

______________________


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to