Update Renderer with Picture-Fill Symbol

436
1
03-02-2020 08:18 PM
RyanCain
New Contributor II

Hello! 

I have a quick question about how to properly set/update renderer. Specifically, I am trying to dynamically populate a the uniqueValueInfos field for a UniqueValueRender of a FeatureLayer at runtime with picture-fill symbols. (for background I consulted this post: Update a renderer's attribute | ArcGIS API for JavaScript 4.14 , but it does not directly deal with picture-fill symbols).

The reason I have to do this dynamically is because the url of the picture symbol gets dynamically generated based on information I query from another layer. Ultimately I have to dynamically generate hundreds of these URLs for picture-fill symbols, and I simply cannot do it manually ahead of time.

Thus, I do something like the following, where the variable boundary_changes is a featureLayer already added to my map with a unique-value renderer who's uniqueValueInfos is initialized as [ ].

Sadly though, ArcGis does not query my server for the images and all of the polygons are left without any fill. However, when I do the exact same thing with a simple-fill symbol (shown below) and give everything one color, it works fine.

So my question is this: can anybody tell me at what point an ArcGis PictureFillSymbol actually requests the image from the URL field? How should I update the renderer to properly load the images from their respective URLs?

I have tried calling the function refresh() on my feature layer after adding all the unique values hoping it would trigger the renderer to grab the images, but this still does not work.

If anybody has some advice on a potential solution or workaround, I would greatly appreciate it!

Also, please do not hesitate to comment if you want some additional information, I promise I will respond promptly.

Thank you so much in advance!

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Esteemed Contributor

Ryan,

   It sounds like the code may be having issues with accessing the image you are wanting to use in the picture fill symbol. If http://127.0.0.1:5000 is not the url your app is running from then you are likely hitting a cors issue. Can you test this using a url from esri?

0 Kudos