Dear Dave,
first of all one unrelated thing, if you don't have kakadu around
which meamsn you are either using Jasper (clib available) or JJ2000
(no clib, going pure java) performance will be bad.
Bad as in "you really don't want to do it".

That said, I agree with you that portion of the code should be
improved, I believe setCoverageProperties should be called in any case
so no else clause.
The point is that you can either override the internal info or provide
missing CRS via HINTS or PRJ  and worldfile for the envelope.

I believe you can make this simple change and add a few tests to verify.

Regards,
Simone Giannecchini
==
GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.
==
Ing. Simone Giannecchini
@simogeo
Founder/Director

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272
mob:   +39  333 8128928

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate.
Il loro utilizzo è consentito esclusivamente al destinatario del
messaggio, per le finalità indicate nel messaggio stesso. Qualora
riceviate questo messaggio senza esserne il destinatario, Vi preghiamo
cortesemente di darcene notizia via e-mail e di procedere alla
distruzione del messaggio stesso, cancellandolo dal Vostro sistema.
Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità
diverse, costituisce comportamento contrario ai principi dettati dal
D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely
for the attention and use of the named addressee(s) and may be
confidential or proprietary in nature or covered by the provisions of
privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New
Data Protection Code).Any use not in accord with its purpose, any
disclosure, reproduction, copying, distribution, or either
dissemination, either whole or partial, is strictly forbidden except
previous formal approval of the named addressee(s). If you are not the
intended recipient, please contact immediately the sender by
telephone, fax or e-mail and delete the information in this message
that has been received in error. The sender does not give any warranty
or accept liability as the content, accuracy or completeness of sent
messages and accepts no responsibility  for changes made after they
were sent or for other risks which arise as a result of e-mail
transmission, viruses, etc.


On Wed, Aug 3, 2016 at 11: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

------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to