MapView.add_layer function options

2890
6
Jump to solution
05-28-2018 06:13 PM
simoxu
by MVP Regular Contributor
MVP Regular Contributor

add_layer(item, options=None)

Adds the specified layer or item to the map widget.

ArgumentDescription
itemRequired object. You can specify Item objects, Layer objects such as FeatureLayer, ImageryLayer, MapImageLayer etc., FeatureSet and FeatureCollection objects.
optionsOptional dict. Specify visualization options such as renderer info, opacity, definition expressions. See example below

It sounds great I can set the renderer on the fly for the layer that is going to be displayed in the map widget. but I wasted hours trying with no success. it always display the default renderer or the renderer defined in ArcGIS Online(if it's a existing layer).

There is no consistent document for the accepting options. ALL you I can do was GUESSING... and there were no examples in place although it says "See example below"

There are some examples for the smart mapping 

Smart Mapping | ArcGIS for Developers 

But it only mentions some renderer such as "ClassedColorRenderer", "ClassedSizeRenderer" and "HeatmapRenderer", these are useless to me, I need unique symbols for each feature , which should be the very basic renderer, but I sadly can't figure it out. 

Where is the full list of the accepting smart mapping renderers and document for other options for this function?

I've tried to piece together information using the following help document, but just not enough...

Renderer objects—Common Data Types | ArcGIS for Developers 

esri/renderers/smartMapping | API Reference | ArcGIS API for JavaScript 3.24 

Generate Renderer (Feature Service)—ArcGIS REST API: Services Directory | ArcGIS for Developers 

It's hard to believe such a important document is not available (or not very visible to users), given visualizing data is absolutely an essential part of the whole analysis.

Another thing annoys me in the  Smart Mapping | ArcGIS for Developers :

To learn more about this exciting capability visit the help page and this blog article. Here is a detailed help on various ways you can symbolize your data.

All these 3 links lead the developers to ArcGIS Online document, how can that help a developer using python?? I start wondering whether or not these links are put there by the AI algorithm which I will forgive totally because they can not understand complicated context yet.

Back to the topic, Where is the document? if no such document , can ESRI please make some document? by the way, in the document, if mentioning some thing like "see example below" or "see Feature Input in documentation" (in create_buffer function description) , please do remember to put some example or document there.

Thanks

1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hello simo xu‌, the 3 renderers you mentioned are the only smart mapping renderers supported in the current version. I understand that unique value renderer is important, we are working toward revamping the whole map widget for an upcoming release and we will try to eval and support that renderer. Until then, I request you to use a full fledged map authoring environment such as Pro or ArcGIS Online.

View solution in original post

6 Replies
DanPatterson_Retired
MVP Emeritus

Are you trying to do 'stuff' for ArcGIS online?

For ArcGIS PRO?  (there is a similar one for ArcMap)

The markets and tools share some things, but the divide can be large.

0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

I am using Python API for ArcGIS for ArcGIS Online / portal.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Leaving... http://esri.github.io/arcgis-python-api/apidoc/html/ which has lots of stuff, but more of a reference thinner on examples

0 Kudos
by Anonymous User
Not applicable

The Webmap spec is defined here: webmap | ArcGIS for Developers 

The Unique Value Renderer is defined here: uniqueValueRenderer | ArcGIS for Developers 

0 Kudos
by Anonymous User
Not applicable

Hello simo xu‌, the 3 renderers you mentioned are the only smart mapping renderers supported in the current version. I understand that unique value renderer is important, we are working toward revamping the whole map widget for an upcoming release and we will try to eval and support that renderer. Until then, I request you to use a full fledged map authoring environment such as Pro or ArcGIS Online.

simoxu
by MVP Regular Contributor
MVP Regular Contributor

Thank you for clarifying that there are only 3 renderers available at this version. --- I kind of figured that out yesterday by reading the API source code of the function in the subject, not a very efficient way. 

I am making 2 points here:

Firstly, the document is not good enough for developers. I understand the development of the API in ESRI is moving fast, but the document should try to catch up. I hit many snags in using the API after switching from the ArcREST API in GitHub.

Secondly, I am not seriously authoring a map using the API. I am only trying to automate some analysis and visualize the result. Otherwise, I'll be using a desktop app to author the map. Desktop applications such as ArcMap and ArcGIS Pro are always superior in authoring a high quality map with dedicated layout.

I really see the great potential of ArcGIS Python API in Jupyter notebook, and glad to know there is a revamping of the map widget, which is the most exciting part of using the API in Jupyter environment.

Thanks.