【发布时间】:2014-03-13 14:14:58
【问题描述】:
我很困惑如何为我的 Feature 添加样式,该 Feature 由 Vector 内的 LineString 组成。我是否向 LineString 或 Vector 添加样式?我想更改线条的颜色和大小,并尽可能使线条不透明。
mapObject = new OpenLayers.Layer.Vector("Vector");
var p1 = new OpenLayers.Geometry.Point(mapObjectTopLeftLon, mapObjectTopLeftLat);
var p2 = new OpenLayers.Geometry.Point(mapObjectTopRightLon, mapObjectTopRightLat);
var p3 = new OpenLayers.Geometry.Point(mapObjectBottomRightLon, mapObjectBottomRightLat);
var p4 = new OpenLayers.Geometry.Point(mapObjectBottomLeftLon, mapObjectBottomLeftLat);
var p5 = new OpenLayers.Geometry.Point(mapObjectTopLeftLon, mapObjectTopLeftLat);
var pnt = [];
pnt.push(p1,p2,p3,p4,p5);
mapObject.addFeatures([new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(pnt))]);
map.addLayer(mapObject);
【问题讨论】:
标签: openlayers gis