Oh, FYI - if you use this .prj;
https://github.com/geotools/geotools/blob/master/modules/plugin/jp2k/src/test/resources/org/geotools/coverageio/jp2k/test-data/bogota.prj it does work correctly. This one explicitly says this is crs is EPSG:21892. The layer then picks it up as EPSG:21892 and everything works. Thanks, Dave On Wed, Aug 3, 2016 at 2:45 PM, Dave Blasby <dbla...@boundlessgeo.com> wrote: > Hi, I'm trying to load the test-case jp2k file into geoserver using > the jp2k driver (no native libraries). > > 1. using the test cases data bogata.jp2 > > https://github.com/geotools/geotools/blob/master/modules/plugin/jp2k/src/test/resources/org/geotools/coverageio/jp2k/test-data/bogota.jp2 > > 2. .proj is this (created by qgis); > > PROJCS["Bogota 1975 / Colombia Bogota zone > (deprecated)",GEOGCS["Bogota > 1975",DATUM["D_Bogota",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",4.599047222222222],PARAMETER["central_meridian",-74.08091666666667],PARAMETER["scale_factor",1],PARAMETER["false_easting",1000000],PARAMETER["false_northing",1000000],UNIT["Meter",1]] > > 3. .j2w is (created by qgis); > > 60 > 0 > 0 > -60 > 440750 > 99970 > > > I load this into geoserver, and try to publish the layer. I need to > set the declared SRS as EPSG:21892 (SRS handling: Force declared). > When I save, I get an error. This is because the bounds of the > dataset isn't set (stack trace below). > > > I tracked this down to around line 500 in JP2KReader > https://github.com/geotools/geotools/blob/master/modules/plugin/jp2k/src/main/java/org/geotools/coverageio/jp2k/JP2KReader.java > > > > // > // get the crs if able to > // > // // > final Object tempCRS = > this.hints.get(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM); > if (tempCRS != null) { > this.crs = (CoordinateReferenceSystem) tempCRS; > LOGGER.log(Level.WARNING, "Using forced coordinate > reference system "+crs.toWKT()); > } else { > > setCoverageProperties(reader); > > if (crs == null) { > throw new DataSourceException("Unable to find a CRS > for this coverage, using a default one: " > + crs.toWKT()); > } > } > > > > When the layer is first loaded, the > DEFAULT_COORDINATE_REFERENCE_SYSTEM hint gives null and > setCoverageProperties() will read the .prj and .j2w world file. > > However, when you set the declared SRS as EPSG:21892 (on the UI), the > hint has the EPSG:21892 CRS. This means that setCoverageProperties() > will not be called and the originalEnvelope (line 166) isn't set. > > I'm not sure what the fix is - but it appears that the top block > should also read the world file. I expect a fix would be to refactor > setCoverageProperties() to take in a crs (either from the UI - via the > hint - or via the .prj file). > > However, I'm not sure if this will work in all cases... > > > Thanks, > Dave > > > > 03 Aug 14:32:29 INFO [geoserver.web] - Error saving layer > java.lang.IllegalArgumentException: Argument "envelope" should not be null. > at > org.geotools.geometry.GeneralEnvelope.ensureNonNull(GeneralEnvelope.java:339) > at org.geotools.geometry.GeneralEnvelope.<init>(GeneralEnvelope.java:212) > at > org.geotools.coverage.grid.io.AbstractGridCoverage2DReader.getOriginalEnvelope(AbstractGridCoverage2DReader.java:869) > at > org.geotools.coverage.grid.io.AbstractGridCoverage2DReader.getOriginalEnvelope(AbstractGridCoverage2DReader.java:855) > at org.geotools.coverageio.jp2k.RasterManager.<init>(RasterManager.java:430) > at org.geotools.coverageio.jp2k.JP2KReader.<init>(JP2KReader.java:515) > at org.geotools.coverageio.jp2k.JP2KFormat.getReader(JP2KFormat.java:123) > at > org.geoserver.catalog.ResourcePool.getGridCoverageReader(ResourcePool.java:1441) > at > org.geoserver.catalog.ResourcePool.getGridCoverageReader(ResourcePool.java:1342) > at > org.geoserver.catalog.impl.CoverageInfoImpl.getGridCoverageReader(CoverageInfoImpl.java:164) > at > org.geoserver.web.data.resource.ResourceConfigurationPage.doSaveInternal(ResourceConfigurationPage.java:209) > at > org.geoserver.web.publish.PublishedConfigurationPage.doSave(PublishedConfigurationPage.java:255) > at > org.geoserver.web.publish.PublishedConfigurationPage$6.onSubmit(PublishedConfigurationPage.java:241) > at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1307) > at org.apache.wicket.markup.html.form.Form.process(Form.java:974) > at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:795) > at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:708) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:497) > at > org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258) > at > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216) > at > org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:241) > at > org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234) > at > org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865) > at > org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) > at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) > at > org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) > at > org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) > at > org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261) > at > org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203) > at > org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:159) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) > at > org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:158) > at > org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:147) > at > org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) > at > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) > at > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) > at > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968) > at > org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:870) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) > at > org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) > at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) > at > org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:28) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at > org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:75) > at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:71) > at > org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:71) > at > org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:46) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at > org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:50) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > at > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) > at > org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:54) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > at > org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > at > org.geoserver.security.filter.GeoServerUserNamePasswordAuthenticationFilter.doFilter(GeoServerUserNamePasswordAuthenticationFilter.java:116) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > at > org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:157) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) > at > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91) > at > org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:53) > at > org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73) > at > org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) > at > org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213) > at > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176) > at > org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:152) > at > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) > at > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:87) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:42) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at > org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:48) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:44) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at > org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) > at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) > at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) > at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) > at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) > at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) > at > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) > at org.eclipse.jetty.server.Server.handle(Server.java:499) > at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) > at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) > at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) > at > org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) > at java.lang.Thread.run(Thread.java:745) ------------------------------------------------------------------------------ _______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel