From: Andrea A. <aa...@op...> - 2006-12-23 11:45:21
|
Szakacs, Balazs ha scritto: > Dear Group > > Please commit to me if this bug or not. > > I'm trying to insert a very simple polygon with hole in multipolygon > environment. The hole touches the exterior with one single point. > > +----------+----------+ > | / \ | > | / \ | > | / \ | > | +-------+ | > | Inner ring | > | | > +---------------------+ > Outer ring > > The insert transaction (see below) can be tested with geoserver sample > requests client. > > In this case after a warning ("Topology Error building polygon") I get > an error message too. > > The reason is in SubHandlerPolygon.java in Line 217. > > /** > * Returns the completed OGC Polygon. > * > * @param geometryFactory Geometry factory to be used in Polygon > creation. > * > * @return Completed OGC Polygon. > */ > public Geometry create(GeometryFactory geometryFactory) { > for (int i = 0; i < innerBoundaries.size(); i++) { > LinearRing hole = (LinearRing) innerBoundaries.get(i); > > if (hole.crosses(outerBoundary)) { > LOGGER.warning("Topology Error building polygon"); > > return null; > } > } > return geometryFactory.createPolygon(outerBoundary, > (LinearRing[]) innerBoundaries.toArray(new LinearRing[0])); > } > > In this case result of "if (hole.crosses(outerBoundary))" is FALSE !! > > I think this is wrong and neither conforms to OGC Simple Feature spec. > nor JTS Tech Spec. > > Please let me know if can you commit this as bug or I'm wrong. It's not a bug. It's a clear example of invalid polygon according to the OGC simple feature specification, page 2-9, figure 2.5. See http://cgns-dev.nrcan.gc.ca/cgns_web/docs/sld-071-r0.pdf That thing must be represented as a single ring touching itself in a single point afaik (but I'm not sure, you have to try out). Hope this helps Andrea Aime |