Hello,
I'm working on a project that has gridded weather data, stored in a postgis
database. The database isn't really doing anything special with it, just
entering one record (including a geometry column) for each cell in the
grid. For hi-resolution weather information, this means that it can
produce a large number of records.
Until now, we have been using WFS to filter and retrieve the regions that
we want and draw the results in our OpenLayers based web interface. We
have javascript code that sets the color for each small polygon based on
the value of another attribute of each feature. For one example, this
could be percentage likelihood of precipitation or other weather. The end
result basically looks like a heat map with higher percent regions having a
more intense color than the lower percentage areas.
As I mentioned though the dataset and be quite large. Unless you are
filtering down to a pretty small area, then the query and rendering just
takes too long. So the last couple days I've been experimenting with
retrieving the data as a WMS layer instead of a WFS/vector layer. The
results are promising. The data is properly filtered and returns much
faster. (I beleive this is because its just returning a fixed 256x256
image that does not need to grow in size like the raw WFS/GML would). The
only problem is I can't figure out how to color it properly. By default,
it was using the red point style and it all returned red. I tried other
raster based styles, but since my data was not truly returned as raster, it
failed (at least I assume that is why it failed).
I then came across the vector-to-raster based heatmap style that could be
applied via WPS. I installed the extension and tried the gs:heatmap as
explained here:
http://docs.geoserver.org/stable/en/user/styling/sld-extensions/rendering-transform.html
I made a couple adjustments to fit my schema and gridval values (between 50
and 100) and assigned some random colors. It does not throw any
exceptions, but I also do not see any colors showing up on my map. I have
attached the style definition that I'm currently trying to use.
As you have probably guessed, a lot of these concepts are still pretty new
to me. I'd appreciate any tips that any of you might have to help me
figure this out.
Thanks!
Jeremy
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>Heatmap</Name>
<UserStyle>
<Title>Heatmap</Title>
<Abstract>A heatmap surface showing weather forecast</Abstract>
<FeatureTypeStyle>
<Transformation>
<ogc:Function name="gs:Heatmap">
<ogc:Function name="parameter">
<ogc:Literal>data</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>weightAttr</ogc:Literal>
<ogc:Literal>gridval</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>radiusPixels</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>radius</ogc:Literal>
<ogc:Literal>10</ogc:Literal>
</ogc:Function>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>pixelsPerCell</ogc:Literal>
<ogc:Literal>1</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>outputBBOX</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>wms_bbox</ogc:Literal>
</ogc:Function>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>outputWidth</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>wms_width</ogc:Literal>
</ogc:Function>
</ogc:Function>
<ogc:Function name="parameter">
<ogc:Literal>outputHeight</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>wms_height</ogc:Literal>
</ogc:Function>
</ogc:Function>
</ogc:Function>
</Transformation>
<Rule>
<RasterSymbolizer>
<!-- specify geometry attribute to pass validation -->
<Geometry>
<ogc:PropertyName>geom</ogc:PropertyName></Geometry>
<Opacity>0.6</Opacity>
<ColorMap type="ramp" >
<ColorMapEntry color="#FFFFFF" quantity="0" label="nodata"
opacity="0"/>
<ColorMapEntry color="#4444FF" quantity="25" label="nodata"/>
<ColorMapEntry color="#FF0000" quantity="50" label="values" />
<ColorMapEntry color="#00FF00" quantity="75" label="values" />
<ColorMapEntry color="#FFFF00" quantity="100" label="values" />
</ColorMap>
</RasterSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users