ESRI v4.27
I have an array of JSON I'm using to create an array of Graphics to add to my FeatureLayer. The basic structure looks like this:
{
"geometry": {
"x": -8174819.943309489,
"y": 5027492.84864396,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
}
},
"attributes": {
"groupId": 16,
"Crash graphic": 17
},
"symbol": {
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriPMS",
"url": "https://crsms-dev.uconn.edu/collision-diagram-images/icons/CrashSymbols/Black/FrontToRear.png",
"width": 45,
"height": 45
}
}
I use this data to create a Graphic like so
private getGraphicFromLocal(graphic: any): Graphic {
const markerSymbol = new PictureMarkerSymbol({
width: graphic.symbol.width,
height: graphic.symbol.height,
url: graphic.symbol.url.replace('https://my-dev-server/collision-diagram-images/', '/assets/collision-diagram/'),
})
const localGraphic = {
...graphic,
geometry: {
...graphic.geometry,
type: 'point'
},
symbol: markerSymbol
};
return new Graphic(localGraphic);
}
The URLs resolve fine but for some reason I get a simple point symbol instead of the image stored at the URL. Any insight?
Some background context - I was initially creating a GraphicsLayer instead of a FeatureLayer but because the Editor class isn't compatible with GraphicsLayers I chose to switch.