[Geoserver-users] WFS help, reprojecting to a SHP file

Dear WFS experts,

My data is in PostGIS in 4326. I’d like to get it in another CRS, say 32124. My WFS is below, but doesn’t seem to work, as I get an empty SHP file with a prj in 32124. If I remove the srsName=“EPSG:32124” in the wfs:Query, then I get back a non-empty SHP file, but of course in 4326. What am I missing to get this to work right?

<wfs:GetFeature service=“WFS” version=“1.1.0” outputFormat=“OGR-SHP-ZIP” xmlns:ogi=“http://ogi.state.ok.us/ogi” xmlns:wfs=“http://www.opengis.net/wfs” xmlns:ogc=“http://www.opengis.net/ogc” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd”>
<wfs:Query typeName=“ogi:okzip” srsName=“EPSG:32124”>
<ogc:Filter xmlns:gml=“http://www.opengis.net/gml” xmlns:wfs=“http://www.opengis.net/wfs” xmlns:ogc=“http://www.opengis.net/ogc”>
ogc:Intersects
ogc:PropertyNamethe_geom</ogc:PropertyName>
<gml:Polygon xmlns:gml=“http://www.opengis.net/gml”>
gml:exterior
gml:LinearRing
gml:posList36.162461016590406 -95.72623213288038 36.16239457742048 -95.70853821460751 36.16239503494274 -95.7028379513851 36.16239509586006 -95.70241429840377 36.16241464030964 -95.70041100102071 36.16244466714185 -95.69030812365675 36.162493753547466 -95.67272683567377 36.16254229528372 -95.65469436602265 36.15527648273907 -95.65474667633558 36.15104126082803 -95.65491384464943 36.14788323308807 -95.65474304361845 36.135092286532924 -95.65473688095899 36.133467180359666 -95.65473592929983 36.129393002270035 -95.65464950871365 36.118911464718565 -95.65472905998877 36.10426527363533 -95.65475051776679 36.08982749478221 -95.65471594622414 36.087926803792215 -95.65477125502888 36.07515764588499 -95.65476584420048 36.07524345777975 -95.67252508917953 36.075278555149126 -95.69025605583545 36.07535949553184 -95.7081845271488 36.075344642465325 -95.72591523766292 36.07531247886979 -95.73690874305362 36.07531036565974 -95.73899463913015 36.07537469911383 -95.74395611261946 36.0753892056261 -95.7502700851874 36.07537124898808 -95.76167634851282 36.0825795458937 -95.76167333920792 36.089902850791766 -95.76170982504254 36.10445643807378 -95.76164891163025 36.104960938937715 -95.7616467978849 36.11889572824385 -95.76143744700344 36.12985649501806 -95.76154254881187 36.133564385131514 -95.76157810461353 36.14809543953581 -95.76163410593792 36.162556032246435 -95.76168984635632 36.1625283330661 -95.75517119764213 36.16249918857148 -95.75026084705976 36.16248990371202 -95.7442927798432 36.162461016590406 -95.72623213288038</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</ogc:Intersects>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

Thanks!!
Roger

Hi Roger,

I may be wrong, but I guess the srsName attribute in Query only indicates the output CRS, but you need to add an srsName attribute to the query geometry (the polygon in this case) to indicate which crs it is in. Otherwise it is assumed to be in the same CRS than the query and hence since the coordinates in the polygon are geodetic, no result is being matched.

Cheers,
Gabriel

Roger Bedell wrote:

