Tuesday 11 October 2016

Putting piechart in of Geoserver style?


I reckon that GeoServer layer label style has excellent feature of TextSymbolizer where text label can be positioned relatively on centroid of VISIBLE PART of polygon, as oppose to a geographically fixed position. The GeoServer website states that can be specified in a .



With this kind of placement i also need to visualise piechart. This is where i found difficulties.


Here is my SLD, within the there's a piechart and a .



xmlns:sld="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.0.0">


test

test







xlink:href="http://chart?cht=p&chd=t:${100 * revenue_percentage},${100 * (1 - revenue_percentage)}&chf=bg,s,FFFFFF00" />
application/chart



20


revenue_target
2e13


60





PIECHART GRAPHIC



SansSerif
14
normal
bold



1




0.5
0.5











I found that:



  1. In order a graphic to show, text must be present in a . And the must not be empty. If is not wanted then the only getaway is to hide it with 0

  2. If is not wanted it is good to put a shortest possible string in the (for example a point ".") to make sure that element of the same are drawn.

  3. With in , GeoServer GUI complaints when i click the "Validate" button in Style Editor. The Style Editor says enter image description here while i believe and are optional. However, the style can be submitted and can be use with a WMS Layer without error.

  4. The piechart never showed up in WMS, and not even an error message from GeoServer (this is observed using FireBug, the request is fine and nothing is wrong).enter image description hereBy the way the expected piechart is below



enter image description here



  1. If I replace the piechart in with a PNG image then the PNG Images are drawn nicely in WMS response, off course with in the . The expected placement works. The also works, depending on value of a field. enter image description here Screenshot below is when i panned slightly to the west.enter image description here

  2. If I replace the with , the piechart shows. Surely if i panned the map, the piechart stay at the same geographic location. Unfortunately the extent in the above images do not cover centroid of polygon, hence the below screenshot uses different extent. Here's the screenshot:enter image description here


My questions:



  1. How to make the piechart in drawn in WMS response?

  2. Is this because doesn't like piechart ?



My environment:



  • GeoServer 2.5 (+Chart Extension) on Apache Tomcat 6.0.35

  • OpenLayers 2.12

  • PostgreSQL 9.2.4-1 + PostGIS 2.0.3-2

  • Windows Server 2003 32-bit




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...