[Geoserver-devel] [jira] Created: (GEOS-3519) The UI allows to set the declared CRS of a resource to one that the native CRS can't be projected to

The UI allows to set the declared CRS of a resource to one that the native CRS can't be projected to
----------------------------------------------------------------------------------------------------

                 Key: GEOS-3519
                 URL: http://jira.codehaus.org/browse/GEOS-3519
             Project: GeoServer
          Issue Type: Bug
          Components: Wicket UI
            Reporter: Gabriel Roldán
            Assignee: Andrea Aime

To reproduce, get a layer that's natively in {{EPSG:4326}} and set it's declared CRS to {{EPSG:4328}}. Set the SRS handling policy to "reproject" and save the resource/layer.
No warn is made and the resource is saved.
Then go to the layer preview page and try to open the OpenLayers preview for the layer. The link will lead to the welcome screen instead of the openlayers preview, and the browser's address bar will contain: {{http://localhost:8080/geoserver/web/null&format=application/openlayers\}}.
The following exception will be logged:
{code}
INFO [web.dem] - Could not set figure out automatically a good preview link for sigma:countries
java.lang.RuntimeException: org.opengis.referencing.operation.OperationNotFoundException: No transformation available from system "CartesianCS[Geocentric]" to "CartesianCS[Earth centred, earth fixed, righthanded 3D coordinate system, consisting of 3 (...) positive Z-axis parallel to mean earth rotation axis and pointing towards North Pole. UoM: m.]".
  at org.geoserver.wms.DefaultWebMapService.autoSetBoundsAndSize(DefaultWebMapService.java:331)
  at org.geoserver.web.demo.PreviewLayer.getRequest(PreviewLayer.java:134)
  at org.geoserver.web.demo.PreviewLayer.getWmsLink(PreviewLayer.java:172)
  at org.geoserver.web.demo.MapPreviewPage$1.getComponentForProperty(MapPreviewPage.java:72)
...
Caused by: org.opengis.referencing.operation.OperationNotFoundException: No transformation available from system "CartesianCS[Geocentric]" to "CartesianCS[Earth centred, earth fixed, righthanded 3D coordinate system, consisting of 3 (...) positive Z-axis parallel to mean earth rotation axis and pointing towards North Pole. UoM: m.]".
  at org.geotools.referencing.operation.AbstractCoordinateOperationFactory.swapAndScaleAxis(AbstractCoordinateOperationFactory.java:278)
  at org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:1041)
  at org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperationStep(DefaultCoordinateOperationFactory.java:1136)
  at org.geotools.referencing.operation.DefaultCoordinateOperationFactory.createOperation(DefaultCoordinateOperationFactory.java:247)
  at org.geotools.referencing.operation.BufferedCoordinateOperationFactory.createOperation(BufferedCoordinateOperationFactory.java:254)
  at org.geotools.geometry.jts.ReferencedEnvelope.transform(ReferencedEnvelope.java:623)
  at org.geotools.geometry.jts.ReferencedEnvelope.transform(ReferencedEnvelope.java:579)
  at org.geoserver.catalog.impl.ResourceInfoImpl.boundingBox(ResourceInfoImpl.java:201)
  at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
  at org.geoserver.catalog.impl.ModificationProxy.invoke(ModificationProxy.java:113)
  at $Proxy11.boundingBox(Unknown Source)
  at org.geoserver.wms.MapLayerInfo.getBoundingBox(MapLayerInfo.java:124)
  at org.geoserver.wms.DefaultWebMapService.autoSetBoundsAndSize(DefaultWebMapService.java:319)
  ... 97 more
Caused by: java.lang.IllegalArgumentException: No source axis match GEOCENTRIC_X.
  at org.geotools.referencing.operation.matrix.GeneralMatrix.<init>(GeneralMatrix.java:314)
  at org.geotools.referencing.operation.matrix.GeneralMatrix.<init>(GeneralMatrix.java:221)
  at org.geotools.referencing.cs.AbstractCS.swapAndScaleAxis(AbstractCS.java:331)
  at org.geotools.referencing.operation.AbstractCoordinateOperationFactory.swapAndScaleAxis(AbstractCoordinateOperationFactory.java:276)
  ... 111 more
{code}

Looks like we should check there's a transformation from native to declared CRS iif the srs handling policy is reproject and at least notify the user before saving, or even not allowing such a combination.
(leaving asignee to be Andrea just to notice, feel free to reasign to me)

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira