This document discusses the JSON symbol (and its supporting) objects as returned by the REST API.
The following objects are discussed here:
Color is represented as a 4-element array. The 4 elements represent values for red, green, blue and alpha in that order. Values range from 0 through 255.
[ <red>, <green>, <blue>, <alpha> ]
[ 67, 0, 255, 40 ]
Simple marker symbols can be used to symbolize point geometries.
The type property for simple marker symbols is esriSMS.
{
"type" : "esriSMS",
"style" : "< esriSMSCircle | esriSMSCross | esriSMSDiamond | esriSMSSquare | esriSMSX >",
"color" : <color>,
"size" : <size>,
"angle" : <angle>,
"xoffset" : <xoffset>,
"yoffset" : <yoffset>,
"outline" : { //if outline has been specified
"color" : <color>,
"width" : <width>
}
}
{
"type": "esriSMS",
"style": "esriSMSSquare",
"color": [76,115,0,255],
"size": 8,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"outline":
{
"color": [152,230,0,255],
"width": 1
}
}
Simple line symbols can be used to symbolize polyline geometries or outlines for polygon fills.
The type property for simple line symbols is esriSLS.
{
"type" : "esriSLS",
"style" : "< esriSLSDash | esriSLSDashDot | esriSLSDashDotDot | esriSLSDot | esriSLSNull | esriSLSSolid >",
"color" : <color>,
"width" : <width>
}
{
"type": "esriSLS",
"style": "esriSLSDot",
"color": [115,76,0,255],
"width": 1
}
Simple fill symbols can be used to symbolize polygon geometries.
The type property for simple fill symbols is esriSFS.
{
"type" : "esriSFS",
"style" : "< esriSFSBackwardDiagonal | esriSFSCross | esriSFSDiagonalCross | esriSFSForwardDiagonal | esriSFSHorizontal | esriSFSNull | esriSFSSolid | esriSFSVertical >",
"color" : <color>,
"outline" : <simpleLineSymbol> //if outline has been specified
}
{
"type": "esriSFS",
"style": "esriSFSSolid",
"color": [115,76,0,255],
"outline": {
"type": "esriSLS",
"style": "esriSLSSolid",
"color": [110,110,110,255],
"width": 1
}
}
Picture marker symbols can be used to symbolize point geometries.
The type property for picture marker symbols is esriPMS.
These symbols include the base64 encoded imageData as well as a
url that could be used to retrieve the image from the server.
Note that this is a relative URL. It can be dereferenced by accessing the
feature layer image resource.
{
"type" : "esriPMS",
"url" : "<imageUrl>", //relative URL
"imageData" : "<base64EncodedImageData>",
"contentType" : "<imageContentType>",
"width" : <width>,
"height" : <height>,
"angle" : <angle>,
"xoffset" : <xoffset>,
"yoffset" : <yoffset>
}
{
"type" : "esriPMS",
"url" : "471E7E31",
"imageData" : "iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOU5ErkJggg==",
"contentType" : "image/png",
"width" : 19.5,
"height" : 19.5,
"angle" : 0,
"xoffset" : 0,
"yoffset" : 0
}
Picture fill symbols can be used to symbolize polygon geometries.
The type property for picture fill symbols is esriPFS.
These symbols include the base64 encoded imageData as well as a
url that could be used to retrieve the image from the server.
Note that this is a relative URL. It can be dereferenced by accessing the
feature layer image resource.
{
"type" : "esriPFS",
"url" : "<imageUrl>", //relative URL
"imageData" : "<base64EncodedImageData>",
"contentType" : "<imageContentType>",
"outline" : <simpleLineSymbol>, //if outline has been specified
"width" : <width>,
"height" : <height>,
"angle" : <angle>,
"xoffset" : <xoffset>,
"yoffset" : <yoffset>,
"xscale": <xscale>,
"yscale": <yscale>
}
{
"type" : "esriPFS",
"url" : "866880A0",
"imageData" : "iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAM9JREFUeJzt0EEJADAMwMA96l/zTBwUSk5ByLxQsx1wTUOxhmINxRqKNRRrKNZQrKFYQ7GGYg3FGoo1FGso1lCsoVhDsYZiDcUaijUUayjWUKyhWEOxhmINxRqKNRRrKNZQrKFYQ7GGYg3FGoo1FGso1lCsoVhDsYZiDcUaijUUayjWUKyhWEOxhmINxRqKNRRrKNZQrKFYQ7GGYg3FGoo1FGso1lCsoVhDsYZiDcUaijUUayjWUKyhWEOxhmINxRqKNRRrKNZQrKFYQ7GGYh/hIwFRFpnZNAAAAABJRU5ErkJggg==",
"contentType" : "image/png",
"outline" :
{
"type" : "esriSLS",
"style" : "esriSLSSolid",
"color" : [110,110,110,255],
"width" : 1
},
"width" : 63,
"height" : 63,
"angle" : 0,
"xoffset" : 0,
"yoffset" : 0,
"xscale" : 1,
"yscale" : 1
}
Text symbols are used to add text to a feature (labeling).
The type property for text symbols is esriTS.
{
"type" : "esriTS",
"color" : <color>,
"backgroundColor" : <color>,
"borderLineColor" : <color>,
"verticalAlignment" : "<baseline | top | middle | bottom>",
"horizontalAlignment" : "<left | right | center | justify>",
"rightToLeft" : <true | false>,
"angle" : <angle>,
"xoffset" : <xoffset>,
"yoffset" : <yoffset>,
"kerning" : <true | false>,
"font" : {
"family" : "<fontFamily>",
"size" : <fontSize>,
"style" : "<italic | normal | oblique>",
"weight" : "<bold | bolder | lighter | normal>",
"decoration" : "<line-through | underline | none>"
}
}
{
"type": "esriTS",
"color": [78,78,78,255],
"backgroundColor": null,
"borderLineColor": null,
"verticalAlignment": "bottom",
"horizontalAlignment": "left",
"rightToLeft": false,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"font": {
"family": "Arial",
"size": 12,
"style": "normal",
"weight": "bold",
"decoration": "none"
}
}