- Start the app
- Known issues
- Additional documentation
- Talk: Geolocating tweets in real time (in Spanish)
This node server behaves as a GeoEvent StreamServer layer, so it will emit geographic features in the Esri JSON format though a WebSocket. This way we will be able to display a real time layer in ArcGIS without an ArcGIS Enterprise stack.
It can be used with any ArcGIS developer technology or any other product. For example add the StreamServer to a webmap and visualize it in Operations Dashboard, ArcGIS Pro, any Storymap, etc.
We are assuming you are familiar with NodeJS, if you are not please read this first
- Check init.js and fill in SERVICE_CONF object properly.
const SERVICE_CONF = {
name : "twitter",
out_sr : {
wkid : 102100,
latestWkid : 3857
},
port : 9000,
host : process.env["NGROK"] || "localhost",
protocol : process.env["NGROK"] ? "https" : "http"
};
Be aware of the name : "twitter". It will be propagated below, in the instructions. If you want to use othe name, change it also along the instructions.
- Start the real time server:
node init.js "ws://localhost:8888" "4.11"
In this example ws://localhost:8888 is the websocket connection we want to consume data from. This websocket connection it's not the same as the one which will be exposed by StreamServer. But don't worry, all will be wired up (luckily)
It will check the websocket connection first. If it's any problem, it will notice it, and it will warn you :-)
If it's able to connect, it "automagically" set the fields for your StreamServer according to the payload received in the websocket connection attempted before.
- Start a web server:
cd example & http-server -p 9090
- Open: http://localhost:9090/
- Stream service url:
http://localhost:9000/arcgis/rest/services/twitter/StreamServer
If you want to test this from the sandbox sample you can also use ngrok
- Run:
ngrok http 9000
- Stop init.js and run
NGROK=yourid.ngrok.io node init.js "ws://localhost:8888" "4.11"
- Use:
https://yourid.ngrok.io/arcgis/rest/services/twitter/StreamServer
instead ofhttp://localhost:9000/arcgis/rest/services/twitter/StreamServer
UPDATE : Working in a version which can handle any version! Cross your fingers!
Before this commit on May 5, 2015 this streamserver was only working with JS API <= v4.8 and v3.x. If you want to know more you can also check this issue.
- ArcGIS Server > Stream services
- ArcGIS REST API > StreamServices
- Awesome ArcGIS > GeoEvent Server
- Awesome ArcGIS > Internet of things (IoT) & Real-time (RT)
- Public stream services in ArcGIS Online
- Pubnub & Esri
- Search more about "Stream services"
En la charla Geolocalizando tweets en tiempo real del día día 24 de Julio de 2019 se explicó:
- Objetivos y resultados del experimento
- Cómo lanzar el proyecto
- Demo: Cargar los tweets en una StreamLayer
- Demo: Cargar los tweets en un Web map
- Demo: Cargar los tweets con gráficar en tº real
- Diagrama del comportamiento de twitter-rt-service
- Mejoras pendientes en twitter-rt-service
- Diagrama del comportamiento de arcgis_websocket_server
- Mejoras pendientes en arcgis_websocket_server
- Estructura de ficheros del proyecto: twitter-rt-service
- Explicación del código: twitter-rt-service
- Estructura de ficheros del proyecto: arcgis_websocket_server
- Explicación del código: arcgis_websocket_server
- Despedida, preguntas y agracedimientos
A continuación puede encontrar el vídeo en Youtube con un índice interactivo en la descripción del vídeo: