custom description in KML-output
--------------------------------
Key: GEOS-963
URL: http://jira.codehaus.org/browse/GEOS-963
Project: GeoServer
Issue Type: Improvement
Components: Google Earth KML Output
Reporter: Daniel Reinert
Assigned To: Andrea Aime
Priority: Minor
Fix For: 1.5.x
Attachments: KMLWriter.java
Hello,
I would like to be able to customize the description text in the kml-output.
For me the easiest way to do that would be a special attribute, that when present delivers the description.
If the attribute is not present or null the default description is used.
I changed the sourcecode for the method org.vfny.geoserver.wms.responses.map.kml.KMLWriter.makeDescription for my local geoserver.
For me it works fine but maybe others would like to have this feature, too.
The name of the special attribute is "htmldesc". If this attribute is present and not null it overwrites the normal description text in kml-output.
The changes are like this:
private void makeDescription(Feature feature, final FeatureType schema, final StringBuffer description) {
if (mapContext.getRequest().getKMattr()) {
boolean hasHTMLDescription = false;
final int attrCount = schema.getAttributeCount();
AttributeType types = schema.getAttributeTypes();
for (int j = 0; j < attrCount; j++)
if (schema.getAttributeType(j).getName().equals("htmldesc")) {
String text = "" + feature.getAttribute(types[j].getName());
if (!text.equals("null")) {
hasHTMLDescription = true;
description.append(text);
}
}
if (!hasHTMLDescription) {
......
I have attached the KMLWriter.java file. (Changes are based on the 1.5.X sources)
Thank you for this fantastic geoserver!
Daniel Reinert
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira