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
Properties
| angle | Number | The angle of the image. 0 is pointing right and values progress clockwise. |
| color | dojo.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")
|
| height | Number | Height of the image in pixels. |
| size | Number | Size of the marker in pixels. |
| type | String | The type of symbol. |
| url | String | URL of the image. |
| width | Number | Width of the image in pixels. |
| xoffset | Number | The offset on the x-axis in pixels. |
| yoffset | Number | The offset on the y-axis in pixels. |
Methods
Constructor Details
new esri.symbol.PictureMarkerSymbol(url,width,height)
Creates a new PictureMarkerSymbol object.
Parameters:
| <String> url | Required | URL of the image. |
| <Number> width | Required | Width of the image in pixels. The default value is the actual width of the image. |
| <Number> height | Required | Height 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> json | Required | 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
The angle of the image. 0 is pointing right and values progress clockwise.
Default Value: 0
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")
Height of the image in pixels.
Size of the marker in pixels.
The type of symbol.
Known Values: simplemarkersymbol | picturemarkersymbol | simplelinesymbol | cartographiclinesymbol | simplefillsymbol | picturefillsymbol | textsymbol
Width of the image in pixels.
The offset on the x-axis in pixels.
Default Value: 0
The offset on the y-axis in pixels.
Default Value: 0
Method Details
Sets the angle of a marker.
Input Parameters:
| <Number> angle | Required | The angle value. 0 is pointing right and values progress clockwise. |
Sets the symbol color.
Input Parameters:
| <dojo.Color> color | Required | 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")
|
Code Snippet:
symbol.setColor(new dojo.Color([255,255,0,0.5]));
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.
Input Parameters:
| <Number> height | Required | Height of marker in pixels. |
Sets the x and y offset of a marker in screen units.
Input Parameters:
| <Number> x | Required | The X offset value in pixels. |
| <Number> y | Required | The Y offset value in pixels. |
Sets the size of a marker in pixels.
Input Parameters:
| <Number> size | Required | The width of the symbol in pixels. |
Sets the URL where the image is located.
Input Parameters:
| <String> url | Required | URL location of marker image. |
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.
Input Parameters:
| <Number> width | Required | Width of marker in pixels. |
Converts object to its ArcGIS Server JSON representation.
Return Value: Object