Working with

Few common scenarios when you are working with the graphics layer (@ version 1.3) in the ArcGIS Server JS API

1. returns the graphics layer
2. returns the array of graphic elements (geometry, symbol, attribute, infotemplate) added to the graphics layer

To remove all graphic elements in the graphic layer;

To show/hide specific graphic element[index].show();[index].hide();

To check if any specific graphic element is being shown or not:
// 'none' is hidden and 'block' is visible[index].getDojoShape()

Loop through all the graphic elements
var graphics =;
for (var i=0; i< graphics.length; i++)
// do something with graphics[i]

even better

dojo.forEach(, "console.log(item.getDojoShape()");
dojo.forEach(, "console.log(item,index,array)");
dojo.forEach(, function(item){//item is a graphic element });

Note: @version 1.4 you will have ability to add multiple graphics layers (in addition to the default graphics layer) and can control the stack order (z-index).


2 Responses to “Working with”

  1. web tasarım Says:

    thanks for sharing

  2. Milla Says:

    A very nice piece.
    I no the many options you have given should answer my question but maybe I am not thinking this through.

    A section of my bit of code onMouseDragEnd draws a point. Using[index].hide() hides the very first dot that was created but subsequent don’t aren’t cleared. I know I am to loop through and keep track of the indices but I’m having no joy. Could you help with some few pointers?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: