Select to view content in your preferred language

Is there any way of reordering between graphic layer & normal map layers?

1322
5
01-15-2013 10:49 AM
prashantpal
Occasional Contributor
Hi Guys,

I want put the Annotation layer(DynamicMapService) on top of Graphics layers(rendered), I couldn't
find any function to do that. By default graphic layer are on top of map layers.I have tried using the
map.reorder() :only works for map layers and graphics.movetoback/front():only works for graphics.
So there is no connection between these two.

Is there anyone who have had that problem, please help me out if you have solved it.

Thanks

Pal
0 Kudos
5 Replies
JoanneMcGraw
Frequent Contributor
Well, I can't tell you how to solve it but I can tell you that I ran up against the same thing and gave up on it. From what I remember, after reads the docs and forums, I believe I decided it wasn't possible; but, perhaps someone who knows more about it can comment.

I'm certainly interested in the answer as well.

cheers,
jtm
0 Kudos
JohnGravois
Deactivated User
graphics layers always draw on top of both dynamic and tiled map service layers (see the following thread for more info)
http://gis.stackexchange.com/questions/20429/arcgis-javascript-api-a-way-to-position-dynamic-service...

i'm not exactly sure what your use case is, but in some situations it makes sense to use a dynamic map service to display the same content and either work with a feature layer in selection mode or build spatial queries dynamically based on map interaction.
0 Kudos
by Anonymous User
Not applicable
This method may be helpful to you.  Index determines which layer will go on top.  Layers with lower index numbers will be on the bottom.  Layers with higher numbers will go on the top.

map.addLayer(layer, index?)

Also here is a reorder layer sample. 

http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/layers_dynamic_reorder
0 Kudos
prashantpal
Occasional Contributor
Thanks a lot for your replies. I will work on it and see if I can get somewhere.
0 Kudos
JoanneMcGraw
Frequent Contributor
Although it was a while ago, I'm pretty sure I tried using the addLayer with an index (as suggested above) and found that the index value provided was used in relation to which array list the layer was included in. It didn't allow me to intermingle mapping service layers with feature layers.

That is, if I have 3 MapServiceLayers and 2 FeatureLayers, there are two arrays that are maintained in the map: layerIds and graphicsLayerIds. layerIds contains the list and order of the MapServiceLayers and graphicsLayerIds contains the list and order of the FeatureLayers. So, if the layer in the addLayer call is a MapServiceLayer, the index provided will position the layer within the layerIds array; and, if the layer is a FeatureLayer, the index provided will position the layer within the graphicsLayerIds.

During rendering, the layers listed in the layerIds array are always displayed as ordered before those found in the graphicsLayerIds are displayed on top of them, also as ordered.

Again, it's been a while so I might not be remembering this correctly; so, I apologize if my addition to this conversation is misleading or incorrect. Just trying to save you some time.

Having said all that, the suggestion to include what is currently a MapServiceLayer as a FeatureLayer instead might be workable for my particular application to allow for the desired re-ordering functionality. Really, it just depends on what other functionality I need to do with that layer and, off the top of my head, I don't remember ... but will certainly be revisiting it.

Cheers,
jtm
0 Kudos