Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.7.0-beta1
-
Fix Version/s: None
-
Component/s: Google Earth KML Output
-
Labels:None
Description
The KML returned by GeoServer can be in two forms: Placemark or Overlay elements. The Overlay element displays scaled point graphics as described by the SLD, but the Placemark elements are not scaled and all placemark elements are the same size.
(i.e. the KML is missing the <IconStyle><scale> tag that would scale the placemark)
Here is an example SLD that returns a variable size point symbol...
<?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">
<!-- a named layer is the basic building block of an sld document -->
<NamedLayer>
<Name>Object Tracking Style</Name>
<UserStyle>
<!-- they have names, titles and abstracts -->
<Title>Object Tracking Style</Title>
<Abstract>A style that symbolizes point objects that are being tracked</Abstract>
<!-- FeatureTypeStyles describe how to render different features -->
<!-- a feature type for points -->
<FeatureTypeStyle>
<!-FeatureTypeName>Feature</FeatureTypeName->
<Rule>
<Name>Rule Default</Name>
<Title>Default Rule</Title>
<Abstract>Default Rule</Abstract>
<!-- like a linesymbolizer but with a fill too -->
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:type="simple" xlink:href="http://maps.google.com/mapfiles/kml/shapes/donut.png" />
<Format>image/png</Format>
</ExternalGraphic>
<Mark>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
<CssParameter name="fill-opacity">1.0</CssParameter>
</Fill>
</Mark>
<Size>
<ogc:Mul>
<ogc:PropertyName>location_horiz_error</ogc:PropertyName>
<ogc:Literal>0.1</ogc:Literal>
</ogc:Mul>
</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Here is an example KML that is returned by geoserver (that is missing a <scale> element...
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>KmlFile</name>
<Style id="GeoServerStylev_observation.nfm-e769109_11aa6554706_-5628">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/shapes/donut.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark id="v_observation.nfm-e769109_11aa6554706_-5628">
<description><![CDATA[<h4>v_observation</h4>
<ul class="textattributes">
<li><strong><span class="atr-name">observation_id</span>:</strong> <span class="atr-value">1904</span></li>
<li><strong><span class="atr-name">datestamp</span>:</strong> <span class="atr-value">6/19/08 12:01 AM</span></li>
<li><strong><span class="atr-name">location_horiz_error</span>:</strong> <span class="atr-value">500.0</span></li>
<li><strong><span class="atr-name">location_vert</span>:</strong> <span class="atr-value"></span></li>
<li><strong><span class="atr-name">location_vert_error</span>:</strong> <span class="atr-value"></span></li>
<li><strong><span class="atr-name">direction</span>:</strong> <span class="atr-value"></span></li>
<li><strong><span class="atr-name">speed</span>:</strong> <span class="atr-value"></span></li>
<li><strong><span class="atr-name">observation_type_no</span>:</strong> <span class="atr-value">0</span></li>
<li><strong><span class="atr-name">temp_object_id</span>:</strong> <span class="atr-value">1</span></li>
</ul>]]></description>
<LookAt>
<longitude>6.83558117478245</longitude>
<latitude>4.60914294994307</latitude>
<altitude>0</altitude>
<range>700</range>
<tilt>10</tilt>
<heading>10</heading>
</LookAt>
<TimeStamp><when>2008-06-19T00:01:00-04:00</when>
</TimeStamp>
<styleUrl>#GeoServerStylev_observation.nfm-e769109_11aa6554706_-5628</styleUrl>
<Point>
<coordinates>6.83558117,4.60914295,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
I think what you are saying is that icons are always 32 pixels wide (scale slightly as you zoom in) ?
Google actually deprecated the support for specifying the icon size, so the only way I know is to make 32x32 transparent PNGs (I recommend 8 bit, it doesn't do the alpha channel properly) and just use the center of the image if you want something smaller.