Dear WFS experts,
My data is in PostGIS in 4326. I'd like to get it in another CRS, say 32124. My WFS is below, but doesn't seem to work, as I get an empty SHP file with a prj in 32124. If I remove the srsName="EPSG:32124" in the <wfs:Query>, then I get back a non-empty SHP file, but of course in 4326. What am I missing to get this to work right?
<wfs:GetFeature service="WFS" version="1.1.0" outputFormat="OGR-SHP-ZIP" xmlns:ogi="http://ogi.state.ok.us/ogi&quot; xmlns:wfs="http://www.opengis.net/wfs&quot; xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd&quot;&gt;
  <wfs:Query typeName="ogi:okzip" srsName="EPSG:32124">
    <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot; xmlns:wfs="http://www.opengis.net/wfs&quot; xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
      <ogc:Intersects>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot;&gt;
          <gml:exterior>
            <gml:LinearRing>
              <gml:posList>36.162461016590406 -95.72623213288038 36.16239457742048 -95.70853821460751 36.16239503494274 -95.7028379513851 36.16239509586006 -95.70241429840377 36.16241464030964 -95.70041100102071 36.16244466714185 -95.69030812365675 36.162493753547466 -95.67272683567377 36.16254229528372 -95.65469436602265 36.15527648273907 -95.65474667633558 36.15104126082803 -95.65491384464943 36.14788323308807 -95.65474304361845 36.135092286532924 -95.65473688095899 36.133467180359666 -95.65473592929983 36.129393002270035 -95.65464950871365 36.118911464718565 -95.65472905998877 36.10426527363533 -95.65475051776679 36.08982749478221 -95.65471594622414 36.087926803792215 -95.65477125502888 36.07515764588499 -95.65476584420048 36.07524345777975 -95.67252508917953 36.075278555149126 -95.69025605583545 36.07535949553184 -95.7081845271488 36.075344642465325 -95.72591523766292 36.07531247886979 -95.73690874305362 36.07531036565974 -95.73899463913015 36.07537469911383 -95.74395611261946 36.0753892056261 -95.7502700851874 36.07537124898808 -95.76167634851282 36.0825795458937 -95.76167333920792 36.089902850791766 -95.76170982504254 36.10445643807378 -95.76164891163025 36.104960938937715 -95.7616467978849 36.11889572824385 -95.76143744700344 36.12985649501806 -95.76154254881187 36.133564385131514 -95.76157810461353 36.14809543953581 -95.76163410593792 36.162556032246435 -95.76168984635632 36.1625283330661 -95.75517119764213 36.16249918857148 -95.75026084705976 36.16248990371202 -95.7442927798432 36.162461016590406 -95.72623213288038</gml:posList>
            </gml:LinearRing>
          </gml:exterior>
        </gml:Polygon>
      </ogc:Intersects>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>
Thanks!!
Roger

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

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

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

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

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Thanks Gabriel!
I made this change:

        <gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot; srsName="EPSG:4326">

but now I get this error:

<ows:ExceptionText>
org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0) Parsing
      failed for LinearRing: org.geoserver.wfs.WFSException:
      org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0)
      org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0)
</ows:ExceptionText>

I'm still missing something...

Roger
--------------------------------------------------
From: "Gabriel Roldan" <groldan@anonymised.com>
Sent: Wednesday, June 24, 2009 9:36 AM
To: "Roger Bedell" <roger@anonymised.com>
Cc: <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] WFS help, reprojecting to a SHP file

Hi Roger,

I may be wrong, but I guess the srsName attribute in Query only
indicates the output CRS, but you need to add an srsName attribute to
the query geometry (the polygon in this case) to indicate which crs it
is in. Otherwise it is assumed to be in the same CRS than the query and
hence since the coordinates in the polygon are geodetic, no result is
being matched.

Cheers,
Gabriel

Roger Bedell wrote:

Dear WFS experts,

My data is in PostGIS in 4326. I'd like to get it in another CRS, say
32124. My WFS is below, but doesn't seem to work, as I get an empty SHP
file with a prj in 32124. If I remove the srsName="EPSG:32124" in the
<wfs:Query>, then I get back a non-empty SHP file, but of course in
4326. What am I missing to get this to work right?

<wfs:GetFeature service="WFS" version="1.1.0" outputFormat="OGR-SHP-ZIP"
xmlns:ogi="http://ogi.state.ok.us/ogi&quot;
xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd&quot;&gt;
  <wfs:Query typeName="ogi:okzip" srsName="EPSG:32124">
    <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
      <ogc:Intersects>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot;&gt;
          <gml:exterior>
            <gml:LinearRing>
              <gml:posList>36.162461016590406 -95.72623213288038
