您将在下面找到用于创建地图和创建ArcGISDynamicMapServiceLayer的JavaScript代码。此ArcGISDynamicMapServiceLayer包含16个图层。 id为1的第2层是esriGeometryPolyline图层。当您将它放在地图上时,此图层上的线条不够厚。是否可以从ArcGISDynamicMapServiceLayer对象中获取该图层并扩大线条。我搜索了普通的论坛和谷歌,但找不到任何可以帮助我的东西。
var visible = [0,1,2];
var initialExtent = new Extent({"xmin":455248.7328447895,"ymin":404516.307641385,"xmax":532048.7328447895,"ymax":484516.307641385,"spatialReference":{"wkid":27700}});
myMap = new Map("mainMap", {
extent: initialExtent
});
var baseLayer = new ArcGISTiledMapServiceLayer("http://************/arcgis/rest/services/Basemap/*********/MapServer");
myMap.addLayer(baseLayer);
dojo.connect(myMap, "onUpdateStart", showLoading);
dojo.connect(myMap, "onUpdateEnd", hideLoading);
var imageParameters = new esri.layers.ImageParameters();
imageParameters.transparent=true;
layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://*********************/arcgis/rest/services/***********/MapServer", {"imageParameters":imageParameters});
layer.setOpacity(0.8);
myMap.addLayer(layer);
layer.setVisibleLayers(visible);
答案 0 :(得分:1)
您无法使用JS代码调整DynamicMapServiceLayer的行宽。
您可以通过两种方式增加线宽。
1)在arcmap中编辑地图服务MXD,然后用更粗的行重新发布服务。
2)将图层作为FeatureLayer而不是DynamicMapService使用。您可以控制FeatureLayer的所有方面。在DynmaicMapService URL的末尾添加斜杠和图层ID将使图层成为FeatureLayer。
require([
"esri/layers/FeatureLayer", "esri/renderers/SimpleRenderer", "esri/symbols/SimpleLineSymbol", "esri/Color", ...
], function(FeatureLayer, SimpleRenderer, SimpleLineSymbol, Color, ... ) {
var featureLayer = new FeatureLayer(""http://*********************/arcgis/rest/services/***********/MapServer/2",{
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
var symbol = new SimpleLineSymbol(
SimpleLineSymbol.STYLE_DASH,
new Color([255,0,0]),
3
);
var renderer = new SimpleRenderer(symbol);
featureLayer.setRenderer(renderer);
...
});