0
我有一個openlayers地圖,標記添加爲幾何矢量點。在樣式選項中,我爲每個選項設置一個大小。但是,問題是,如果我放大或縮小,它們都會變成相同的大小,直到我再次加載整個頁面。換句話說,一旦我放大或縮小,它們都是一樣的。Openlayers標記大小
var layer_style = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']);
var style = OpenLayers.Util.extend({}, layer_style);
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
map.addLayers([terrain, road, satellite, hybrid, pointLayer]);
var lonlat = new OpenLayers.LonLat(0, 140);
lonlat.transform(proj, map.getProjectionObject());
map.setCenter(lonlat, 2);
var point = new OpenLayers.Geometry.Point(-40, -40);
point = point.transform(proj, map.getProjectionObject());
style.pointRadius = 10;
var pointFeature = new OpenLayers.Feature.Vector(point, null, style);
pointLayer.addFeatures([pointFeature]);
var point = new OpenLayers.Geometry.Point(-40, -40);
point = point.transform(proj, map.getProjectionObject());
style.pointRadius = 40;
var pointFeature = new OpenLayers.Feature.Vector(point, null, style);
pointLayer.addFeatures([pointFeature]);
當我打開這個,我得到兩個標誌,一個大小爲10,其他40但當我放大或縮小,都成爲相同的大小。