Create a WorldImage store (see ortho_bg.png, and it’s .prj and .wld files), and then try to publish a layer from it.
You get the following in the stack dump:
Caused by: org.geotools.referencing.operation.projection.ProjectionException: Point outside hemisphere of projection. at org.geotools.referencing.operation.projection.ObliqueOrthographic.inverseTransformNormalized(ObliqueOrthographic.java:96) at org.geotools.referencing.operation.projection.MapProjection$Inverse.transform(MapProjection.java:1050) at org.geotools.referencing.operation.projection.MapProjection$Inverse.transform(MapProjection.java:1109) at org.geotools.referencing.operation.transform.AbstractMathTransform.transform(AbstractMathTransform.java:218) at org.geotools.referencing.CRS.transform(CRS.java:1391) at org.geotools.referencing.CRS.transform(CRS.java:1471) at org.geotools.referencing.CRS.transform(CRS.java:1299) at org.geoserver.data.util.CoverageStoreUtils.getWGS84LonLatEnvelope(CoverageStoreUtils.java:279) at org.geoserver.catalog.CatalogBuilder.buildCoverageInternal(CatalogBuilder.java:999) at org.geoserver.catalog.CatalogBuilder.buildCoverage(CatalogBuilder.java:944) at org.geoserver.catalog.CatalogBuilder.buildCoverage(CatalogBuilder.java:893) at org.geoserver.web.data.layer.NewLayerPage.buildLayerInfo(NewLayerPage.java:422) … 112 more
The problem is it’s trying to inverse project points that are outside of the map. It’s making assumptions that this projection obeys cyllindrical rules, and it can use the lower left and upper right corners to determine the lat/lon envelope. You can’t do this for an orthographic projection, as those points are not valid.
The simple fix is the following patch:
Index: main/src/main/java/org/geoserver/data/util/CoverageStoreUtils.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
— main/src/main/java/org/geoserver/data/util/CoverageStoreUtils.java (date 1539803792000)
+++ main/src/main/java/org/geoserver/data/util/CoverageStoreUtils.java (date 1539803792000)
@@ -274,9 +274,13 @@
//
////
final CoordinateReferenceSystem targetCRS = DefaultGeographicCRS.WGS84;
-
final GeneralEnvelope targetEnvelope;
- GeneralEnvelope targetEnvelope;
if (!CRS.equalsIgnoreMetadata(sourceCRS, targetCRS)) {
-
targetEnvelope = CRS.transform(envelope, targetCRS);
- try { + targetEnvelope = CRS.transform(envelope, targetCRS); + }
catch( TransformException e )
{ + targetEnvelope = new GeneralEnvelope(envelope); + }
} else
{ targetEnvelope = new GeneralEnvelope(envelope); }
What this does is look for a TransformException in the inverse envelope transform step, and if that’s found, return a general envelope (like all of the other error conditions). So far this works for me, but some guidance would be appreciated before this is considered for mainstream.
|