Hi Martin,

thank you very much for your answer, it was very clarifying. It turned out that what I really needed was gs:RectangularClip, suits perfectly my needs and has very good performance. I was able to build a working query thanks to the integrated query builder. Still don't know what was wrong with my gs:IntersectionFeatureCollection request, I tried to exchange the order of lat/lon, but it doesn't work either. I probably need to study more the protocol or the dataset. But I'm happy with gs:RectangularClip for now.

As for Union, it's not really a big issue, we will code it in our java applet as we are used to. Delegating rasters and vector queries to Geoserver is a big relief already!

Regards,

Paolo


Il 10/12/2012 19:03, Martin Davis ha scritto:
Your WFS query won't work because <Intersection> is not a supported operation in the OGC Filter Encoding spec. (<Intersects> is, however, which is why the initial query worked.) In general, WFS supports expressing *filters* for data, but not *manipulation* of the retrieved data. So it is not an option for the kind of processing that you want to do. (Perhaps this will be improved in a new version of the spec, or by some GeoServer-specific enhancements...)

As for the WPS query, the syntax looks fine. What you are seeing is an empty result being returned. Are you sure that the "communi_ita" dataset has features in the are that you are trying to intersect?

If you are only intersecting with a rectangle, you may also want to try gs:Clip or gs:RectangularClip - they are optimized for clipping feature geometry to a given polygon and rectangle.

As for union, if what you are wanting to do is to geometrically union all the data from a layer unfortunately there isn't currently a process which will accomplish this. It's quite possible to create such a process in Java with fairly small effort, however - you could try and do this yourself, or consider funding someone to do this.


On Mon, Dec 10, 2012 at 8:09 AM, Paolo Crosato <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    I'm trying to perform by use of Geoserver the equivalent of the
    Postgis
    ST_intersection and ST_Union functions. The server I'm working with is
    the os indipendent binary with jetty.

    In the first case, I need to compute the intersection between a
    polygon
    (a rectangle) and a postgis table published as a WFS vector layer via
    Geoserver. The simple intersects, which I performed succesfully,
    is not
    sufficient since I need to minimize the information transimitted over
    the network, because the application will run on mobile clients.
    First I tried with a simple WFS request, since I found on the
    GetCapabilities response for the WFS service that the "intersection"
    function was supported, as intersects is. So I tried this simple XML,
    which works with intersects:

    <wfs:GetFeature service="WFS" version="1.1.0"
       xmlns:topp="http://www.openplans.org/topp";
       xmlns:wfs="http://www.opengis.net/wfs";
       xmlns="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.1.0/wfs.xsd";>
       <wfs:Query typeName="navteq:geoserver_comuni">
         <Filter>
           <Intersection>
             <PropertyName>geom</PropertyName>
               <gml:Polygon srsName="urn:ogc:def:crs:EPSG:6.9:4326">
             <gml:exterior>
               <gml:LinearRing>
             <gml:posList>45.429299 11.82518 45.429299 12.540665 45.77327
    12.540665 45.77327 11.82518 45.429299 11.82518</gml:posList>
               </gml:LinearRing>
             </gml:exterior>
               </gml:Polygon>
             </Intersection>
           </Filter>
       </wfs:Query>
    </wfs:GetFeature>

    However, I got a "Unable to find function Intersection" response from
    the server.
    I did some research, and found the preferred way to do this kind of
    computation seems to be using a WPS approach, so I installed the WPS
    extension and looked for some examples.
    I tried this example, which was assembled by a mixture of the WPS
    builder and an example I found on this thread:
    
