Select to view content in your preferred language

add graphic  element to feature layer

2299
2
Jump to solution
05-14-2012 10:57 PM
AndrewIosida
Emerging Contributor
Hello! I have 2 feature layers. And I want to add graphic element from first layer to second one. But property map.layers.graphicProvider is read-only. So when I'm trying to add graphic like this:
map.layers[1].add(map.layers[2].graphicProvider);
nothing happens. GraphicProvider of first layer not changes, so nothing adds to map. First and second layers are identical by all parameters. Is it possible to add graphic element from one layer to another one?
Thanks in advance. And sorry for my poor English.

I think I need to use applyEdits().Something like this:
map.layers[1].applyEdits(map.layers[2].graphicProvider, , );
But what I need to paste on second and third positions into brackets?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Andrew,

    Have you looked at the documentation for FeatureLayer?

http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html

As far as what you would put for the second and third params of the applyEdits function both would just be null if you are not updating or deleting any features. And it is expecting an Array of graphics not a single graphic object:

(map.layers[1] as FeatureLayer).applyEdits([map.layers[2].graphicProvider], null, null);


Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Andrew,

    Have you looked at the documentation for FeatureLayer?

http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/FeatureLayer.html

As far as what you would put for the second and third params of the applyEdits function both would just be null if you are not updating or deleting any features. And it is expecting an Array of graphics not a single graphic object:

(map.layers[1] as FeatureLayer).applyEdits([map.layers[2].graphicProvider], null, null);


Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:
0 Kudos
AndrewIosida
Emerging Contributor
Thank you Robert!
0 Kudos