0

How can I validate the (topological) correctness of a Deegree GMLObject?

When performing a gmlObject.toString() - to get the WKT string - I get a weird result: “MULTI… […]”. The last part of the "[...]" is literal.

So, I suspice that the topo is not correct. How to proof that?

I could validate the object via JTS. Converting the object via WKT to JTS fails, because JTS.WKTReader is complaining about the literal "[...]".

The simplified object is:

enter image description here

The GML is:

        <gml:Surface srsDimension="2">
           <gml:patches>
              <gml:PolygonPatch>
                 <gml:exterior>
                    <gml:Ring>
                       <gml:curveMember>
                          <gml:Curve>
                             <gml:segments>
                                <gml:LineStringSegment>
                                   <gml:posList>118629.351 408359.111 118629.646 408360.435 118637.679 408360.695 118619.346 408364.411 118620.475 408369.426 118615.266 408370.497 118613.919 408370.774</gml:posList>
                                </gml:LineStringSegment>
                                <gml:Arc>
                                   <gml:posList>118613.919 408370.774 118612.801 408365.636 118612.111 408360.776</gml:posList>
                                </gml:Arc>
                                <gml:LineStringSegment>
                                   <gml:posList>118612.111 408360.776 118612.059 408359.772 118612.110 408358.715 118612.410 408357.786 118613.045 408357.067 118613.762 408356.538 118638.182 408351.095 118647.618 408348.889 118651.890 408347.504 118668.913 408341.899</gml:posList>
                                </gml:LineStringSegment>
                                <gml:Arc>
                                   <gml:posList>118668.913 408341.899 118671.576 408340.735 118674.210 408339.346</gml:posList>
                                </gml:Arc>
                                <gml:LineStringSegment>
                                   <gml:posList>118674.210 408339.346 118678.905 408336.675 118687.601 408331.844</gml:posList>
                                </gml:LineStringSegment>
                                <gml:Arc>
                                   <gml:posList>118687.601 408331.844 118690.525 408330.562 118694.026 408329.809</gml:posList>
                                </gml:Arc>
                                <gml:LineStringSegment>
                                   <gml:posList>118694.026 408329.809 118629.351 408359.111</gml:posList>
                                </gml:LineStringSegment>
                             </gml:segments>
                          </gml:Curve>
                       </gml:curveMember>
                    </gml:Ring>
                 </gml:exterior>
              </gml:PolygonPatch>
           </gml:patches>
        </gml:Surface>

1 Answer 1

1

Just use deegree.Geometry.

XMLStreamReader r = xmlInputFactory.createXMLStreamReader(new StringReader(gml));
GMLStreamReader gmlStreamReader = GMLInputFactory.createGMLStreamReader(gmlVersion, r);
geometryObject = gmlStreamReader.readGeometry();
GeometryValidator validator = new GeometryValidator( ( event) -> {
  geometryValidations.add( event);
  return false;
});
if( ! validator.validateGeometry( dgGeometry)) {
  logger.error( "Invalid gml: {}", gml);
  throw new GeometryException("The geometry is not valid");
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.