HTMLImageMap GetMapProducer for GeoServer
USAGE
---------------------------
The HTMLImageMap GetMapProducer adds support for an additional output format for
WMS GetMap requests. The new format is associated to the "text/html" mime type
and produces an HTML 4.0 image map as defined by W3C.
Image Maps can be used to cut images in several areas. Each area can have a link,
title or alt attribute.
Request Example.
http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&Format=text/
html&request=GetMap&layers=topp:states&width=550&height=250&srs=EPSG:4326
Output Example.
Each single feature is rendered as one or more area tag. More than one area tag is
used if the geometry is not compatible with imagemaps constraints, and a split in
more simple geometries is needed.
An ID attribute is generated for each area tag. The ID is made up of two parts:
., where is the id of the feature containing the
geometry rendered in the tag. Sequence is a sequential number (0,1,2, ...) appended
to the id distinguishing different simple geometries in which the feature could have
been splitted.
Usage Example.
STYLING
----------------------------
A little bit of styling is supported through SLD symbolizers. In particular:
- TextSymbolizers are used to append attributes to the area tags. You can define a
Label, whose output will be rendered as an attribute value. By default, the
attribute name is "title" (this permits to define tooltips). You can define several
custom attributes, using different rules, the rule name will be used as attribute
name (eg.
...href......... defines
an href attribute, binding links to the rendered areas).
- LineSymbolizers stroke-width parameter is used to define a buffer along
linestrings (defaults to 2px if not defined).
- PointSymbolizers Size is used to define circle radius for rendered points
(currently only Marks with a WellKnownName of "circle" are
supported).
Examples.
1) Point with a label attached as title attribute ("ADDRESS: <...>"). The point is
rendered as 6px radius circle.
Default StylerDefault StylerFeaturetitleallcircle#0000ff61
2) LineStrings rendered with a buffer of 4px.
Default StylerDefault StylerFeaturetitleRoads4
3) GeometryCollection where LineStrings are rendered with a buffer of 4px,
points as circles with 6px radius, any geometry has an attribute href whose
value is given by the DESCRIPTION feature attribute.
Default StylerDefault StylerFeaturehrefall4circle#0000ff61
BUILD FROM SOURCE
---------------------------
1) Install JAVA SDK
Download and install the Java SDK.
Create an environment variable called JAVA_HOME and point it to your Java SDK
directory.
Then modify the PATH variable and add: ;%JAVA_HOME%/bin
Apply the changes.
2) Download and install Maven
Windows: http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-2.0.4.exe
Linux: http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-2.0.4.zip
If you are using Linux, execute the following commands:
export M2_HOME=/usr/java/maven-2.0.4
export PATH=$PATH:$M2_HOME/bin
3) Build Source Code
Go to the command line and navigate to the root of the source tree.
Execute the command:
mvn install
If it fails, just try again. It trys to download jars and some might not be
available at that time. So just keep trying.
DEPLOY THE GETMAPPRODUCER
---------------------------
1) copy target/htmlimagemap-*.jar to geoserver WEB-INF/lib.
2) restart geoserver.