On Thu, Jun 21, 2012 at 8:17 PM, Martin Davis <mda...@opengeo.org> wrote:

> 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).


The current version of collectGeometries now does a union before returning
polygon collections, I guess you haven't used it in a few months, the
change has been made in March (http://jira.codehaus.org/browse/GEOT-4077)

However this might explain why Cesare's case is not working, I believe he
has a 2.1.3 installed.


>
> 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.
>

The gs:CollectGeometries process made sure to build a type specific
collection for that very reason, you will get back
a GeometryCollection only if the collected geometries are etherogeneous:
http://svn.osgeo.org/geotools/trunk/modules/library/main/src/main/java/org/geotools/geometry/jts/GeometryCollector.java

Or do you mean that intersecting a Multipolygon against another
Multipolygon is less robust than an intersection
between simple polygons?


>  If you want to intersect a single polygon against a collection of
> features, you should look at using gs:Clip instead.
>

Two different use cases. gs:Clip generates features, it's a good tool for a
"clip and ship" scenario where you want
to download a layer. The process setup they way it has been it's good if
all you want is the resulting geometry,
though it would have been more scalable if the gs:Clip was used as the
first step, and a collectGeometry
called later, that is, something like:

collectGeometries
  gs:Clip
    layerB
    collectGemetries(layerA)


Cheers
Andrea


-- 
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313
mob:    +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
------------------------------------------------------------------------------
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