Select to view content in your preferred language

AVL data live feed

4036
10
Jump to solution
02-15-2017 10:10 AM
jaykapalczynski
Honored Contributor

Looking for any thoughts or comments on displaying AVL location data in Javascript.  I am looking to display 10+ vehicles by vehicle number, BUT only the most recent recorded position.  The SQL View I have has all the records but just want the newest.  This SQL Data also has the XY coordinate.  I do not have this in a Map Service at this point.  Just starting and looking for ideas.

Can I do this from a SQL View?

Do I need to have a Map Service?

Can I have to option of displaying the last 5 hrs, or 20 hrs etc.

Has anyone done this before?  Please Help

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Jay,

   I think you can create a spatial view and set the refresh rate but as I said I don't use that route so I can not provide guidence there.

My route with the asp.net webservice uses a esriRequest in a setTimeout. The esriRequest returns a json object/string that is parsed into a feature collection.

View solution in original post

0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus

Jay,

   I have an AVL system for my Sheriff vehicles and a SQL View that only has the most current vehicle positions. I then have an asp.net web service that returns this data in json format that I use an esriRequest to get, and build a clinetside FeatureLayer using a FeatureCollection to display on my map. I go this idea from tsellste‌, in his app he uses a MapService though. 

jaykapalczynski
Honored Contributor

Doing research this does not seem that hard to do....my only real issue is getting the data in the view to something readable by "FeatureCollection" which I think just creates a graphics layer right?

I guess json is the way to go?  

I assume the asp/net webservice runs every X amount of time recreating the json file?  Upon refresh the json files is rendered...how is this automated?  Does it work on the fly or upon refresh?

0 Kudos
jaykapalczynski
Honored Contributor

Wait....cant i simply make a spatial view from the data itself and publish that to a webservice?  Set some sort of refresh of the rendering in the app?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jay,

   I think you can create a spatial view and set the refresh rate but as I said I don't use that route so I can not provide guidence there.

My route with the asp.net webservice uses a esriRequest in a setTimeout. The esriRequest returns a json object/string that is parsed into a feature collection.

0 Kudos
TomSellsted
MVP Alum

Jay,

I have two separate feature classes that I use, vehicles and positions.  Vehicles contains the most current position information.  Positions is all of the historic GPS information.  This makes my ability to display the current position very simple.  I don't have to query this positions table for the most current position.

Going forward, I think WebSockets will be the way to go.  It is somewhat chatty, but the messages will be only sending updates rather than querying the entire feature class every so many seconds.  The GeoEvent server uses websockets.

Regards,

Tom

jaykapalczynski
Honored Contributor

So If I have a SQL view of the data.  How do I publish that into a feature service?  I have X and Y , and other fields.  Looked into GeoEvent but thats a little out of my price range right now.

0 Kudos
jaykapalczynski
Honored Contributor

Right now the data is on a different server than my install of SDE...I imagine if I create a View in the SDE server over to the other server with the data I am going to take a performance hit.

Would I create a spatial view publish that?  But with the data on another server I think the performance will suffer?

0 Kudos
AndrewFarrar
Frequent Contributor

I've not had experience with integrating an AVL system, but just a thought, could you use an SQL SELECT DISTINCT statement on your view in order to pull just the first record for each matching id?  You would still have to have  refresh on the services, but that could be a crude way of getting just the data that you need.  

0 Kudos
JordanBaumgardner
Frequent Contributor

If you have the GeoEvent Extention/Server, it's really easy.

-Setup GeoEvent Extention

-Create an input of a feature class. Set it to pull the rec with the greatest time.

-Create a Stream output layer

-Tie the two together with (I can't remember the name) "mapping" tool. It maps an input to an output and allows processing.

-Connect your JS to the Stream layer.