Hide Table of Contents
esri
Map
toolbars
Class: PictureMarkerSymbol
[ AMD Module Require | Legacy Module Require ]

Description

Marker symbols are used to draw points and multipoints on the graphics layer. PictureMarkerSymbol uses an image as a marker.

Samples

Search for samples that use this class.

Class hierarchy

esri.symbol.Symbol
|_esri.symbol.MarkerSymbol
  |_esri.symbol.PictureMarkerSymbol

Constructors

ConstructorDescription
new esri.symbol.PictureMarkerSymbol(url,width,height)Creates a new PictureMarkerSymbol object.
new esri.symbol.PictureMarkerSymbol(json)Creates a new PictureMarkerSymbol object using a JSON object.

Properties

PropertyTypeDescription
angleNumberThe angle of the image. 0 is pointing right and values progress clockwise.
colordojo.ColorSymbol color, which is based on dojo.Color. Colors can be denoted in the following formats:

  • R, G, B: new dojo.Color([255,0,0])
  • R,G,B,A. The "A" value represents transparency where 0.0 is fully transparent and 1.0 has no transparency: new dojo.Color([255,0,0,0.25])
  • Hex string: new dojo.Color("#C0C0C0")
  • Named string: new dojo.Color("blue")
heightNumberHeight of the image in pixels.
sizeNumberSize of the marker in pixels.
typeStringThe type of symbol.
urlStringURL of the image.
widthNumberWidth of the image in pixels.
xoffsetNumberThe offset on the x-axis in pixels.
yoffsetNumberThe offset on the y-axis in pixels.

Methods

MethodReturn ValueDescription
setAngle(angle)MarkerSymbolSets the angle of a marker.
setColor(color)SymbolSets the symbol color.
setHeight(height)PictureMarkerSymbolSets the height of the image for display. The height can be larger or smaller than the actual width of the image. As the image gets larger, it will become more pixilated.
setOffset(x,y)MarkerSymbolSets the x and y offset of a marker in screen units.
setSize(size)MarkerSymbolSets the size of a marker in pixels.
setUrl(url)PictureMarkerSymbolSets the URL where the image is located.
setWidth(width)PictureMarkerSymbolSets the width of the image for display. The width can be larger or smaller than the actual width of the image. As the image gets larger, it will become more pixilated.
toJson()ObjectConverts object to its ArcGIS Server JSON representation.
Constructor Details

new esri.symbol.PictureMarkerSymbol(url,width,height)

Creates a new PictureMarkerSymbol object.
Parameters:
<String> urlRequiredURL of the image.
<Number> widthRequiredWidth of the image in pixels. The default value is the actual width of the image.
<Number> heightRequiredHeight of the image in pixels. The default value is the actual height of the image.
Code Snippet:

Example 1

new esri.symbol.PictureMarkerSymbol('http://www.esri.com/graphics/aexicon.jpg', 51, 51);

Example 2

new esri.symbol.PictureMarkerSymbol('/images/diamond.png', 25, 25);

new esri.symbol.PictureMarkerSymbol(json)

Creates a new PictureMarkerSymbol object using a JSON object.
Parameters:
<Object> jsonRequired

JSON object representing the PictureMarkerSymbol. View the REST API Reference for Symbol Objects for details on creating a JSON symbol. Note that when specifying symbol width and height using JSON the values should be entered in points, the JavaScript API then converts the point values to pixels.

Code Snippet:
  
//Height and Width are specified in points
var symbol =  new esri.symbol.PictureMarkerSymbol({
  "url":"graphics/redArrow2.png",
  "height":20,
  "width":20,
  "type":"esriPMS"
});
Property Details

<Number> angle

The angle of the image. 0 is pointing right and values progress clockwise.
Default Value: 0

<dojo.Color> color

Symbol color, which is based on dojo.Color. Colors can be denoted in the following formats:

  • R, G, B: new dojo.Color([255,0,0])
  • R,G,B,A. The "A" value represents transparency where 0.0 is fully transparent and 1.0 has no transparency: new dojo.Color([255,0,0,0.25])
  • Hex string: new dojo.Color("#C0C0C0")
  • Named string: new dojo.Color("blue")

<Number> height

Height of the image in pixels.

<Number> size

Size of the marker in pixels.

<String> type

The type of symbol.
Known Values: simplemarkersymbol | picturemarkersymbol | simplelinesymbol | cartographiclinesymbol | simplefillsymbol | picturefillsymbol | textsymbol

<String> url

URL of the image.

<Number> width

Width of the image in pixels.

<Number> xoffset

The offset on the x-axis in pixels.
Default Value: 0

<Number> yoffset

The offset on the y-axis in pixels.
Default Value: 0
Method Details

setAngle(angle)

Sets the angle of a marker.
Return Value: MarkerSymbol
Input Parameters:
<Number> angleRequiredThe angle value. 0 is pointing right and values progress clockwise.

setColor(color)

Sets the symbol color.
Return Value: Symbol
Input Parameters:
<dojo.Color> colorRequiredColors can be denoted in the following formats:

  • R, G, B: new dojo.Color([255,0,0])
  • R,G,B,A. The "A" value represents transparency where 0.0 is fully transparent and 1.0 has no transparency: new dojo.Color([255,0,0,0.25])
  • Hex string: new dojo.Color("#C0C0C0")
  • Named string: new dojo.Color("blue")
Code Snippet:
symbol.setColor(new dojo.Color([255,255,0,0.5]));

setHeight(height)

Sets the height of the image for display. The height can be larger or smaller than the actual width of the image. As the image gets larger, it will become more pixilated.
Return Value: PictureMarkerSymbol
Input Parameters:
<Number> heightRequiredHeight of marker in pixels.

setOffset(x,y)

Sets the x and y offset of a marker in screen units.
Return Value: MarkerSymbol
Input Parameters:
<Number> xRequiredThe X offset value in pixels.
<Number> yRequiredThe Y offset value in pixels.

setSize(size)

Sets the size of a marker in pixels.
Return Value: MarkerSymbol
Input Parameters:
<Number> sizeRequiredThe width of the symbol in pixels.

setUrl(url)

Sets the URL where the image is located.
Return Value: PictureMarkerSymbol
Input Parameters:
<String> urlRequiredURL location of marker image.

setWidth(width)

Sets the width of the image for display. The width can be larger or smaller than the actual width of the image. As the image gets larger, it will become more pixilated.
Return Value: PictureMarkerSymbol
Input Parameters:
<Number> widthRequiredWidth of marker in pixels.

toJson()

Converts object to its ArcGIS Server JSON representation.
Return Value: Object