Select to view content in your preferred language

Apply color in color field to stream layer

169
0
03-06-2024 05:34 AM
nhatquangho96
New Contributor

Here is what i obtained when i subscribe to my sreamserver: (https://...-geoevent...fr:6443/arcgis/rest/services/TrackPoint/StreamServer/subscribe)

{"geometry":{"x":4.424,"y":43.7625,"z":93.84,"spatialReference":{"wkid":4326}},"attributes":{"id":"001","timestamp":0,"colorRGB":"#0000ff","globalid":"{F4D861BD-1261-1AF5-8851-020F03DFE0BB}"}}
{"geometry":{"x":4.4293,"y":43.7548,"z":94.4449,"spatialReference":{"wkid":4326}},"attributes":{"id":"002","timestamp":0,"colorRGB":"#00ff00","globalid":"{84E0E7FD-0EE8-E6AA-47B8-F2AA3445764D}"}}


my code in js:

Create a SimpleMarkerSymbol
const symbol = new SimpleMarkerSymbol({
size: 10,

//color: "#0000ff",
});

Create a SimpleRenderer
const renderer = new SimpleRenderer({
symbol: symbol,
visualVariables: [{
type: "color",
field: "colorRGB",
}]
});

const streamLayerTrackPoint = new StreamLayer({
url: "https://polaris-geoevent.polaris.phedre.fr:6443/arcgis/rest/services/TrackPoint/StreamServer",
purgeOptions: {
displayCount: 10000
},
renderer: renderer
});

map.add(streamLayerTrackPoint);



The points displayed on the map are transparent, it seems that the color field "colorRGB" are not applied. I don't know why. Please help!!

0 Kudos
0 Replies