[Geoserver-users] upload GDAL/NITF via REST - file extension in REST API?

Hello List,

I am trying to get a NITF image into Geoserver via REST. I use the (almost) current Geoserver 2.2 with the appropriate GDAL plugin. I can see the option to add a new raster data source in the NITF format via the web interface and I can also add NITF images that way. However, I want to use the rest interface and I ran accross a problem there.
First I create a new coverage store:
curl -u admin:geoserver -v -XPOST -H 'Content-Type: application/xml' -d '<coverageStore><name>testCurl</name><workspace>my_wms</workspace><enabled>true</enabled></coverageStore>' http://localhost:8080/geoserver/rest/workspaces/my_wms/coveragestores

which indeed creates a new coverage store. When I look at it in the list of stores (sorry, don't know if this is the correct translation, I have the UI in German and it says "Datenquellen"), the icon in the front is a yellow "!" in a triangle and the type is written as "?". I assume that's correct at this point. When I store a GeoTiff in such a coverage store via REST, it works.

Now I try to upload the actual NITF file:
curl -u admin:geoserver -v -XPUT -H 'Content-type: image/nitf' --data-binary @image.nitf 'http://localhost:8080/geoserver/rest/workspaces/my_wms/coveragestores/testCurl/file.worldimage?configure=first\\&amp;coverageName=testCurl&#39;

This results in a 500 error:
* Trying 127.0.0.1... connected
* Server auth using Basic with user 'admin'
  > PUT /geoserver/rest/workspaces/my_wms/coveragestores/testCurl/file.worldimage?configure=first\&coverageName=testCurl HTTP/1.1
  > Authorization: Basic YWRtaW46Z2Vvc2VydmVy
  > User-Agent: curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.0e zlib/1.2.5 c-ares/1.7.5 libidn/1.22 libssh2/1.2.9
  > Host: localhost:8080
  > Accept: */*
  > Content-type: image/nitf
  > Content-Length: 5336204
  > Expect: 100-continue
  >
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Server: Jetty(6.1.8)
* HTTP error before end of send, stop sending
<
* Closing connection #0

The geoserver log shows that this file is not supported as worldimage:
02 Nov 12:28:27 INFO [catalog.rest] - PUT file, mimetype: image/nitf
02 Nov 12:28:27 INFO [catalog.rest] - Using existing coverage store: testCurl
02 Nov 12:28:27 ERROR [geoserver.rest] - Error auto-configuring coverage:Unsupported file format
02 Nov 12:28:27 ERROR [geoserver.rest] -
org.geoserver.rest.RestletException: java.lang.IllegalArgumentException: Unsupported file format
          at org.geoserver.catalog.rest.CoverageStoreFileResource.handlePut(CoverageStoreFileResource.java:227)
          at org.restlet.Finder.handle(Finder.java:298)
          at org.geoserver.rest.BeanDelegatingRestlet.handle(BeanDelegatingRestlet.java:37)
          at org.restlet.Filter.doHandle(Filter.java:105)
          at org.restlet.Filter.handle(Filter.java:134)
          at org.restlet.Router.handle(Router.java:444)
          at org.geoserver.rest.RESTDispatcher$1.handle(RESTDispatcher.java:204)
          at com.noelios.restlet.ext.servlet.ServletConverter.service(ServletConverter.java:129)
          at org.geoserver.rest.RESTDispatcher.handleRequestInternal(RESTDispatcher.java:86)
          at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
          at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
          at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
          at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
          at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:800)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:730)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
          at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
          at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
          at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
          at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
          at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
          at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
          at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
          at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
          at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
          at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
          at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
          at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
          at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
          at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
          at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:53)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
          at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
          at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
          at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
          at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
          at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:82)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
          at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
          at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
          at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
          at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
          at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
          at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:97)
          at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
          at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
          at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
          at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
          at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
          at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
          at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
          at org.mortbay.jetty.Server.handle(Server.java:324)
          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
          at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
          at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
Caused by: java.lang.IllegalArgumentException: Unsupported file format
          at org.geotools.gce.image.WorldImageFormat.getWorldExtension(WorldImageFormat.java:328)
          at org.geotools.gce.image.WorldImageReader.prepareWorldImageGridToWorldTransform(WorldImageReader.java:703)
          at org.geotools.gce.image.WorldImageReader.getHRInfo(WorldImageReader.java:316)
          at org.geotools.gce.image.WorldImageReader.<init>(WorldImageReader.java:264)
          at org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:345)
          at org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:162)
          at org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:56)
          at org.geoserver.catalog.rest.CoverageStoreFileResource.handlePut(CoverageStoreFileResource.java:117)
          ... 79 more

As the REST API reference only states the three file extensions geotiff, worldimage and imagemosaic and none of these work, I assume that there exists another extension definition for NITF files. Either that or maybe the mimetype is not set as expected by Geoserver. I peeked in the source code but so far couldn't find anything helpful. Can anyone point me in the right direction for uploading NITF files via rest?

Thanks in advance for any responses.

Kind regards,
Daniel Haferkorn

--
Dipl.-Inform. (FH) Daniel Haferkorn
Fraunhofer Institut für Optronik, Systemtechnik und Bildauswertung IOSB
Abteilung Interoperabilität und Assistenzsysteme IAS
Fraunhoferstraße 1, 76131 Karlsruhe, Germany
Telefon +49 721 6091-431
mailto:daniel.haferkorn@anonymised.com
http://www.iosb.fraunhofer.de

Hello Daniel,
it seems the stores currently supported by Rest are only GeoTIFF, ImageMosaic and World Image files (Images like [PNG, JPEG, TIF] + WorldFile + PRJ) :
http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html#coverage-stores (see the extension table).

The NITF dataset is managed by a different format (the GDAL based one) which I don’t think is currently supported by REST.
Hope this helps.

Regards,
Daniele

···

On Tue, Nov 6, 2012 at 10:15 AM, Daniel Haferkorn <Daniel.Haferkorn@anonymised.com> wrote:

Hello List,

I am trying to get a NITF image into Geoserver via REST. I use the
(almost) current Geoserver 2.2 with the appropriate GDAL plugin. I can
see the option to add a new raster data source in the NITF format via
the web interface and I can also add NITF images that way. However, I
want to use the rest interface and I ran accross a problem there.
First I create a new coverage store:
curl -u admin:geoserver -v -XPOST -H ‘Content-Type: application/xml’ -d
‘testCurlmy_wmstrue’
http://localhost:8080/geoserver/rest/workspaces/my_wms/coveragestores

which indeed creates a new coverage store. When I look at it in the list
of stores (sorry, don’t know if this is the correct translation, I have
the UI in German and it says “Datenquellen”), the icon in the front is a
yellow “!” in a triangle and the type is written as “?”. I assume that’s
correct at this point. When I store a GeoTiff in such a coverage store
via REST, it works.

Now I try to upload the actual NITF file:
curl -u admin:geoserver -v -XPUT -H ‘Content-type: image/nitf’
–data-binary @image.nitf
http://localhost:8080/geoserver/rest/workspaces/my_wms/coveragestores/testCurl/file.worldimage?configure=first&coverageName=testCurl

This results in a 500 error:

  • Trying 127.0.0.1… connected
  • Server auth using Basic with user ‘admin’

PUT
/geoserver/rest/workspaces/my_wms/coveragestores/testCurl/file.worldimage?configure=first&coverageName=testCurl
HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0
OpenSSL/1.0.0e zlib/1.2.5 c-ares/1.7.5 libidn/1.22 libssh2/1.2.9
Host: localhost:8080
Accept: /
Content-type: image/nitf
Content-Length: 5336204
Expect: 100-continue

< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Server: Jetty(6.1.8)

  • HTTP error before end of send, stop sending
    <
  • Closing connection #0

The geoserver log shows that this file is not supported as worldimage:
02 Nov 12:28:27 INFO [catalog.rest] - PUT file, mimetype: image/nitf
02 Nov 12:28:27 INFO [catalog.rest] - Using existing coverage store:
testCurl
02 Nov 12:28:27 ERROR [geoserver.rest] - Error auto-configuring
coverage:Unsupported file format
02 Nov 12:28:27 ERROR [geoserver.rest] -
org.geoserver.rest.RestletException: java.lang.IllegalArgumentException:
Unsupported file format
at
org.geoserver.catalog.rest.CoverageStoreFileResource.handlePut(CoverageStoreFileResource.java:227)
at org.restlet.Finder.handle(Finder.java:298)
at
org.geoserver.rest.BeanDelegatingRestlet.handle(BeanDelegatingRestlet.java:37)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Router.handle(Router.java:444)
at
org.geoserver.rest.RESTDispatcher$1.handle(RESTDispatcher.java:204)
at
com.noelios.restlet.ext.servlet.ServletConverter.service(ServletConverter.java:129)
at
org.geoserver.rest.RESTDispatcher.handleRequestInternal(RESTDispatcher.java:86)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at
org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:800)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:730)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at
org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
at
org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
at
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
at
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:53)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
at
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
at
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at
org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:82)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
at
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at
org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:97)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
Caused by: java.lang.IllegalArgumentException: Unsupported file format
at
org.geotools.gce.image.WorldImageFormat.getWorldExtension(WorldImageFormat.java:328)
at
org.geotools.gce.image.WorldImageReader.prepareWorldImageGridToWorldTransform(WorldImageReader.java:703)
at
org.geotools.gce.image.WorldImageReader.getHRInfo(WorldImageReader.java:316)
at
org.geotools.gce.image.WorldImageReader.(WorldImageReader.java:264)
at
org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:345)
at
org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:162)
at
org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:56)
at
org.geoserver.catalog.rest.CoverageStoreFileResource.handlePut(CoverageStoreFileResource.java:117)
… 79 more

As the REST API reference only states the three file extensions geotiff,
worldimage and imagemosaic and none of these work, I assume that there
exists another extension definition for NITF files. Either that or maybe
the mimetype is not set as expected by Geoserver. I peeked in the source
code but so far couldn’t find anything helpful. Can anyone point me in
the right direction for uploading NITF files via rest?

Thanks in advance for any responses.

Kind regards,
Daniel Haferkorn


Dipl.-Inform. (FH) Daniel Haferkorn
Fraunhofer Institut für Optronik, Systemtechnik und Bildauswertung IOSB
Abteilung Interoperabilität und Assistenzsysteme IAS
Fraunhoferstraße 1, 76131 Karlsruhe, Germany
Telefon +49 721 6091-431
mailto:daniel.haferkorn@anonymised.com472…
http://www.iosb.fraunhofer.de


LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

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


Hello Daniel,
it seems the stores currently supported by Rest are only GeoTIFF, ImageMosaic and World Image files (Images like [PNG, JPEG, TIF] + WorldFile + PRJ) :
http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html#coverage-stores (see the extension table).

The NITF dataset is managed by a different format (the GDAL based one) which I don’t think is currently supported by REST.
Hope this helps.

It would be a good improvement though. Rather than hardcode file extensions to formats we could do it more dynamically by looking up all available coverage formats.

···

On Tue, Nov 6, 2012 at 10:15 AM, Daniel Haferkorn <Daniel.Haferkorn@anonymised.com> wrote:

Hello List,

I am trying to get a NITF image into Geoserver via REST. I use the
(almost) current Geoserver 2.2 with the appropriate GDAL plugin. I can
see the option to add a new raster data source in the NITF format via
the web interface and I can also add NITF images that way. However, I
want to use the rest interface and I ran accross a problem there.
First I create a new coverage store:
curl -u admin:geoserver -v -XPOST -H ‘Content-Type: application/xml’ -d
‘testCurlmy_wmstrue’
http://localhost:8080/geoserver/rest/workspaces/my_wms/coveragestores

which indeed creates a new coverage store. When I look at it in the list
of stores (sorry, don’t know if this is the correct translation, I have
the UI in German and it says “Datenquellen”), the icon in the front is a
yellow “!” in a triangle and the type is written as “?”. I assume that’s
correct at this point. When I store a GeoTiff in such a coverage store
via REST, it works.

Now I try to upload the actual NITF file:
curl -u admin:geoserver -v -XPUT -H ‘Content-type: image/nitf’
–data-binary @image.nitf
http://localhost:8080/geoserver/rest/workspaces/my_wms/coveragestores/testCurl/file.worldimage?configure=first&coverageName=testCurl

This results in a 500 error:

  • Trying 127.0.0.1… connected
  • Server auth using Basic with user ‘admin’

PUT
/geoserver/rest/workspaces/my_wms/coveragestores/testCurl/file.worldimage?configure=first&coverageName=testCurl
HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0
OpenSSL/1.0.0e zlib/1.2.5 c-ares/1.7.5 libidn/1.22 libssh2/1.2.9
Host: localhost:8080
Accept: /
Content-type: image/nitf
Content-Length: 5336204
Expect: 100-continue

< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Server: Jetty(6.1.8)

  • HTTP error before end of send, stop sending
    <
  • Closing connection #0

The geoserver log shows that this file is not supported as worldimage:
02 Nov 12:28:27 INFO [catalog.rest] - PUT file, mimetype: image/nitf
02 Nov 12:28:27 INFO [catalog.rest] - Using existing coverage store:
testCurl
02 Nov 12:28:27 ERROR [geoserver.rest] - Error auto-configuring
coverage:Unsupported file format
02 Nov 12:28:27 ERROR [geoserver.rest] -
org.geoserver.rest.RestletException: java.lang.IllegalArgumentException:
Unsupported file format
at
org.geoserver.catalog.rest.CoverageStoreFileResource.handlePut(CoverageStoreFileResource.java:227)
at org.restlet.Finder.handle(Finder.java:298)
at
org.geoserver.rest.BeanDelegatingRestlet.handle(BeanDelegatingRestlet.java:37)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Router.handle(Router.java:444)
at
org.geoserver.rest.RESTDispatcher$1.handle(RESTDispatcher.java:204)
at
com.noelios.restlet.ext.servlet.ServletConverter.service(ServletConverter.java:129)
at
org.geoserver.rest.RESTDispatcher.handleRequestInternal(RESTDispatcher.java:86)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at
org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:800)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:730)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at
org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
at
org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
at
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
at
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:53)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
at
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
at
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at
org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:82)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at
org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
at
org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at
org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:97)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
Caused by: java.lang.IllegalArgumentException: Unsupported file format
at
org.geotools.gce.image.WorldImageFormat.getWorldExtension(WorldImageFormat.java:328)
at
org.geotools.gce.image.WorldImageReader.prepareWorldImageGridToWorldTransform(WorldImageReader.java:703)
at
org.geotools.gce.image.WorldImageReader.getHRInfo(WorldImageReader.java:316)
at
org.geotools.gce.image.WorldImageReader.(WorldImageReader.java:264)
at
org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:345)
at
org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:162)
at
org.geotools.gce.image.WorldImageFormat.getReader(WorldImageFormat.java:56)
at
org.geoserver.catalog.rest.CoverageStoreFileResource.handlePut(CoverageStoreFileResource.java:117)
… 79 more

As the REST API reference only states the three file extensions geotiff,
worldimage and imagemosaic and none of these work, I assume that there
exists another extension definition for NITF files. Either that or maybe
the mimetype is not set as expected by Geoserver. I peeked in the source
code but so far couldn’t find anything helpful. Can anyone point me in
the right direction for uploading NITF files via rest?

Thanks in advance for any responses.

Kind regards,
Daniel Haferkorn


Dipl.-Inform. (FH) Daniel Haferkorn
Fraunhofer Institut für Optronik, Systemtechnik und Bildauswertung IOSB
Abteilung Interoperabilität und Assistenzsysteme IAS
Fraunhoferstraße 1, 76131 Karlsruhe, Germany
Telefon +49 721 6091-431
mailto:daniel.haferkorn@anonymised.com
http://www.iosb.fraunhofer.de


LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

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


On Mon, Nov 12, 2012 at 6:23 PM, Justin Deoliveira <jdeolive@anonymised.com> wrote:

On Mon, Nov 12, 2012 at 2:26 AM, Daniele Romagnoli <daniele.romagnoli@anonymised.com> wrote:

Hello Daniel,
it seems the stores currently supported by Rest are only GeoTIFF, ImageMosaic and World Image files (Images like [PNG, JPEG, TIF] + WorldFile + PRJ) :
http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html#coverage-stores (see the extension table).

The NITF dataset is managed by a different format (the GDAL based one) which I don’t think is currently supported by REST.
Hope this helps.

It would be a good improvement though. Rather than hardcode file extensions to formats we could do it more dynamically by looking up all available coverage formats.

Indeed, the problem I see is that Format has no way to tell you about a file extension, mostly
because file extensions are not used at all, normally we open the file and check the headers
to recognize a file, not look at its name.

One thing format has it’s “name”, but you would not get an extension, more something
like “GeoTIFF”, “DTED”, “ERDASImg” and so on (I don’t believe there is
any requirement not to have spaces in the name, although the practice seems
to be no spaces).

Another issue is being able to tell apart file formats from service based readers,
such as SDE, Oracle, PostGIS and so on.

One final glitch might be dealing with single file formats vs multifile formats.

Hmm… lots of fun it seems…

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

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


Thanks to the three of you for your responses. Indeed I was quite confused about the extension table in the documentation and thought, or should I say hoped, that the GDAL plugin would also extend the list of allowed extensions for the REST service. As this doesn't seem to be the case and I can't currently invest into adding such a functionality (although I would love to), I guess my only option now is to convert the NITF files to GeoTIFF prior to using the REST service.
Again, thanks for the clarifications!

Kind regards,
Daniel Haferkorn

--
Dipl.-Inform. (FH) Daniel Haferkorn
Fraunhofer Institut für Optronik, Systemtechnik und Bildauswertung IOSB
Abteilung Interoperabilität und Assistenzsysteme IAS
Fraunhoferstraße 1, 76131 Karlsruhe, Germany
Telefon +49 721 6091-431
mailto:daniel.haferkorn@anonymised.com
http://www.iosb.fraunhofer.de

Am 12.11.2012 18:34, schrieb Andrea Aime:

On Mon, Nov 12, 2012 at 6:23 PM, Justin Deoliveira <jdeolive@anonymised.com <mailto:jdeolive@anonymised.com>> wrote:

    On Mon, Nov 12, 2012 at 2:26 AM, Daniele Romagnoli
    <daniele.romagnoli@anonymised.com
    <mailto:daniele.romagnoli@anonymised.com>> wrote:

        Hello Daniel,
        it seems the stores currently supported by Rest are only
        GeoTIFF, ImageMosaic and World Image files (Images like [PNG,
        JPEG, TIF] + WorldFile + PRJ) :
        http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html#coverage-stores
        (see the extension table).

        The NITF dataset is managed by a different format (the GDAL
        based one) which I don't think is currently supported by REST.
        Hope this helps.

    It would be a good improvement though. Rather than hardcode file
    extensions to formats we could do it more dynamically by looking
    up all available coverage formats.

Indeed, the problem I see is that Format has no way to tell you about a file extension, mostly
because file extensions are not used at all, normally we open the file and check the headers
to recognize a file, not look at its name.

One thing format has it's "name", but you would not get an extension, more something
like "GeoTIFF", "DTED", "ERDASImg" and so on (I don't believe there is
any requirement not to have spaces in the name, although the practice seems
to be no spaces).

Another issue is being able to tell apart file formats from service based readers,
such as SDE, Oracle, PostGIS and so on.

One final glitch might be dealing with single file formats vs multifile formats.

Hmm... lots of fun it seems...

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

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

-------------------------------------------------------