[Geoserver-users] WFS filter query with custom SRS

Hi,

Using GeoServer 1.3.1 war in Tomcat 5.5.12 and PostGIS

I’m having trouble while attempting to Post a GetFeature filter for a WFS datastore with a custom SRS.

I’ve added the new coord system to the epsg.properties file in gt2-epsg.jar:

104308=PROJCS[“NAD83 / UTM zone 11N”,GEOGCS[“NAD83”,DATUM[“North_American_Datum_1983”,SPHEROID[“GRS 1980”,6378137,298.257222101,AUTHORITY[“EPSG”,“7019”]],TOWGS84[0,0,0],AUTHORITY[“EPSG”,“6269”]],PRIMEM[“Greenwich”,0,AUTHORITY[“EPSG”,“8901”]],UNIT[“degree”,0.01745329251994328,AUTHORITY[“EPSG”,“9122”]],AUTHORITY[“EPSG”,“4269”]],PROJECTION[“Transverse_Mercator”],PARAMETER[“latitude_of_origin”,0],PARAMETER[“central_meridian”,-117],PARAMETER[“scale_factor”,0.9996],PARAMETER[“false_easting”,-219278.5],PARAMETER[“false_northing”,-3608990.1],UNIT[“metre”,1,AUTHORITY[“EPSG”,“9001”]],AUTHORITY[“geotechYuma”,“104308”]]

I also added it to my PostGIS spatial_ref_sys table. The custom transform checks out correctly in PostGIS:

select asewkt(the_geom) from grid where the_geom && transform(GeometryFromText(‘LINESTRING(-114.58944702148402 32.764865874385, -113.64826965331999 33.551517485702824)’,4269),104308)

However, when using a WFS Filter query like the following I get an empty set returned?

<?xml version='1.0' encoding='UTF-16' standalone='yes'?>

<wfs:GetFeature service=“WFS” version=“1.0.0”

outputFormat=“GML2”

xmlns:wfs=“http://www.opengis.net/wfs

xmlns:ogc=“http://www.opengis.net/ogc

xmlns:gml=“http://www.opengis.net/gml

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-basic.xsd">

<wfs:Query typeName=“geo:grid”>

ogc:PropertyNamegeo:name</ogc:PropertyName>

ogc:PropertyNamegeo:the_geom</ogc:PropertyName>

ogc:Filter

ogc:BBOX

ogc:PropertyNamethe_geom</ogc:PropertyName>

<gml:Box srsName=“http://www.opengis.net/gml/srs/epsg.xml#4326”>

gml:coordinates-114.58944702148402,32.764865874385 -113.64826965331999,33.551517485702824</gml:coordinates>

</gml:Box>

</ogc:BBOX>

</ogc:Filter>

</wfs:Query>

</wfs:GetFeature>

Here is the log filter:

Request: null

output format:GML2

max features:2147483647

version:

queries:

Query

feature type: geo:grid

filter: [ the_geom bbox POLYGON ((-114.58944702148402 32.764865874385, -114.58944702148402 33.551517485702824, -113.64826965331999 33.551517485702824, -113.64826965331999 32.764865874385, -114.58944702148402 32.764865874385)) ]

[properties: name, the_geom]

I think GeoServer is not detecting the custom SRS in the datastore and transforming the bbox to SRID=104308. Though perhaps I am not understanding the proper syntax for a gml:Box element. Is there a transform that should be applied in the OGC filter Box element?

Or do I have to perform the transform myself outside of the filter?

Curiously I can see the data in a WMS query using this kind of BBOX so WMS must be picking up the transform:

gml:coord

gml:X-114.58944702148402</gml:X>

gml:Y32.764865874385</gml:Y>

</gml:coord>

gml:coord

gml:X-113.64826965331998</gml:X>

gml:Y33.551517485702824</gml:Y>

</gml:coord>

I can also see the data using a WFS filter query like this with the custom SRS coordinates:

<?xml version='1.0' encoding='UTF-16' standalone='yes'?>

<wfs:GetFeature service=“WFS” version=“1.0.0”

outputFormat=“GML2”

xmlns:wfs=“http://www.opengis.net/wfs

xmlns:ogc=“http://www.opengis.net/ogc

xmlns:gml=“http://www.opengis.net/gml

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-basic.xsd">

<wfs:Query typeName=“geo:grid”>

ogc:PropertyNamegeo:name</ogc:PropertyName>

ogc:PropertyNamegeo:the_geom</ogc:PropertyName>

ogc:Filter

ogc:BBOX

ogc:PropertyNamethe_geom</ogc:PropertyName>

<gml:Box srsName=“http://www.opengis.net/gml/srs/epsg.xml#104308”>

gml:coordinates29000,26000 93000,45000</gml:coordinates>

</gml:Box>

</ogc:BBOX>

</ogc:Filter>

</wfs:Query>

</wfs:GetFeature>

