How to make a render with a group layer (for a thematic classifier)

1961
14
Jump to solution
11-26-2016 08:25 AM
RolandoFlorez
New Contributor III

This is that I want:

Make a render with this layer (barrancabermeja/mapa_tematico_malla_GBD), I added that layer but it includes the sublayers ( ancho calzada (0), tipo de capa de rodadura (1), numero de carriles (2) ). 

When I print the operational layers (and other thematic layers too) I see the structure of the layer above, but It doesnt have the fields property. I think that I need the fields to make the renderer. But, I dont know How to get the fields of each sublayer there. 

If I add one layer like mapserver/0 (barrancabermeja/mapa_tematico_malla_GBD/0) , and I print that in the console, I can see the fields property, otherwise, not.

Thanks

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Rolando,

   I basically started you widget over from scratch. In the attached widget you will find the sample you referenced working for the widget. The Widget.html and Widget.js have been cleaned and set to use common widget development best practices and standards. Now all you need to do is add your code changes to get it working with your data.

View solution in original post

0 Kudos
14 Replies
RobertScheitlin__GISP
MVP Emeritus

Rolando,

  I am a little confused by your question. Why do you not just look at the fields in the rest service directory like you are showing above and choose the field you want to use and then remember that field name when you start coding your rendererer? Also it is sounding like you are wanting to apply a renderer to the whole map service. That is not possible renderers are for individual layers and not whole map services.

0 Kudos
RolandoFlorez
New Contributor III

Robert, 

That is because the admin may add any others layers, and if I put the fields statically, when he add other layers the widget would not work.
So I am a little confused too. Because, you can see "barrancabermeja/mapa_tematico_malla_GBD" that is a layer with sublayers. But, I think that the only way to make the render is using one of that sublayers by separate.
My really question would be: I have to use the sublayers necessarily to make the each render to each layer?, and, if that's it, How can I get the fields of that sublayers, from the layer?

I hope that it has been most clear. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rolando,

   When you add an ArcGISDynamicMapServiceLayer the renderers that were setup in the mxd will be used. If you want to change the renderer that was setup in the mxd then you would use setLayerDrawingOptions To get the field names at runtime for a sublayer you would use an esriRequest with the sublayers url to get the fields array (there are several posts on this).

RolandoFlorez
New Contributor III

i'm still confused, about it.
I need your help.
This is the problem, I don't understand how it works, I mean, I'm trying to make a render like this sample: Change attribute used for a renderer.

At first image you can see above, is the way that I have my map service.
This is the way that I'm trying (following the sample): get the layer --> barrancabermeja/mapa_tematico_malla_GBD, but , inside it, there are three layers (ancho calzada, tipo de rodadura, numero de carriles) ---> get the sublayer: (suppose it) Ancho calzada, now, Ancho calzada HAS THE FIELDS. 

After that I want to make the render. But I can't,I'm wrong.

Note: When I have this layer "barrancabermeja/mapa_tematico_malla_GBD", API tells me that it's a MapServiceLayer, but If I have "barrancabermeja/mapa_tematico_malla_GBD/0", API tells me that it's a FeatureLayer. To this last, is the which I can apply the render.

Sorry for the inconvenience, but it's frustrating.

I Attached the widget: Demo WidgetDemo Widget (Google Drive)

Thanks a lot.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rolando,

   I basically started you widget over from scratch. In the attached widget you will find the sample you referenced working for the widget. The Widget.html and Widget.js have been cleaned and set to use common widget development best practices and standards. Now all you need to do is add your code changes to get it working with your data.

0 Kudos
RolandoFlorez
New Contributor III

Robert,

Thanks a lot, that was more clear.
I did the same like you, with my data, I choose the first sublayer and then fill the field Names.
But now the problem is: the layer has not taking the render. I'm printing the renderer and that's ok, but when It try to apply, it does not work. At legend is the same, it show the same legend from map service, not the I was configuring.

What do you think is the cause?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I would have to see your updated code.

0 Kudos
RolandoFlorez
New Contributor III

Look the Widget.js (dont know how to attach files)

There is some comments in the code. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rolando,

   Your biggest issue is this:

// optionsArray index corresponds to layer index in the map service
optionsArray[2] = drawingOptions;‍‍

You did not change 2 which would mean the third layer in the map service. It should be:

// optionsArray index corresponds to layer index in the map service
optionsArray[0] = drawingOptions;‍‍