I have been learning how to create a vector layer to show points. My
point symbol is
var layer_style = OpenLayers.Util.extend(
{}, OpenLayers.Feature.Vector.style['default']
);
layer_style.fillOpacity = 0.2;
layer_style.graphicOpacity = 1;
/* Circle */
var style_blue = OpenLayers.Util.extend(
{}, layer_style
);
style_blue.strokeColor = "blue";
style_blue.fillColor = "blue";
style_blue.graphicName = "circle";
style_blue.pointRadius = 10;
style_blue.strokeWidth = 1;
However, I want to create custom symbols programmatically based on data.
So, for example, if my data are like so
var data = {
"foo": 4,
"bar": 1,
"baz": 5
}
I would like to create a cluster of points based on the value of each
point... so, a cluster of 4 circles or squares for foo, 1 for bar, 5 for
baz, and so on.
The idea is to have the symbol denote something besides just the
location. Of course, this is rather complicated -- the bounding box of
the symbol for "bar" with a value of 1 should be the same as the
bounding box of the symbol of "baz" (the entire symbol should be the
same size). So, the individual components of the cluster would vary in
size, perhaps capping off after a limit of, say, 6 or 10.
Alternatively, I could have a number in a circle or a square denoting
the values.
Note that one way to do this would be to think of individual points as a
cluster of points at the same location, and then use some kind of
cluster strategy. However, I actually want to create new symbols on the fly.
Hints?
--
Puneet Kishor
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users