Hi,
I upgraded from 4.5 to 4.11, now PictureMarkerSymbol is not showing on the map, it's a client-side feature map, I confirmed my IIS is CORS enabled, and I even tried with esri image like this:
still not working, I didn't set render for this feature layer, the image is selected from a list of icons based on an attribute value. Now it just shows dots. Could anyone please help out? This issue already took me days. Below is my code for feature layer:
Attached screenshot. right side is working in 4.5, left side is not working in 4.11.
Thanks,
Benjamin
Solved! Go to Solution.
Then you can use a Unique Value Renderer.
It looks like you are trying to add the symbol to the graphic. When using a FeatureLayer, the symbol needs to be defined on the renderer of the layer. https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-SimpleRenderer.html
It would look something like this.
const renderer = {
type: "simple",
symbol: {
type: "picture-marker",
url: "https://static.arcgis.com/images/Symbols/Shapes/BlackStarLargeB.png",
contentType: "image/png",
width: this.config.iconWidth,
height: this.config.iconHeight
}
};
featureLayer = new FeatureLayer({
fields: this.config.layerDefinition.fields,
objectIdField: this.config.layerDefinition.objectIdField,
geometryType: "point",
id: this.config.layerId,
source: this._generateGraphics(this.config.view.zoom),
renderer: renderer, // Your renderer
popupTemplate: ({
title: "{CommunityName}" + " - Air Quality Health Index",
content: "{AQHI:getCommunityAqhiPopupContent}"
});
Hi Rene, thanks for your prompt reply. I cannot use Simple render because each graphic needs to use a different icon based on its attribute data, previous pasted code just for an example, below is actual code, it assigned a different icon to each graphics based their value dynamically:
for exmaple. if graphic aqhi value is 1, it's assigned aqhi1.png. It'w working fine is 4.5. Is in 4.11 feature layer must have a render?
Thanks,
Benjamin
Then you can use a Unique Value Renderer.
Thanks Rene, I will try it, should be the solution.