[OpenLayers-Users] Vector feature marker with bounds
Supriya GHADAGE
sghadage at wapp6.com
Mon Jun 30 08:30:21 PDT 2014
Hello,
I am beginner for openlayers. I wanted to draw rectangle as a marker with
openlayers vector feature.
But when I zoom in or out, rectangle changes its size. I have shared
following piece of code.
var box_extents1 = [[500, 00, 00, -600], [540, 00, 00, -500]]
var style = new OpenLayers.StyleMap({
'default':OpenLayers.Util.applyDefaults({
pointRadius: "${r}",
label: "${l}",
allOverlays: true,
fillColor: "#008888",
strokeColor: "#000000",
strokeWidth: 0.5,
fontSize: "12px",
color: '#ffffff',
width:"20px",
height: 20
}, OpenLayers.Feature.Vector.style["default"]
),
'select':OpenLayers.Util.applyDefaults(
{pointRadius: "${r}"},
OpenLayers.Feature.Vector.style.select
)
});
var boxes = new OpenLayers.Layer.Vector( "Box Markers" ,{
styleMap: style
});
for (var i = 0; i < box_extents.length; i++) {
ext = box_extents[i];
bounds = OpenLayers.Bounds.fromArray(ext);
box = new OpenLayers.Feature.Vector(bounds.toGeometry(),
{l:1,r:10});
boxes.addFeatures(box);
}
map.addLayer(boxes);
Any help is appreciated.
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140630/802162bc/attachment.html>
More information about the Users
mailing list