36.16239457742048 -95.70853821460751 36.16239503494274 -95.7028379513851
36.16239509586006 -95.70241429840377 36.16241464030964
-95.70041100102071 36.16244466714185 -95.69030812365675
36.162493753547466 -95.67272683567377 36.16254229528372
-95.65469436602265 36.15527648273907 -95.65474667633558
36.15104126082803 -95.65491384464943 36.14788323308807
-95.65474304361845 36.135092286532924 -95.65473688095899
36.133467180359666 -95.65473592929983 36.129393002270035
-95.65464950871365 36.118911464718565 -95.65472905998877
36.10426527363533 -95.65475051776679 36.08982749478221
-95.65471594622414 36.087926803792215 -95.65477125502888
36.07515764588499 -95.65476584420048 36.07524345777975
-95.67252508917953 36.075278555149126 -95.69025605583545
36.07535949553184 -95.7081845271488 36.075344642465325
-95.72591523766292 36.07531247886979 -95.73690874305362
36.07531036565974 -95.73899463913015 36.07537469911383
-95.74395611261946 36.0753892056261 -95.7502700851874 36.07537124898808
-95.76167634851282 36.0825795458937 -95.76167333920792
36.089902850791766 -95.76170982504254 36.10445643807378
-95.76164891163025 36.104960938937715 -95.7616467978849
36.11889572824385 -95.76143744700344 36.12985649501806
-95.76154254881187 36.133564385131514 -95.76157810461353
36.14809543953581 -95.76163410593792 36.162556032246435
-95.76168984635632 36.1625283330661 -95.75517119764213 36.16249918857148
-95.75026084705976 36.16248990371202 -95.7442927798432
36.162461016590406 -95.72623213288038</gml:posList>
            </gml:LinearRing>
          </gml:exterior>
        </gml:Polygon>
      </ogc:Intersects>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

Thanks!!
Roger

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

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

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

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

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Thanks Gabriel!
I made this change:

        <gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot; srsName="EPSG:4326">

but now I get this error:

<ows:ExceptionText>
org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0) Parsing
      failed for LinearRing: org.geoserver.wfs.WFSException:
      org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0)
      org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0)
</ows:ExceptionText>

I'm still missing something...

Roger
--------------------------------------------------
From: "Gabriel Roldan" <groldan@anonymised.com>
Sent: Wednesday, June 24, 2009 9:36 AM
To: "Roger Bedell" <roger@anonymised.com>
Cc: <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] WFS help, reprojecting to a SHP file

Hi Roger,

I may be wrong, but I guess the srsName attribute in Query only
indicates the output CRS, but you need to add an srsName attribute to
the query geometry (the polygon in this case) to indicate which crs it
is in. Otherwise it is assumed to be in the same CRS than the query and
hence since the coordinates in the polygon are geodetic, no result is
being matched.

Cheers,
Gabriel

Roger Bedell wrote:

Dear WFS experts,

My data is in PostGIS in 4326. I'd like to get it in another CRS, say
32124. My WFS is below, but doesn't seem to work, as I get an empty SHP
file with a prj in 32124. If I remove the srsName="EPSG:32124" in the
<wfs:Query>, then I get back a non-empty SHP file, but of course in
4326. What am I missing to get this to work right?

<wfs:GetFeature service="WFS" version="1.1.0" outputFormat="OGR-SHP-ZIP"
xmlns:ogi="http://ogi.state.ok.us/ogi&quot;
xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd&quot;&gt;
  <wfs:Query typeName="ogi:okzip" srsName="EPSG:32124">
    <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
      <ogc:Intersects>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot;&gt;
          <gml:exterior>
            <gml:LinearRing>
              <gml:posList>36.162461016590406 -95.72623213288038
