AnsweredAssumed Answered

SVG path for LayerDrawingOptions?

Question asked by a_morgan on Sep 7, 2016
Latest reply on Sep 13, 2016 by a_morgan

Can a SimpleMarkerSymbol, created from an SVG path, be used as a renderer in LayerDrawingOptions for DynamicMapServiceLayers?  See my example below.  I don't get any errors.  It simply doesn't show the SVG (red triangle) symbol for the fire station layer features - layer 7.  The same SVG symbol displays fine if I apply it to a graphic and add the graphic to the map, but nothing appears when applied to a dynamic map service layer.  My ultimate goal is to use custom SVG path text (e.g. "M100, 100......") with UniqueValueRenderer symbols.

 

<!DOCTYPE html>
<html>
<head>
<title>SVG render test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="https://js.arcgis.com/3.17/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.17/dojox/widget/ColorPicker/ColorPicker.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.17/esri/css/esri.css">
<style>
html, body, #map {
height:100%;
width:100%;
margin:0;
padding:0;
}

</style>

<script src="https://js.arcgis.com/3.17/"></script>

<script>
require([
"esri/map", "esri/geometry/Point",
"esri/graphic", "esri/SpatialReference", "esri/geometry/Extent",
"esri/Color", "esri/layers/ArcGISDynamicMapServiceLayer",
"esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleFillSymbol",
"esri/renderers/SimpleRenderer", "esri/layers/LayerDrawingOptions", "esri/config",
"dojo/_base/array", "dojo/dom-style",
"dojo/domReady!"
], function(
Map, Point,
Graphic, SpatialReference, Extent,
Color, ArcGISDynamicMapServiceLayer,
SimpleLineSymbol, SimpleMarkerSymbol, SimpleFillSymbol,
SimpleRenderer, LayerDrawingOptions, esriConfig,
arrayUtils, domStyle
) {

var app = {};

app.defaultExtent = new Extent(-97.78219462135767, 30.25811946558375, -97.6972260613063, 30.30040143951408,
new SpatialReference({ wkid: 4326 })
);


app.map = new Map("map", {
extent: app.defaultExtent,
sliderPosition: "bottom-left",
sliderStyle: "small"
});

app.layerTestURL = "http://services.nationalmap.gov/arcgis/rest/services/structures/MapServer";
app.layerTest = new ArcGISDynamicMapServiceLayer(app.layerTestURL);

app.map.addLayer(app.layerTest);

app.layerTest.on("load", function (e) {
resymbolizeTestLayer();
});


function resymbolizeTestLayer() {

var iconPath = "M100,100 L300,100 L200,300 Z";

var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setPath(iconPath);
markerSymbol.setColor(new Color([220, 10, 20, 1]));
markerSymbol.setOutline(null);

var layerDrawingOptions = [];
var drawOpt = new LayerDrawingOptions();
drawOpt.renderer = new SimpleRenderer(markerSymbol);
layerDrawingOptions[7] = drawOpt;
app.layerTest.setLayerDrawingOptions(layerDrawingOptions);
}

});
</script>

</head>
<body class="claro">
<div id="map"></div>
</body>
</html>

Outcomes