Closed docgregt closed 5 years ago
The vector_wind_barbs.xml
style, is only compatible with a parent vector layer which contains 2 children - one representing magnitude, and one representing direction (this is what $layerName-mag
and $layerName-dir
represent. These particular child properties are created when a vector field is automatically detected). winddir
sounds like it is a single directional field, and so will not be compatible.
If it works with default-arrows
, I would recommend modifying that style. The reason there isn't already a simple direction-only wind barbs style is that wind barbs represent both magnitude and direction.
I modified it like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.1.0" xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:se="http://www.opengis.net/se" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:resc="http://www.resc.reading.ac.uk">
<NamedLayer>
<se:Name>hist/winddir</se:Name>
<UserStyle>
<se:CoverageStyle>
<se:Rule>
<resc:SizedArrowSymbolizer>
<se:Opacity>$opacity</se:Opacity>
<resc:ArrowSizeField>hist/windspd</resc:ArrowSizeField>
<resc:ArrowMinSize>4</resc:ArrowMinSize>
<resc:ArrowMaxSize>12</resc:ArrowMaxSize>
<resc:ArrowColour>#FF000000</resc:ArrowColour>
<resc:ArrowStyle>WIND_BARBS</resc:ArrowStyle>
<resc:Range>
<resc:Minimum>$scaleMin</resc:Minimum>
<resc:Maximum>$scaleMax</resc:Maximum>
<resc:Spacing>$logarithmic</resc:Spacing>
</resc:Range>
</resc:SizedArrowSymbolizer>
</se:Rule>
</se:CoverageStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
This follows the edal spec. Why doesnt it work?
I have copied and pasted that into a file named i4windbarbs.xml
in ~/.ncWMS2/.styles/
. I then started ncWMS, and added the last data file you sent me as hist
, and hit the URL:
I got a global image of wind barbs as expected. I'm using version ncWMS v2.4.2-SNAPSHOT, as seen on the admin page.
When I make the request: http://localhost:8080/ncWMS2/wms?REQUEST=GetMetadata&item=layerDetails&VERSION=1.3.0&LAYERNAME=hist/winddir
The returned document contains the following:
"supportedStyles": [
"default-arrows",
"default-scalar",
"arrows",
"colored_contours",
"contours",
"fat_arrows",
"i4windbarbs",
"meteorological_arrows",
"meteorological_fat_arrows",
"meteorological_triangle_arrows",
"raster",
"triangle_arrows",
"upstream_dots"
],
I'm afraid I have no idea why it is not working on your machine - everything you've done is correct and works perfectly on my installation.
Thanks for you time in checking it out. I have a couple questions: 1) Is this server is written in Java? 2) Is it self contained or does it depend on some global java libraries? 3) It seems to work differently on my windows than on linux so I am wondering if Java class path or different Java versions are affecting it?
One thing I would recommend doing would be copying a style verbatim, just giving it a different name in your .ncWMS2/.styles/
directory. If you are unable to use that style, it would suggest that the style directory is not being picked up correctly. The other thing to check is any output errors from your servlet container. If you're running the standalone version, they should be output on the command line, otherwise they will be logged to file somewhere. If you see anything there, paste the whole lot here (it might be rather long, but don't worry about that)
Also, I only have 2.4.1:
So it seems like you have the good stuff :) Where can I get 2.4.2 standalone?
Ok. Ignore my last. The 2.4.2 Snapshot is the one you sent me. I am unable to get that one to work with any of my data. So there must be some environmental issue affecting it. For example no matter what I do I cannot get the exact same file i sent you to work. It always looks like:
If for example i select the temperature layer then it renders in default colors but if I select the xSst colors then I get the following error: [Winstone 2019/03/21 16:59:13] - Untrapped Error in Servlet java.lang.NoSuchMethodError: org.opengis.referencing.datum.Ellipsoid.getAxisUnit()Ljavax/measure/Unit; at org.apache.sis.referencing.datum.DefaultEllipsoid.castOrCopy(DefaultEllipsoid.java:340) at org.apache.sis.internal.referencing.WKTUtilities.toFormattable(WKTUtilities.java:154) at org.apache.sis.referencing.datum.DefaultGeodeticDatum.formatTo(DefaultGeodeticDatum.java:617) at org.apache.sis.io.wkt.Formatter.append(Formatter.java:664) at org.apache.sis.referencing.crs.DefaultGeodeticCRS.formatTo(DefaultGeodeticCRS.java:202) at org.apache.sis.referencing.crs.DefaultGeographicCRS.formatTo(DefaultGeographicCRS.java:318) at org.apache.sis.io.wkt.Formatter.append(Formatter.java:664) at org.apache.sis.io.wkt.FormattableObject.formatWKT(FormattableObject.java:199) at org.apache.sis.io.wkt.FormattableObject.toString(FormattableObject.java:126) at uk.ac.rdg.resc.edal.geometry.BoundingBoxImpl.equals(BoundingBoxImpl.java:251) at uk.ac.rdg.resc.edal.graphics.utils.PlottingDomainParams.equals(PlottingDomainParams.java:160) at uk.ac.rdg.resc.edal.catalogue.DataCatalogue$CacheKey.equals(DataCatalogue.java:533) at net.sf.ehcache.store.chm.SelectableConcurrentHashMap$Segment.get(SelectableConcurrentHashMap.java:726) at net.sf.ehcache.store.chm.SelectableConcurrentHashMap.get(SelectableConcurrentHashMap.java:324) at net.sf.ehcache.store.MemoryStore.get(MemoryStore.java:326) at net.sf.ehcache.Cache.get(Cache.java:1723) at net.sf.ehcache.Cache.get(Cache.java:1696) at uk.ac.rdg.resc.edal.catalogue.DataCatalogue.getFeaturesForLayer(DataCatalogue.java:468) at uk.ac.rdg.resc.edal.graphics.style.GriddedImageLayer$MapFeatureDataReader.extractFeature(GriddedImageLayer.java:86) at uk.ac.rdg.resc.edal.graphics.style.GriddedImageLayer$MapFeatureDataReader.getFeature(GriddedImageLayer.java:77) at uk.ac.rdg.resc.edal.graphics.style.GriddedImageLayer$MapFeatureDataReader.getDataForLayerName(GriddedImageLayer.java:131) at uk.ac.rdg.resc.edal.graphics.style.RasterLayer.drawIntoImage(RasterLayer.java:73) at uk.ac.rdg.resc.edal.graphics.style.GriddedImageLayer.drawIntoImage(GriddedImageLayer.java:180) at uk.ac.rdg.resc.edal.graphics.style.ImageLayer.drawImage(ImageLayer.java:51) at uk.ac.rdg.resc.edal.graphics.style.MapImage.drawImage(MapImage.java:69) at uk.ac.rdg.resc.edal.wms.WmsServlet.getMap(WmsServlet.java:536) at uk.ac.rdg.resc.edal.wms.WmsServlet.dispatchWmsRequest(WmsServlet.java:368) at uk.ac.rdg.resc.edal.ncwms.NcwmsServlet.dispatchWmsRequest(NcwmsServlet.java:212) at uk.ac.rdg.resc.edal.wms.WmsServlet.doGet(WmsServlet.java:303) at javax.servlet.http.HttpServlet.service(HttpServlet.java:104) at javax.servlet.http.HttpServlet.service(HttpServlet.java:45) at winstone.ServletConfiguration.execute(ServletConfiguration.java:249) at winstone.RequestDispatcher.forward(RequestDispatcher.java:335) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:378) at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:168) at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:233) at winstone.FilterConfiguration.execute(FilterConfiguration.java:195) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368) at winstone.RequestDispatcher.forward(RequestDispatcher.java:333) at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244) at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150) at java.lang.Thread.run(Thread.java:748)
So I did as you said and just copied a standard sld file and renamed it. For some reason that worked. Then when I looked now my wind barb style is working also. I don't know what happened. I was able to get my wind speed looking exactly like I wanted also:
All of this is on 2.4.1. I cannot get 2.4.2 to work in a general way. Some things work, but mostly it doesn't work meaning the server spits out the exceptions as in my previous message. But also the grouping doesn't work for me. I don't know why it works for you. Thank you so much for your time as I know you are busy.
We can close this issue as 2.4.2 is a part of the other issue.
I created a new style which is just a copy of vector_wind_barbs.xml and made some minor tweaks and then place it in the .styles folder and then restarted ncWMS server. My sld file is called i4windbarbs.xml so in my WMS params I specified 'STYLES': 'i4windbarbs/default' I also tried: 'STYLES': 'i4windbarbs' I always get the error: 2019-03-20 16:05:47 WARN WmsServlet:2639 - Wms Exception caught: "The layer hist/winddir does not support the style i4windbarbs" from:uk.ac.rdg.resc.edal.wms.GetMapStyleParams:385
The layer works fine with 'STYLES': 'default-arrows/default' but I dont want arrows.
The get metadata query shows this: "supportedStyles": [ "default-arrows", "default-scalar", "arrows", "colored_contours", "contours", "fat_arrows", "meteorological_arrows", "meteorological_fat_arrows", "meteorological_triangle_arrows", "raster", "triangle_arrows", "upstream_dots" ], The documentation says: "Once you have created these templates, you may either place them in a subdirectory of the main config directory named .styles, or override the styleDirs context parameter, similar to the palettes directory above" But it does not work for me. How do I add a style so that it will be recognized or allowed with a layer?