hi all,

i'm using GeoTools 14.5 libraries to handle WFS 1.0.0 GetFeature calls
like this one...

  <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs";
      service="WFS" version="1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xsi:schemaLocation="http://www.opengis.net/wfs
      http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd";>
    <wfs:Query typeName="feature:l0
        xmlns:feature="http://www.foo.com";>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc";>
        <ogc:BBOX>
          <ogc:PropertyName>G</ogc:PropertyName>
          <gml:Box xmlns:gml="http://www.opengis.net/gml";
              srsName="EPSG:3857">
            <gml:coordinates decimal="." cs="," ts=" ">
              16649754.315649,-4105898.8620857 
              16969872.590061,-3920615.5055481
            </gml:coordinates>
          </gml:Box>
        </ogc:BBOX>
      </ogc:Filter>
    </wfs:Query>
  </wfs:GetFeature>

using code like this...

  import org.geotools.filter.text.ecql.ECQL;
  import org.geotools.wfs.v1_0.WFSConfiguration;
  import org.geotools.xml.Parser;
  import org.opengis.filter.Filter;
  import net.opengis.wfs.GetFeatureType;
  import net.opengis.wfs.QueryType;
  ...
  final Object operation;
  try (Reader reader = new StringReader(xml)) {
     operation = new Parser(new WFSConfiguration()).parse(reader);
  } catch (IOException | SAXException | ParserConfigurationException x)
{ ...
  }

i'm able to cast the 'operation' object to a GetFeatureType instance.
from the GFT i can then access the query as an instance of QueryType
and from that the Filter instance if/when there's one through
getFilter().

marshalling the filter to an ECQL string through...

  String ecql = ECQL.toCQL(filter);

seems to ignore the BBOX's SRS and i end up w/ something like...

  BBOX(G, 1.6649754315649E7, -4105898.8620857, 1.6969872590061E7,
  -3920615.5055481)

Q1/ is there a way of preserving the BBOX's SRS in the resulting ECQL
string?


alternatively preserving the filter as a Filter instance, a naive
way of trying to check if it implements org.opengis.filter.spatial.BBOX
then calling the getSRS() on it looks to be deprecated; i.e.

  @deprecated please use getExpression2(), if it is a literal
  BoundingBox.getCoordinateReferenceSystem()

Q2/ what is the canonical way, given a Filter instance, of finding out
if it's a spatial one w/ coordinates specified in a given SRS; and the
name of that SRS?


TIA + cheers;
rsn


_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to