![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
esri-leaflet-stream
Advanced tools
Plugin for consuming streaming data from ArcGIS for Server via a socket connection
A plugin for Esri Leaflet that enables consuming Stream Services published by ArcGIS for Server. View Demo
Step 1. Include the required js in your document.
<script src="dist/esri-leaflet-stream.min.js"></script>
Step 2. Create a stream layer using the L.esri.streamFeatureLayer
function, the socket connection is started automatically when the layer is added to the map.
var buses = L.esri.streamFeatureLayer({
url: 'https://geoeventsample1.esri.com:6443/arcgis/rest/services/LABus/StreamServer'
}).addTo(map);
Esri Stream Services provide a convenient way to consume streaming data published via the GeoEvent Extension with ArcGIS for Server. Basically they continually send data to the website which you can then use however you'd like. For more information also check out the REST API.
Option | Type | Description |
---|---|---|
url | String | Required The service url of a streaming layer eg https://geoeventsample3.esri.com:6443/arcgis/rest/services/SeattleBus/StreamServer |
useMapViewExtent | Boolean | Applies a geographic filter meaning data is only sent for the current map view (note: the extent updates as the map is panned and zoomed). Defaults to false. |
customExtent | Envelope Object | An Esri envelope to spatial restrict the features. Not set by default. |
where | String | An optional expression to filter features server side. String values should be denoted using single quotes ie: where: "FIELDNAME = 'field value'" ; More information about valid SQL syntax. |
fields | Array | An array of fieldnames to pull from the service. Includes all fields by default. |
wss | Boolean | Whether to use secure protocol or not. Set to false as default. |
var buses = L.esri.streamFeatureLayer({
url: 'https://geoeventsample1.esri.com:6443/arcgis/rest/services/LABus/StreamServer',
useMapViewExtent: true,
where: "run_id='76_173_1'",
fields: ['run_id', 'heading'],
pointToLayer: function (geojson, latlng) {
return L.circleMarker(latlng, {
fillColor: createRandomFill(),
fillOpacity: 0.8,
color: "#cccccc",
weight: 2
});
},
}).addTo(map);
Method | Description |
---|---|
setCustomExtent(<Envelope Object>) | Set a new custom extent for the socket connection. |
clearCustomExtent() | Removes the custom extent meaning no geographic filter will be applied to the socket connection. |
useMapViewExtent(Boolean) | Set whether to use the map view extent as a geographic filter for the socket connection, this updates automatically as the map is zoomed and panned. |
setWhere(String) | Sets a where clause on the socket connection to limit data received by the socket connection. |
clearWhere() | Remove the where clause from the socket connection. |
clearLayers() | Clears the layers drawn by the socket connection. |
var buses = L.esri.streamFeatureLayer({
url: 'https://geoeventsample1.esri.com:6443/arcgis/rest/services/LABus/StreamServer'
}).addTo(map);
buses.setWhere("run_id='76_173_1'");
buses.useMapViewExtent(false);
Event | Description |
---|---|
socketConnected | The socket connection has successfully connected. |
socketError | The socket connection failed to connect. |
socketMessage | A message was received by the socket connection, returns an object containing the geojson feature as well as the resulting leaflet layer. |
socketUpdated | A message confirming that the socket connection has been updated, triggered when the filters change. |
function msgEvent (msgDetails) {
console.log(msgDetails.feature);
console.log(msgDetails.layer);
}
buses.on('socketMessage', msgDetails);
Huge hats off go to mourner and all the contributors to the leaflet.js project! Additional thanks to the folks involved in esri-leaflet for making it super easy to work with services published from the Esri stack.
FAQs
Plugin for consuming streaming data from ArcGIS for Server via a socket connection
The npm package esri-leaflet-stream receives a total of 0 weekly downloads. As such, esri-leaflet-stream popularity was classified as not popular.
We found that esri-leaflet-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.