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:
- 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 with0 - 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. - With
in
, GeoServer GUI complaints when i click the "Validate" button in Style Editor. The Style Editor says while i believe
and
are optional. However, the style can be submitted and can be use with a WMS Layer without error. - 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).By the way the expected piechart is below
- 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. Screenshot below is when i panned slightly to the west. - 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:
My questions:
- How to make the piechart
in
drawn in WMS response? - 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