Receiving coordinates over TCP/IP stack

829
3
06-22-2020 03:36 AM
DejanBordjoski
New Contributor

I have an application which is calculating coordinates and I need some asynchronous service which will receive calculated locations over TCP/IP stack and display a marker on my map. Seems like a simple task, but I am having trouble finding suitable functionality in ArcGIS QT runtime cpp API (100.8.0).

0 Kudos
3 Replies
by Anonymous User
Not applicable

I think the easiest solution would be to convert your incoming point data to Point objects, and then add those objects to a GraphicsOverlay. Here's a sample from the samples repo on how to render points programmatically:

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/DisplayInformation/GOSymbols at master · Esr... 

0 Kudos
DejanBordjoski
New Contributor

Problem is my application needs to run in real-time, "service" should trigger every time I receive new coordinates. I am not sure how to update my GraphicsOverlay every few milliseconds.

 

In the provided ArcGIS samples I could only find something like ProjectGeometry::onMouseClicked(QMouseEvent& event) method, which will update GraphicsOverlay on a mouse click. Or with DisplayDeviceLocation::startLocationDisplay() method you can update graphics according to the devices GPS sensor reading. I would like to do something similar to this but my method needs to trigger on received TCP packages.

0 Kudos
by Anonymous User
Not applicable

I think I see! There's no arbitrary TCP packet read provided by ArcGIS itself. Normally you would be expected to utilize a well known format/service like a ServiceFeatureTable, WFS Service, or use KML Network links.

Having said that, Qt itself provides QTcpSocket and QSctpSocket. You can set up a socket to listen for incoming packets using "bind" or "connectToHost". Then if you connect a callback to the inherited signal QIODevice::readyRead, you would then be able to react asynchornously to incoming data by parsing the incoming packet and inserting a point into the GraphicsOverlay or FeatureTable.