[Geoserver-users] Injecting style into WFS KML output

Hi,

Please excuse me as I am cross processing this with Stackoverflow. I’m new to GeoServer and am not sure where the best place to ask questions is.

I am setting up a GeoServer instance to host our geospatial data. One of the things I want to do is serve KML layers to display in GoogleEarth. GeoServer has two ways of doing this:

1. As part of a Web Map Service (WMS) where the polygons are turned to images or

2. As part of a WFS service where polygons are given as elements within the KML file.

I want to serve vector data as part of a WFS service so that people can interact with them.

I can do this with a URL like this:

http://****.com/geoserver/wfs?request=GetFeature&typeName=RBGE:Benmore_Beds&outputFormat=kml

but the resulting KML file has no styling in it so the polygons are represented as white blocks in GoogleEarth.

I can style the image outputs from my GeoServer using SLD - there is documentation on this but it only appears to effects KML image output (WMS) not KML vector output (WFS).

I have two questions:

1. Should the SLD definitions be translated into style markup in the WFS KML output? i.e. am I being dumb and missing some configuration setting somewhere

2. If it isn't possible to get GeoServer to insert the SLD definitions what is the best way to inject style into the KML file on route to Google Earth? I could write some kind of filter that used XSLT but that seems like hard work when other people must face the same problem.

I’d be most grateful for any help.

Many thanks,

Roger

-------------------------------------------------------------
Roger Hyam
Digital Information & Technology
Development Officer
r.hyam@anonymised.com<mailto:r.hyam@anonymised.com>
-------------------------------------------------------------
Royal Botanic Garden Edinburgh
20A Inverleith Row, Edinburgh, EH3 5LR, UK
Mobile: +44 759 060 8016
Fax: +44 131 248 2901
http://www.rbge.org.uk/
-------------------------------------------------------------

--
The Royal Botanic Garden Edinburgh is a charity registered in Scotland (No SC007983)

Hi list,

I've followed the tutorial http://docs.geoserver.org/2.5.x/en/user/tutorials/imagemosaic_timeseries/imagemosaic_timeseries.html to create an imagemosaic of time-related data. So far so good. I'm using postgis to store the index.
But when I try to add a new image to my imagemosaic, I can't get it to work. I'm trying to insert the image using the following curl command : curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d "file:///home/jean/tmp/20130101_SM.tif" "http://localhost:8081/geoserver/rest/workspaces/pigeo/coveragestores/SM_temporal/external.imagemosaic&quot;
Can't understand what goes wrong.
I'm using geoserver 2.5.2 hosted on a local tomcat7. Java is Oracle 1.7.0_67 64bits.

Looking at the logs( in verbose mode) I get :

2014-09-05 15:54:24,188 INFO [org.geotools.gce.imagemosaic] - Now indexing file 20130101_SM.tif
2014-09-05 15:54:24,189 DEBUG [org.geotools.gce.arcgrid] - ArcGridFormatFactory is availaible.
2014-09-05 15:54:24,189 DEBUG [org.geotools.gce.arcgrid] - Creating a new ArcGriFormat.
2014-09-05 15:54:24,190 DEBUG [org.geotools.gce.gtopo30] - Unrecognized file (file extension doesn't match)
java.io.IOException: Unrecognized file (file extension doesn't match)
     at org.geotools.gce.gtopo30.GTopo30Reader.<init>(GTopo30Reader.java:231)
     at org.geotools.gce.gtopo30.GTopo30Reader.<init>(GTopo30Reader.java:161)
     at org.geotools.gce.gtopo30.GTopo30Format.accepts(GTopo30Format.java:177)
     at org.geotools.coverage.grid.io.GridFormatFinder.findFormats(GridFormatFinder.java:188)
     at org.geotools.coverage.grid.io.GridFormatFinder.findFormat(GridFormatFinder.java:241)
     at org.geotools.gce.imagemosaic.ImageMosaicWalker.handleFile(ImageMosaicWalker.java:148)
     at org.geotools.gce.imagemosaic.ImageMosaicDirectoryWalker$MosaicDirectoryWalker.handleFile(ImageMosaicDirectoryWalker.java:98)
     at org.apache.commons.io.DirectoryWalker.walk(DirectoryWalker.java:367)
     at org.apache.commons.io.DirectoryWalker.walk(DirectoryWalker.java:335)
     at org.geotools.gce.imagemosaic.ImageMosaicDirectoryWalker$MosaicDirectoryWalker.<init>(ImageMosaicDirectoryWalker.java:114)
     at org.geotools.gce.imagemosaic.ImageMosaicDirectoryWalker.run(ImageMosaicDirectoryWalker.java:196)
     at org.geotools.gce.imagemosaic.ImageMosaicReader$HarvestedResource.harvestCalculation(ImageMosaicReader.java:405)
     at org.geotools.gce.imagemosaic.ImageMosaicReader$HarvestedResource.access$100(ImageMosaicReader.java:187)
     at org.geotools.gce.imagemosaic.ImageMosaicReader$HarvestedResource$1.harvest(ImageMosaicReader.java:202)
     at org.geotools.gce.imagemosaic.ImageMosaicReader.harvest(ImageMosaicReader.java:1250)
     at org.geoserver.catalog.CoverageDimensionCustomizerReader$CoverageDimensionCustomizerStructuredReader.harvest(CoverageDimensionCustomizerReader.java:115)
     at org.geoserver.catalog.rest.CoverageStoreFileResource.handlePost(CoverageStoreFileResource.java:89)
     at org.restlet.Finder.handle(Finder.java:296)
     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.doPost(FrameworkServlet.java:789)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:27)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
     at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:70)
     at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:70)
     at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     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.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)
     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:134)
     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:75)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:48)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:47)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:43)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
     at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
     at java.lang.Thread.run(Thread.java:722)
