Skip to content

Commit

Permalink
Merge pull request #214 from opengeospatial/issue#211
Browse files Browse the repository at this point in the history
This should fix #211
  • Loading branch information
dstenger committed Jan 18, 2022
2 parents 77138c0 + 996c727 commit cf61f95
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
Expand Up @@ -86,7 +86,12 @@ public void nonSpecificBBOX(ProtocolBinding binding, QName featureType) {
throw new SkipException("Feature type has no geometry properties: " + featureType);
}
Envelope extent = this.dataSampler.getSpatialExtent(getModel(), featureType);
Document gmlEnv = envelopeAsGML(extent);
Document gmlEnv = null;
try {
gmlEnv = envelopeAsGML(extent);
} catch (Exception e) {
throw new RuntimeException("Could not create envelope for feature type: " + featureType);
}
WFSMessage.appendSimpleQuery(this.reqEntity, featureType);
addBBOXPredicate(this.reqEntity, gmlEnv.getDocumentElement(), null);
URI endpoint = ServiceMetadataUtils.getOperationEndpoint(this.wfsMetadata, WFS2.GET_FEATURE, binding);
Expand Down Expand Up @@ -141,7 +146,12 @@ public void bboxWithDefaultExtent(ProtocolBinding binding, QName featureType) {
Element valueRef = WFSMessage.createValueReference(geomProp);
WFSMessage.appendSimpleQuery(this.reqEntity, featureType);
Envelope extent = this.dataSampler.getSpatialExtent(getModel(), featureType);
Document gmlEnv = envelopeAsGML(extent);
Document gmlEnv = null;
try {
gmlEnv = envelopeAsGML(extent);
} catch (Exception e) {
throw new RuntimeException("Could not create envelope for feature type: " + featureType);
}
addBBOXPredicate(this.reqEntity, gmlEnv.getDocumentElement(), valueRef);
ClientResponse rsp = wfsClient.submitRequest(reqEntity, binding);
this.rspEntity = extractBodyAsDocument(rsp);
Expand Down Expand Up @@ -215,8 +225,13 @@ public void invalidGeometryOperand(QName featureType) {
XSElementDeclaration gmlDesc = getModel().getElementDeclaration("description", Namespaces.GML);
Element valueRef = WFSMessage.createValueReference(gmlDesc);
WFSMessage.appendSimpleQuery(this.reqEntity, featureType);
Envelope spatialExtent = featureInfo.get(featureType).getSpatialExtent();
Document gmlEnv = envelopeAsGML(spatialExtent);
Envelope extent = this.dataSampler.getSpatialExtent(getModel(), featureType);
Document gmlEnv = null;
try {
gmlEnv = envelopeAsGML(extent);
} catch (Exception e) {
throw new RuntimeException("Could not create envelope for feature type: " + featureType);
}
addBBOXPredicate(this.reqEntity, gmlEnv.getDocumentElement(), valueRef);
ClientResponse rsp = wfsClient.submitRequest(reqEntity, ProtocolBinding.ANY);
this.rspEntity = rsp.getEntity(Document.class);
Expand Down
Expand Up @@ -141,7 +141,12 @@ public void intersectsPolygon(ProtocolBinding binding, QName featureType) throws
throw new SkipException("Unsupported geometry operand: " + gmlPolygon);
}
Envelope extent = this.dataSampler.getSpatialExtent(getModel(), featureType);
Document gmlEnv = Extents.envelopeAsGML(extent);
Document gmlEnv = null;
try {
gmlEnv = Extents.envelopeAsGML(extent);
} catch (Exception e) {
throw new RuntimeException("Could not create envelope for feature type: " + featureType);
}
Element gmlPolygonElem = XMLUtils
.transform(new StreamSource(getClass().getResourceAsStream(XSLT_ENV2POLYGON)), gmlEnv, null)
.getDocumentElement();
Expand Down Expand Up @@ -191,9 +196,14 @@ public void intersectsCurve(ProtocolBinding binding, QName featureType) throws X
}
}
Envelope extent = this.dataSampler.getSpatialExtent(getModel(), featureType);
Document gmlEnvelope = Extents.envelopeAsGML(extent);
Document gmlEnv = null;
try {
gmlEnv = Extents.envelopeAsGML(extent);
} catch (Exception e) {
throw new RuntimeException("Could not create envelope for feature type: " + featureType);
}
Element gmlCurveElem = XMLUtils
.transform(new StreamSource(getClass().getResourceAsStream("envelopeTocurve.xsl")), gmlEnvelope,
.transform(new StreamSource(getClass().getResourceAsStream("envelopeTocurve.xsl")), gmlEnv,
Collections.singletonMap("curveType", gmlCurve.getLocalPart()))
.getDocumentElement();
List<XSElementDeclaration> geomProps = this.allGeomProperties.get(featureType);
Expand Down

0 comments on commit cf61f95

Please sign in to comment.