Select to view content in your preferred language

Stream Layer - I'm trying to access the raw meta data through the stream layer (via websockets & geoevent)

3122
5
Jump to solution
07-17-2015 07:37 AM
MikeCrook
Regular Contributor

Javascript API

The stream layer is working as expected. I created an Info Template that displays a pop-up information window when the point was clicked on. So I can see the raw data fields inside the info template pop-up window. But I'm trying to access the raw data fields from within my javascript code. Can anyone provide a snippet of how this is done?

0 Kudos
1 Solution

Accepted Solutions
MikeCrook
Regular Contributor

After much trying... I found that this data can be accessed through the stream layer "on" event by way of event return handler then using the graphics object of the stream layer. This took some work for being a newbie.

View solution in original post

0 Kudos
5 Replies
MikeCrook
Regular Contributor

After much trying... I found that this data can be accessed through the stream layer "on" event by way of event return handler then using the graphics object of the stream layer. This took some work for being a newbie.

0 Kudos
BanchanaPandey
Regular Contributor

Hi Mike,

are you using the latest version of jsapi 4.6 for Stream Layer? I am trying to achieve something similar but the api doesn't have much documentation on stream layers events. i tried using stramLayer.on("message",function (){})) but it is not working. There are no events on graphics in the latest 4.6 documentated in the api site. Can you please share more details on how you accomplished this?

Thanks!

0 Kudos
MikeCrook
Regular Contributor

Not knowing exactly what you are trying to perform... My last successful attempt was on version 3.XX. I was able to access some of this information by using the InfoTemplate Object (now called PopTemplate but still works similar on 4.X) during the initialization of the StreamLayer object. This allowed me use the Stream Layer object's click event:  streamLayerObj.on('click', function(evt){}); The 'evt' object within the function has an 'attributes' property that provides access to this information. For instance, 'evt.attributes.MyMetaData'. It should work in a similar fashion.Good luck!

BanchanaPandey
Regular Contributor

I was talking about message event that used to be there for StreamLayer which is not in 4.6 now, to access the raw data as it is streaming in through a stream server

0 Kudos
BanchanaPandey
Regular Contributor

I found that is a bug on jsapi 4.6 version where on data received on streamlayer will not work. this has been confirmed as bug. 

0 Kudos