AnsweredAssumed Answered

The size attribute on SimpleMarkerSymbol is not working

Question asked by seth_patrich on Jan 12, 2017
Latest reply on Jan 12, 2017 by timw1984

I am setting the size on a SimpleMarkerSymbol using the 4.2 JavaScript API, but it is not having any effect on the resulting symbols.  I have been assigning the value according to these examples.

 

In this case, I'm getting the shape of the symbol from an SVG string.

 

Here is a sample app to replicate the issue:

<!DOCTYPE html>
<html>
<head>
<title>Resize SimpleMarkerSymbols</title>
<style>
html,
body,
#viewDiv
{
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>


<link rel="stylesheet" href="https://js.arcgis.com/4.2/esri/css/main.css">
<script src="https://js.arcgis.com/4.2/"></script>

<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/symbols/SimpleMarkerSymbol",
"esri/geometry/Point",
"esri/Graphic",
"dojo/domReady!"
], function (Map, MapView, SimpleMarkerSymbol, Point, Graphic) {

var map = new Map({
basemap: 'hybrid'
});

var view = new MapView({
center: [-84.3852995, 33.7678835],
container: "viewDiv",
map: map,
zoom: 13

});

//Create SVG Icon
var iconPath = "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z";

var markerSymbol = new SimpleMarkerSymbol(
{
path: iconPath,
size: "50px",
color: "#3F51B5",
outline: {
color: [255, 255, 255],
width: 1
}
}
);

var point = new Point({
longitude: -84.3852995,
latitude: 33.7678835
});

var pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol
});

view.graphics.add(pointGraphic);

});
</script>

</head>

<body>
<div id="viewDiv"></div>
</body>
</html>

Outcomes