36.16239457742048 -95.70853821460751 36.16239503494274 -95.7028379513851
36.16239509586006 -95.70241429840377 36.16241464030964
-95.70041100102071 36.16244466714185 -95.69030812365675
36.162493753547466 -95.67272683567377 36.16254229528372
-95.65469436602265 36.15527648273907 -95.65474667633558
36.15104126082803 -95.65491384464943 36.14788323308807
-95.65474304361845 36.135092286532924 -95.65473688095899
36.133467180359666 -95.65473592929983 36.129393002270035
-95.65464950871365 36.118911464718565 -95.65472905998877
36.10426527363533 -95.65475051776679 36.08982749478221
-95.65471594622414 36.087926803792215 -95.65477125502888
36.07515764588499 -95.65476584420048 36.07524345777975
-95.67252508917953 36.075278555149126 -95.69025605583545
36.07535949553184 -95.7081845271488 36.075344642465325
-95.72591523766292 36.07531247886979 -95.73690874305362
36.07531036565974 -95.73899463913015 36.07537469911383
-95.74395611261946 36.0753892056261 -95.7502700851874 36.07537124898808
-95.76167634851282 36.0825795458937 -95.76167333920792
36.089902850791766 -95.76170982504254 36.10445643807378
-95.76164891163025 36.104960938937715 -95.7616467978849
36.11889572824385 -95.76143744700344 36.12985649501806
-95.76154254881187 36.133564385131514 -95.76157810461353
36.14809543953581 -95.76163410593792 36.162556032246435
-95.76168984635632 36.1625283330661 -95.75517119764213 36.16249918857148
-95.75026084705976 36.16248990371202 -95.7442927798432
36.162461016590406 -95.72623213288038</gml:posList>
            </gml:LinearRing>
          </gml:exterior>
        </gml:Polygon>
      </ogc:Intersects>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

Thanks!!
Roger

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

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

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

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

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Roger Bedell ha scritto:

Dear WFS experts,
My data is in PostGIS in 4326. I'd like to get it in another CRS, say 32124. My WFS is below, but doesn't seem to work, as I get an empty SHP file with a prj in 32124. If I remove the srsName="EPSG:32124" in the <wfs:Query>, then I get back a non-empty SHP file, but of course in 4326. What am I missing to get this to work right?
<wfs:GetFeature service="WFS" version="1.1.0" outputFormat="OGR-SHP-ZIP" xmlns:ogi="http://ogi.state.ok.us/ogi&quot; xmlns:wfs="http://www.opengis.net/wfs&quot; xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd&quot;&gt;
  <wfs:Query typeName="ogi:okzip" srsName="EPSG:32124">
    <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot; xmlns:wfs="http://www.opengis.net/wfs&quot; xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
      <ogc:Intersects>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot;&gt;

I'm just guessing but I think you should mention the srs in your
filter geometry as well (to force it to 4326).
Oh, and use wfs 1.0, otherwise you might get flipped coordinates
depending on what 32124 is (it sounds like an UTM zone, in that
case not, but if it's geographic, WFS 1.1 will return data in
lat/lon order)

Cheers
Andrea

Roger Bedell ha scritto:

Thanks Gabriel!
I made this change:

        <gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot; srsName="EPSG:4326">

but now I get this error:

<ows:ExceptionText>
org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0) Parsing
      failed for LinearRing: org.geoserver.wfs.WFSException:
      org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0)
      org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0)
</ows:ExceptionText>

I'm still missing something...

Axis order. WFS 1.1 uses lat/lon order, but you're specifing
the srs in the old deprecated syntax used for WFS 1.0,
when you do, GeoServer assumes you're a legacy and reverts
to lon/lat order:

http://geoserver.org/display/GEOSDOC/2.+WFS+-+Web+Feature+Service

Cheers
Andrea

Thanks Andrea,

Changed the line to:
<gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot; srsName="urn:x-ogc:def:crs:EPSG:4326">

and all is good.
Roger

--------------------------------------------------
From: "Andrea Aime" <aaime@anonymised.com>
Sent: Wednesday, June 24, 2009 12:11 PM
To: "Roger Bedell" <roger@anonymised.com>
Cc: <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] WFS help, reprojecting to a SHP file

Roger Bedell ha scritto:

Thanks Gabriel!
I made this change:

        <gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot;
srsName="EPSG:4326">

but now I get this error:

<ows:ExceptionText>
org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0) Parsing
      failed for LinearRing: org.geoserver.wfs.WFSException:

org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0)

org.geotools.referencing.operation.projection.PointOutsideEnvelopeException:
      -95.72623213288038 outside of (-90.0,90.0)
</ows:ExceptionText>

I'm still missing something...

Axis order. WFS 1.1 uses lat/lon order, but you're specifing
the srs in the old deprecated syntax used for WFS 1.0,
when you do, GeoServer assumes you're a legacy and reverts
to lon/lat order:

http://geoserver.org/display/GEOSDOC/2.+WFS+-+Web+Feature+Service

Cheers
Andrea