http://osgeo-org.1560.n6.nabble.com/Geoserver-2-2-Insertection-with-buffer-td5009029.html
    This is the code I tried:

    <?xml version="1.0" encoding="UTF-8"?>
    <wps:Execute version="1.0.0" service="WPS"
    xmlns:xsi="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>gs:IntersectionFeatureCollection</ows:Identifier>
       <wps:DataInputs>
         <wps:Input>
           <ows:Identifier>first feature collection</ows:Identifier>
           <wps:Reference mimeType="text/xml; subtype=wfs-collection/1.0"
    xlink:href="http://geoserver/wps"; method="POST">
             <wps:Body>
               <wps:Execute version="1.0.0" service="WPS">
     <ows:Identifier>gs:Feature</ows:Identifier>
                 <wps:DataInputs>
                   <wps:Input>
    <ows:Identifier>geometry</ows:Identifier>
                     <wps:Data>
                       <wps:ComplexData
    mimeType="application/wkt"><![CDATA[POLYGON((45.429299
    11.82518,45.429299 12.540665,45.77327 12.540665,45.77327
    11.82518,45.429299 11.82518))]]></wps:ComplexData>
                     </wps:Data>
                   </wps:Input>
                   <wps:Input>
     <ows:Identifier>crs</ows:Identifier>
                     <wps:Data>
    <wps:LiteralData>EPSG:4326</wps:LiteralData>
                     </wps:Data>
                   </wps:Input>
                   <wps:Input>
    <ows:Identifier>typeName</ows:Identifier>
                     <wps:Data>
     <wps:LiteralData>buf</wps:LiteralData>
                     </wps:Data>
                   </wps:Input>
                 </wps:DataInputs>
                 <wps:ResponseForm>
                   <wps:RawDataOutput mimeType="text/xml;
    subtype=wfs-collection/1.0">
     <ows:Identifier>result</ows:Identifier>
                   </wps:RawDataOutput>
                 </wps:ResponseForm>
               </wps:Execute>
             </wps:Body>
           </wps:Reference>
         </wps:Input>
         <wps:Input>
           <ows:Identifier>second feature collection</ows:Identifier>
           <wps:Reference mimeType="text/xml"
    xlink:href="http://geoserver/wfs"; method="POST">
             <wps:Body>
               <wfs:GetFeature service="WFS" version="1.0.0"
    outputFormat="GML2" xmlns:navteq="navteq">
                 <wfs:Query typeName="navteq:comuni_ita"/>
               </wfs:GetFeature>
             </wps:Body>
           </wps:Reference>
         </wps:Input>
         <wps:Input>
     <ows:Identifier>intersectionMode</ows:Identifier>
           <wps:Data>
     <wps:LiteralData>INTERSECTION</wps:LiteralData>
           </wps:Data>
         </wps:Input>
       </wps:DataInputs>
       <wps:ResponseForm>
         <wps:RawDataOutput mimeType="text/xml;
    subtype=wfs-collection/1.0">
           <ows:Identifier>result</ows:Identifier>
         </wps:RawDataOutput>
       </wps:ResponseForm>
    </wps:Execute>

    I thought this would give me back the set of intersecting geometries,
    however I got this response, seems to be the bbox I put as input:
    <?xml version="1.0" encoding="UTF-8"?>
    <wfs:FeatureCollection xmlns:ogc="http://www.opengis.net/ogc";
    xmlns:gml="http://www.opengis.net/gml";
    xmlns:wfs="http://www.opengis.net/wfs";>
    <gml:boundedBy>
    <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326";>
    
<gml:coord><gml:X>45.429299</gml:X><gml:Y>11.82518</gml:Y></gml:coord><gml:coord><gml:X>45.77327</gml:X><gml:Y>12.540665</gml:Y></gml:coord></gml:Box>
    </gml:boundedBy>
    </wfs:FeatureCollection>

    I'm pretty new to Geoserver, so I've got no big clues on what to
    do now.
    1) Is WPS and gs:IntersectionFeatureCollection the right way to do
    this,
    or is something wrong with the WFS intersection example I tried
    before?
    2) Could anyone give me a clue on what is wrong with my WPS example?
    3) I need to do the same with ST_Union, I gave a look at the
    description
    of gs:union, however it seems to work only with 2 single features,
    while
    I'd need to perform an aggregate
    function on an entire set of geometries, based on attributes.

    The most important issue for me, however, is that I'm trying to use
    Geoserver because I'd like to put a layer between the database and the
    application running on the client.
    I could do the same with a java webapp performing only the
    operations I
    need, basicly mapping them to calls to postgis functions, but I'd
    really
    like to avoid all the coding,
    mainly because we already have a lot of custom code to mantain.
    I'd like
    to switch from implementing code to wiring applications in an
    infrastructure.
    Is Geoserver the right tool to use from this perspective, or should I
    code the "transactional" operations in Java and use Geoserver just for
    simple WMS and WFS requests?

    Thank you in advance for any response.

    Regards.

    --
    Paolo Crosato



    
------------------------------------------------------------------------------
    LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
    Remotely access PCs and mobile devices and provide instant support
    Improve your efficiency, and focus on delivering more value-add
    services
    Discover what IT Professionals Know. Rescue delivers
    http://p.sf.net/sfu/logmein_12329d2d
    _______________________________________________
    Geoserver-users mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/geoserver-users




--
Martin Davis
OpenGeo - http://opengeo.org <http://opengeo.org/>
Expert service straight from the developers.



------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d


_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--
Paolo Crosato

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to