2014-09-05 15:54:24,193 DEBUG [org.geotools.referencing.factory] - Échec dans la fabrique primaire: Aucun code "EPSG:4326" de l'autorité "European Petroleum Survey Group" n'a été trouvé pour un objet de type "IdentifiedObject". La fabrique secondaire sera interrogée.
2014-09-05 15:54:24,193 DEBUG [org.geotools.coverage.grid.io.imageio.geotiff] - Logging tiePoints:
Tie point
     Raster Space point (0.0, 0.0, 0.0)
     Model Space point (-12.242570219767783, 25.00004829999998, 0.0)
Logging pixScales:
Pixel Scale
     scaleX=0.008928571400000005 is set? true
     scaleY=0.008928571400000003 is set? true
     scaleZ=1.0 is set? true

2014-09-05 15:54:24,193 DEBUG [org.geotools.gce.imagemosaic] - Nothing to process!!!
2014-09-05 15:54:27,957 ERROR [org.geotools.jdbc] - There's code using JDBC based datastore and not disposing them. This may lead to temporary loss of database connections. Please make sure all data access code calls DataStore.dispose() before freeing all references to it
2014-09-05 15:54:27,957 WARN [org.geotools.gce.imagemosaic.catalog] - This granule catalog was not properly dispose as it still points to:ServiceInfo
  description=Features from JDBCDataStore

So it seems it finds the image, but tries to read it as gtopo30 ? Why ?
Any idea what I did wrong ?

Thanks,

Jean

Hello, Roger.

Yes, you can style all the KML output.

Open up this link to data published by the Geological Survey of NSW (Australia) …
http://dwh.minerals.nsw.gov.au/CI/kml-gsnsw.php
When you zoom into a small area, the place marks for the point layers (eg. Drill holes) are a variety of shapes, colours and borders.

The link creates the KML that generates many network links to Geoserver in the left pane of Google Earth. You can look at the properties of each network link to see the type of Geoserver URL that we have used. For example, look at the drill holes layers. We use the ‘kmscore’ parameter so that a .PNG file is sent when there are many points, but data is sent when there are fewer points (and thus GE place marks).

Since you are new to Geoserver, I suggest you install the CSS Styling module - this much easier than SLD. Read the CSS Styling part of the Geoserver manual for instruction.

We also use FTL files to specify a PHP report to appear in the pop-up when you click on the place mark. This can include photos and potentially videos. Google ‘KML and Geoserver’ - you should find a couple of articles.

Regards,
David Collins
Senior Geoscientist
Geological Survey of NSW

On Sep 5, 2014 7:51 PM, “Roger Hyam” <R.Hyam@anonymised.com> wrote:

Hi,

Please excuse me as I am cross processing this with Stackoverflow. I’m new to GeoServer and am not sure where the best place to ask questions is.

I am setting up a GeoServer instance to host our geospatial data. One of the things I want to do is serve KML layers to display in GoogleEarth. GeoServer has two ways of doing this:

  1. As part of a Web Map Service (WMS) where the polygons are turned to images or

  2. As part of a WFS service where polygons are given as elements within the KML file.

I want to serve vector data as part of a WFS service so that people can interact with them.

I can do this with a URL like this:

http://****.com/geoserver/wfs?request=GetFeature&typeName=RBGE:Benmore_Beds&outputFormat=kml

but the resulting KML file has no styling in it so the polygons are represented as white blocks in GoogleEarth.

I can style the image outputs from my GeoServer using SLD - there is documentation on this but it only appears to effects KML image output (WMS) not KML vector output (WFS).

I have two questions:

  1. Should the SLD definitions be translated into style markup in the WFS KML output? i.e. am I being dumb and missing some configuration setting somewhere

  2. If it isn’t possible to get GeoServer to insert the SLD definitions what is the best way to inject style into the KML file on route to Google Earth? I could write some kind of filter that used XSLT but that seems like hard work when other people must face the same problem.

I’d be most grateful for any help.

Many thanks,

Roger


Roger Hyam
Digital Information & Technology
Development Officer
r.hyam@anonymised.commailto:[r.hyam@anonymised.com](mailto:r.hyam@anonymised.com)

Royal Botanic Garden Edinburgh
20A Inverleith Row, Edinburgh, EH3 5LR, UK
Mobile: +44 759 060 8016
Fax: +44 131 248 2901
http://www.rbge.org.uk/


The Royal Botanic Garden Edinburgh is a charity registered in Scotland (No SC007983)


Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/


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