[OpenLayers-Users] Multiple KML Placemarks, selective styling. Performance?
Andreas Schnieders
schnieders.a at gmail.com
Tue Sep 4 03:00:27 PDT 2012
Hi there,
I'm generating a KML-structure from a jsp consisting of three Placemarks:
- 1 Placemark for an Icon (Point)
- 1 Placemark for a LineString-vector pointing from the centre of the icon
to a Point nearby
- 1 Placemark for a MultiGeometry meant to draw "dots" leading away from
the icon
To this state of development I have one stylemap defining an
externalGraphic for the icon and colors for the LineString etc. The icon is
defined in a "symbol"-attribute inside the generated KML-Structure
<Placemark>
<id><%=id%></id>
<name><%=name%></name>
<symbol><%=symbol%></symbol>
.
.
.
<Point>
<coordinates><%=lon%>, <%=lat%>, 0</coordinates>
</Point>
</Placemark>
<Placemark>
<name><%=name%></name>
.
.
.
<LineString>
<coordinates> <%=lon%>, <%=lat%>, 0
<%=lonEnd%>, <%=latEnd%>, 0 </coordinates>
</LineString>
</Placemark>
<Placemark>
<MultiGeometry>
<Point>
<coordinates>
<%=blah.getLongitude()%>,
<%=blah.getLatitude()%>
</coordinates>
</Point>
...
<Point>
<coordinates>
<%=blah.getLongitude()%>,
<%=blah.getLatitude()%>
</coordinates>
</Point>
</MultiGeometry>
</Placemark>
I now want to specify:
- externalGraphic for the Point of the first Placemark,
- colors for the LineString in the second Placemark, AND
- just a simple color and radius for the Points of the MultiGeometry of the
third Placemark
This is working fine for now, not using the third Placemark:
styler = OpenLayers.Util.applyDefaults(
{strokeColor: "#606860",
strokeWidth: 1.5,
fillColor: "#FF5500",
externalGraphic: 'gfx/${symbol}.png',
graphicOpacity: 1,
fillOpacity: 1,
pointRadius: 9,
pointerEvents: "visiblePainted",
label : "${name}",
fontColor: "#606860",
fontSize: "10px",
fontFamily: "Verdana, monospace",
labelAlign: "CENTER",
labelXOffset: "0",
labelYOffset: "-18",
labelOutlineWidth: 0},
OpenLayers.Feature.Vector.style["default"]);
styleMap = new OpenLayers.StyleMap( {"default": styler, "select":
{externalGraphic: 'gfx/${symbol}.selected.png'} } );
But when I'm introducing the third Placemark mentioned above, no $(symbol)
or $(name) etc. is specified for the Points of the MultiGeometry resulting
in "undefined"-errors - of course. How do I manage to "just" set radius and
colors for the Points of the third Placemark? Can I specify something like
an "Placemark-Class" and use this in OpenLayers to only apply certain
stylemaps to certain Placemark-Classes?
And what do you think about performance? The number of Points inside the
MultiGeometry can easily increase up to tens or even hundreds. And I'll
have to expect around 300 of these Tripple-Placemark-Structures.
300*(1Point + 1LineString + nPointsOfMultiGeometry) = ??? too many?
Would you rather consider drawing the dots by OpenLayers built in
geometries?
Any other approaches to consider?
Many thanks in advance!
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120904/7eaab346/attachment.html>
More information about the Users
mailing list