The reason for the exception is that the JTS intersection operation only
works on valid geometries.  Unfortunately the output of the
gs:CollectGeometries process may not be valid in the case where it is
collecting a set of Polygons.  This is because polygons which are adjacent
to each other or which overlap do not form valid MultiPolygons.  Both of
these situations occur in your process (the input states are adjacent, and
the buffers will overlap).

Actually the buffer operation should work with any kind of input, and
produce a valid polygonal output.  So the problem is due to collecting the
STATES polygons together and trying to use that in JTS:intersection.

In fact, the JTS:intersection operation is not designed to work on
collections of geometries anyway.  If you want to intersect a single
polygon against a collection of features, you should look at using gs:Clip
instead.

On Thu, Jun 21, 2012 at 2:35 AM, cesare gerbino <cesaregerb...@gmail.com>wrote:

> Hi all!
>
> This is my first help request on GeoServer user list, so sorry for my
> mistakes (and for my english too ....:-)  )
>
> I'm trying to use WPS processes and I'm trying to do a wps process that
> make a buffer on a feature in a layer and then use this buffer geometry to
> intersect features on the same layer (at the moment, then I'd like to use
> another target layer).
>
> I've a wps buffer process that works fine on the "states" shapefile layer
> that is in the GeoServer installation and I can buffer for example on the
> texas (great work!!!)
>
> When I try to use the JTS:intersection I0ve some troubles.
>
> The global process is the follow:
>
> http://www.w3.org/2001/XMLSchema-instance"; xmlns="
> http://www.opengis.net/wps/1.0.0"; xmlns:wfs="http://www.opengis.net/wfs";
> xmlns:wps="http://www.opengis.net/wps/1.0.0"; xmlns:ows="
> http://www.opengis.net/ows/1.1"; xmlns:gml="http://www.opengis.net/gml";
> xmlns:ogc="http://www.opengis.net/ogc"; xmlns:wcs="
> http://www.opengis.net/wcs/1.1.1"; xmlns:xlink="
> http://www.w3.org/1999/xlink"; xsi:schemaLocation="
> http://www.opengis.net/wps/1.0.0
> http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd";>
>   <ows:Identifier>JTS:intersection</ows:Identifier>
>   <wps:DataInputs>
>     <wps:Input>
>       <ows:Identifier>a</ows:
> Identifier>
>       <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="
> http://geoserver/wps"; method="POST">
>         <wps:Body>
>           <wps:Execute version="1.0.0" service="WPS">
>  <ows:Identifier>JTS:buffer</ows:Identifier>
>  <wps:DataInputs>
>    <wps:Input>
>      <ows:Identifier>geom</ows:Identifier>
>      <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="
> http://geoserver/wps"; method="POST">
>        <wps:Body>
>          <wps:Execute version="1.0.0" service="WPS">
>            <ows:Identifier>gs:CollectGeometries</ows:Identifier>
>            <wps:DataInputs>
>              <wps:Input>
>                <ows:Identifier>features</ows:Identifier>
>                <wps:Reference mimeType="text/xml;
> subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs";
> method="POST">
>                  <wps:Body>
>                    <wfs:GetFeature service="WFS" version="1.0.0"
> outputFormat="GML2">
>                      <wfs:Query typeName="test:states">
>                      <ogc:Filter>
>                        <ogc:PropertyIsEqualTo>
>                          <ogc:PropertyName>STATE_ABBR</ogc:PropertyName>
>                          <ogc:Literal>TX</ogc:Literal>
>                        </ogc:PropertyIsEqualTo>
>                      </ogc:Filter>
>                    </wfs:Query>
>                    </wfs:GetFeature>
>                  </wps:Body>
>                </wps:Reference>
>              </wps:Input>
>            </wps:DataInputs>
>            <wps:ResponseForm>
>              <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">
>                <ows:Identifier>result</ows:Identifier>
>              </wps:RawDataOutput>
>            </wps:ResponseForm>
>          </wps:Execute>
>        </wps:Body>
>      </wps:Reference>
>    </wps:Input>
>    <wps:Input>
>      <ows:Identifier>distance</ows:Identifier>
>      <wps:Data>
>        <wps:LiteralData>1</wps:LiteralData>
>      </wps:Data>
>    </wps:Input>
>  </wps:DataInputs>
>  <wps:ResponseForm>
>    <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">
>      <ows:Identifier>result</ows:Identifier>
>    </wps:RawDataOutput>
>  </wps:ResponseForm>
>           </wps:Execute>
>         </wps:Body>
>       </wps:Reference>
>     </wps:Input>
>     <wps:Input>
>       <ows:Identifier>b</ows:Identifier>
>       <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="
> http://geoserver/wps"; method="POST">
>         <wps:Body>
>           <wps:Execute version="1.0.0" service="WPS">
>             <ows:Identifier>gs:CollectGeometries</ows:Identifier>
>             <wps:DataInputs>
>               <wps:Input>
>                 <ows:Identifier>features</ows:Identifier>
>                 <wps:Reference mimeType="text/xml;
> subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs";
> method="POST">
>                   <wps:Body>
>                     <wfs:GetFeature service="WFS" version="1.0.0"
> outputFormat="GML2">
>                       <wfs:Query typeName="test:states"/>
>                     </wfs:GetFeature>
>                   </wps:Body>
>                 </wps:Reference>
>               </wps:Input>
>             </wps:DataInputs>
>             <wps:ResponseForm>
>               <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">
>                 <ows:Identifier>result</ows:Identifier>
>               </wps:RawDataOutput>
>             </wps:ResponseForm>
>           </wps:Execute>
>         </wps:Body>
>       </wps:Reference>
>     </wps:Input>
>   </wps:DataInputs>
>   <wps:ResponseForm>
>     <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">
>       <ows:Identifier>result</ows:Identifier>
>     </wps:RawDataOutput>
>   </wps:ResponseForm>
> </wps:Execute>
>
>
> http://www.w3.org/2001/XMLSchema-instance"; xmlns="
> http://www.opengis.net/wps/1.0.0"; xmlns:wfs="http://www.opengis.net/wfs";
> xmlns:wps="http://www.opengis.net/wps/1.0.0"; xmlns:ows="
> http://www.opengis.net/ows/1.1"; xmlns:gml="http://www.opengis.net/gml";
> xmlns:ogc="http://www.opengis.net/ogc"; xmlns:wcs="
> http://www.opengis.net/wcs/1.1.1"; xmlns:xlink="
> http://www.w3.org/1999/xlink"; xsi:schemaLocation="
> http://www.opengis.net/wps/1.0.0
> http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd";>
>   <ows:Identifier>JTS:intersection</ows:Identifier>
>   <wps:DataInputs>
>     <wps:Input>
>       <ows:Identifier>a</ows:Identifier>
>       <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="
> http://geoserver/wps"; method="POST">
>         <wps:Body>
>           <wps:Execute version="1.0.0" service="WPS">
>  <ows:Identifier>JTS:buffer</ows:Identifier>
>  <wps:DataInputs>
>    <wps:Input>
>      <ows:Identifier>geom</ows:Identifier>
>      <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="
> http://geoserver/wps"; method="POST">
>        <wps:Body>
>          <wps:Execute version="1.0.0" service="WPS">
>            <ows:Identifier>gs:CollectGeometries</ows:Identifier>
>            <wps:DataInputs>
>              <wps:Input>
>                <ows:Identifier>features</ows:Identifier>
>                <wps:Reference mimeType="text/xml;
> subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs";
> method="POST">
>                  <wps:Body>
>                    <wfs:GetFeature service="WFS" version="1.0.0"
> outputFormat="GML2">
>                      <wfs:Query typeName="test:states">
>                      <ogc:Filter>
>                        <ogc:PropertyIsEqualTo>
>                          <ogc:PropertyName>STATE_ABBR</ogc:PropertyName>
>                          <ogc:Literal>TX</ogc:Literal>
>                        </ogc:PropertyIsEqualTo>
>                      </ogc:Filter>
>                    </wfs:Query>
>                    </wfs:GetFeature>
>                  </wps:Body>
>                </wps:Reference>
>              </wps:Input>
>            </wps:DataInputs>
>            <wps:ResponseForm>
>              <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">
>                <ows:Identifier>result</ows:Identifier>
>              </wps:RawDataOutput>
>            </wps:ResponseForm>
>          </wps:Execute>
>        </wps:Body>
>      </wps:Reference>
>    </wps:Input>
>    <wps:Input>
>      <ows:Identifier>distance</ows:Identifier>
>      <wps:Data>
>        <wps:LiteralData>1</wps:LiteralData>
>      </wps:Data>
>    </wps:Input>
>  </wps:DataInputs>
>  <wps:ResponseForm>
>    <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">
>      <ows:Identifier>result</ows:Identifier>
>    </wps:RawDataOutput>
>  </wps:ResponseForm>
>           </wps:Execute>
>         </wps:Body>
>       </wps:Reference>
>     </wps:Input>
>     <wps:Input>
>       <ows:Identifier>b</ows:Identifier>
>       <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="
> http://geoserver/wps"; method="POST">
>         <wps:Body>
>           <wps:Execute version="1.0.0" service="WPS">
>             <ows:Identifier>gs:CollectGeometries</ows:Identifier>
>             <wps:DataInputs>
>               <wps:Input>
>                 <ows:Identifier>features</ows:Identifier>
>                 <wps:Reference mimeType="text/xml;
> subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs";
> method="POST">
>                   <wps:Body>
>                     <wfs:GetFeature service="WFS" version="1.0.0"
> outputFormat="GML2">
>                       <wfs:Query typeName="test:states"/>
>                     </wfs:GetFeature>
>                   </wps:Body>
>                 </wps:Reference>
>               </wps:Input>
>             </wps:DataInputs>
>             <wps:ResponseForm>
>               <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">
>                 <ows:Identifier>result</ows:Identifier>
>               </wps:RawDataOutput>
>             </wps:ResponseForm>
>           </wps:Execute>
>         </wps:Body>
>       </wps:Reference>
>     </wps:Input>
>   </wps:DataInputs>
>   <wps:ResponseForm>
>     <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">
>       <ows:Identifier>result</ows:Identifier>
>     </wps:RawDataOutput>
>   </wps:ResponseForm>
> </wps:Execute>
>
> When excute the process I obtain ....
>
> <wps:ExecuteResponse xml:lang="en" service="WPS" serviceInstance="
> http://dev-geoserver.csi.it:11110/geoserver/ows?"; version="1.0.0">
> <wps:Process wps:processVersion="1.0.0">
> <ows:Identifier>JTS:intersection</ows:Identifier>
> <ows:Title>
> Returns the intersectoin between a and b (eventually an empty collection
> if there is no intersection)
> </ows:Title>
> <ows:Abstract>
> Returns the intersectoin between a and b (eventually an empty collection
> if there is no intersection)
> </ows:Abstract>
> </wps:Process>
> <wps:Status creationTime="2012-06-19T16:18:31.631Z">
> <wps:ProcessFailed>
> <ows:ExceptionReport version="1.1.0">
> <ows:Exception exceptionCode="NoApplicableCode">
> <ows:ExceptionText>
> Process failed during execution
> com.vividsolutions.jts.geom.TopologyException: no outgoing dirEdge found [
> (-103.88691416603582, 36.99506005630438, NaN) ]
> no outgoing dirEdge found [ (-103.88691416603582, 36.99506005630438, NaN) ]
> </ows:ExceptionText>
> </ows:Exception>
> </ows:ExceptionReport>
> </wps:ProcessFailed>
> </wps:Status>
> </wps:ExecuteResponse>
>
> Could you help me please? Very useful if its possibile to send me an
> example that works right!
>
> Thank you in advance
>
> Bye
>
>
> --
> Cesare Gerbino
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>


-- 
Martin Davis
OpenGeo - http://opengeo.org
Expert service straight from the developers.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to