Thanks

Randy George

GeoServer WFS does not support reprojection, or using alternate srs's in the filter box. There's a bug fix for this at: http://jira.codehaus.org/browse/GEOS-303

It's really a part of WFS 1.1, so we're waiting on the infrastructure to handle that. Thankfully we're funded by OGC to do WFS 1.1, and Justin should start on it quite soon. After infrastructure improvements this will be the first fix, as it seems to be the most popular.

Chris

Randy George wrote:

Hi,

Using GeoServer 1.3.1 war in Tomcat 5.5.12 and PostGIS

            I’m having trouble while attempting to Post a GetFeature filter for a WFS datastore with a custom SRS.

I’ve added the new coord system to the epsg.properties file in gt2-epsg.jar:

104308=PROJCS["NAD83 / UTM zone 11N",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-117],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",-219278.5],PARAMETER["false_northing",-3608990.1],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["geotechYuma","104308"]]

I also added it to my PostGIS spatial_ref_sys table. The custom transform checks out correctly in PostGIS:

select asewkt(the_geom) from grid where the_geom && transform(GeometryFromText('LINESTRING(-114.58944702148402 32.764865874385, -113.64826965331999 33.551517485702824)',4269),104308)

However, when using a WFS Filter query like the following I get an empty set returned?

<?xml version='1.0' encoding='UTF-16' standalone='yes'?>

<wfs:GetFeature service="WFS" version="1.0.0"

  outputFormat="GML2"

  xmlns:wfs="http://www.opengis.net/wfs&quot;

  xmlns:ogc="http://www.opengis.net/ogc&quot;

  xmlns:gml="http://www.opengis.net/gml&quot;

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;

  xsi:schemaLocation="http://www.opengis.net/wfs

                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;

  <wfs:Query typeName="geo:grid">

    <ogc:PropertyName>geo:name</ogc:PropertyName>

    <ogc:PropertyName>geo:the_geom</ogc:PropertyName>

        <ogc:Filter>

        <ogc:BBOX>

    <ogc:PropertyName>the_geom</ogc:PropertyName>

          <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;

             <gml:coordinates>-114.58944702148402,32.764865874385 -113.64826965331999,33.551517485702824</gml:coordinates>

          </gml:Box>

        </ogc:BBOX>

   </ogc:Filter>

  </wfs:Query>

</wfs:GetFeature>

Here is the log filter:

Request: null

output format:GML2

max features:2147483647

version:

queries:

  Query

   feature type: geo:grid

   filter: [ the_geom bbox POLYGON ((-114.58944702148402 32.764865874385, -114.58944702148402 33.551517485702824, -113.64826965331999 33.551517485702824, -113.64826965331999 32.764865874385, -114.58944702148402 32.764865874385)) ]

   [properties: name, the_geom]

I think GeoServer is not detecting the custom SRS in the datastore and transforming the bbox to SRID=104308. Though perhaps I am not understanding the proper syntax for a <gml:Box> element. Is there a transform that should be applied in the OGC filter Box element?

Or do I have to perform the transform myself outside of the filter?

Curiously I can see the data in a WMS query using this kind of BBOX so WMS must be picking up the transform:

   <BoundingBox srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;

    <gml:coord>

     <gml:X>-114.58944702148402</gml:X>

     <gml:Y>32.764865874385</gml:Y>

    </gml:coord>

    <gml:coord>

     <gml:X>-113.64826965331998</gml:X>

     <gml:Y>33.551517485702824</gml:Y>

    </gml:coord>

   </BoundingBox>

I can also see the data using a WFS filter query like this with the custom SRS coordinates:

<?xml version='1.0' encoding='UTF-16' standalone='yes'?>

<wfs:GetFeature service="WFS" version="1.0.0"

  outputFormat="GML2"

  xmlns:wfs="http://www.opengis.net/wfs&quot;

  xmlns:ogc="http://www.opengis.net/ogc&quot;

  xmlns:gml="http://www.opengis.net/gml&quot;

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;

  xsi:schemaLocation="http://www.opengis.net/wfs

                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;

  <wfs:Query typeName="geo:grid">

    <ogc:PropertyName>geo:name</ogc:PropertyName>

    <ogc:PropertyName>geo:the_geom</ogc:PropertyName>

        <ogc:Filter>

        <ogc:BBOX>

    <ogc:PropertyName>the_geom</ogc:PropertyName>

          <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#104308&quot;&gt;

             <gml:coordinates>29000,26000 93000,45000</gml:coordinates>

          </gml:Box>

        </ogc:BBOX>

   </ogc:Filter>

  </wfs:Query>

</wfs:GetFeature>

Thanks

Randy George

!DSPAM:1003,44a94fc1117961702038478!

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

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

!DSPAM:1003,44a94fc1117961702038478!

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

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

!DSPAM:1003,44a94fc1117961702038478!

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org