Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 1.7.0-beta1
-
Fix Version/s: 1.6.5, 1.7.0-beta2
-
Component/s: WMS
-
Labels:None
-
Number of attachments :
Description
When trying to evaluate the coverage by providing a point that is in a different CRS with respect to the one of the coverage itself, problems may occurs when the bursa params are missing.
In such a case, WMS may cause a WmsException resulting in no value displayed in the OpenLayer client.
TRACE:
-----------
org.vfny.geoserver.wms.WmsException
at org.vfny.geoserver.wms.responses.featureInfo.AbstractFeatureInfoResponse.execute(AbstractFeatureInfoResponse.java:279)
.....
Caused by: org.opengis.coverage.CannotEvaluateException: Can't evaluate a value for coordinate (28,593, 42,74).
at org.geotools.coverage.grid.GridCoverage2D.toPoint2D(GridCoverage2D.java:561)
at org.geotools.coverage.grid.GridCoverage2D.evaluate(GridCoverage2D.java:532)
at org.vfny.geoserver.wms.responses.featureInfo.AbstractFeatureInfoResponse.execute(AbstractFeatureInfoResponse.java:268)
... 53 more
Caused by: org.opengis.referencing.operation.TransformException: Bursa wolf parameters required.
at org.geotools.geometry.TransformedDirectPosition.setSourceCRS(TransformedDirectPosition.java:205)
at org.geotools.geometry.TransformedDirectPosition.transform(TransformedDirectPosition.java:255)
at org.geotools.coverage.grid.GridCoverage2D.toPoint2D(GridCoverage2D.java:559)
... 55 more
Caused by: org.opengis.referencing.operation.OperationNotFoundException: Bursa wolf parameters required.
at org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:1072)
at org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:1136)
at org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:881)
at org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:965)
at org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperation(DefaultCoordinateOperationFactory.java:243)
at org.geotools.referencing.operation.BufferedCoordinateOperationFactory.createOperation(BufferedCoordinateOperationFactory.java:254)
at org.geotools.geometry.TransformedDirectPosition.setSourceCRS(TransformedDirectPosition.java:203)
... 57 more
-----------------------------------
The workaround could be substituting this line of code in AbstractFeatureInfoResponse.execute method:
double[] pixelValues = coverage.evaluate(position, (double[]) null);
with this one:
double[] pixelValues = null;
if (requestedCRS != null) {
final CoordinateReferenceSystem targetCRS = coverage.getCoordinateReferenceSystem2D();
TransformedDirectPosition arbitraryToInternal = new TransformedDirectPosition(requestedCRS, targetCRS, new Hints(Hints.LENIENT_DATUM_SHIFT,Boolean.TRUE));
try {
arbitraryToInternal.transform(position);
} catch (TransformException exception) {
throw new CannotEvaluateException(exception.getLocalizedMessage());
}
Point2D point2D = arbitraryToInternal.toPoint2D();
pixelValues = coverage.evaluate(point2D, (double[]) null);
}
else
pixelValues = coverage.evaluate(position, (double[]) null);
This version allows to leverage on a LENIENT_DATUM_SHIFT Hint.
Daniele
Upping priority since it's a report with a patch included