Select to view content in your preferred language

Can't plot polylines to a client-side streamlayer

308
1
Jump to solution
12-23-2024 04:11 PM
ironmaskito
Occasional Contributor

I have plotted points to a clientside streamlayer but can't plot lines. I've tried many variations of plotting lines, but can't get it to work. Adding to my confusion, the documentation suggests it should be possible but I cannot find any examples of clientside streamlayers consisting of lines rather than points. 

https://codepen.io/coxfsi/pen/JoPJEqz?editors=1001

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

There are couple of issues in the app you provided. 

1. Geometries of features added to the StreamLayer must be in the spatial reference of the view, because the layer's spatialReference is always set to the spatial reference of the view. To avoid overhead, the stream layer does not do any additional processing or reprojecting on features as they arrive. This behavior is documented here.  So you either need to use a basemap in WGS84 or your features need to have geometries in Web Mercator. 

2. StreamLayer.sendMessageToClient() states that when sending features message then your features have to be esri JSON feature object.

Based on this, I updated your codepen: https://codepen.io/U_B_U/pen/QwLqrpd?editors=1000

 

View solution in original post

1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there, 

There are couple of issues in the app you provided. 

1. Geometries of features added to the StreamLayer must be in the spatial reference of the view, because the layer's spatialReference is always set to the spatial reference of the view. To avoid overhead, the stream layer does not do any additional processing or reprojecting on features as they arrive. This behavior is documented here.  So you either need to use a basemap in WGS84 or your features need to have geometries in Web Mercator. 

2. StreamLayer.sendMessageToClient() states that when sending features message then your features have to be esri JSON feature object.

Based on this, I updated your codepen: https://codepen.io/U_B_U/pen/QwLqrpd?editors=1000