<commit_before># Esri Leaflet Stream
A plugin for Esri Leaflet that enables consuming [Stream Services](http://server.arcgis.com/en/geoevent-extension/latest/process-event-data/stream-services.htm) published by ArcGIS for Server. [View Demo](https://rowanwins.github.io/esri-leaflet-stream/example/)

### Basic Usage
**Step 1.** Include the required js in your document. 

```html
   	<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.

```js
	var buses = L.esri.streamFeatureLayer({
		url: 'https://geoeventsample3.esri.com:6443/arcgis/rest/services/SeattleBus/StreamServer'
	}).addTo(map);
```

### Background Information
[Esri Stream Services](http://server.arcgis.com/en/geoevent-extension/latest/process-event-data/stream-services.htm) 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](http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r300000288000000).



### Options
| 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](http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000n1000000) | 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](http://resources.arcgis.com/en/help/main/10.2/index.html#/SQL_reference_for_query_expressions_used_in_ArcGIS/00s500000033000000/) can be found here. |
| fields | Array | An array of fieldnames to pull from the service. Includes all fields by default. |

#### Example
```js
	var buses = L.esri.streamFeatureLayer({
		url: 'https://geoeventsample3.esri.com:6443/arcgis/rest/services/SeattleBus/StreamServer',
		useMapViewExtent: true,
		where: "BusNo='2679'",
		fields: ['BusNo', 'Heading'],
		pointToLayer: function (geojson, latlng) {<commit_msg>no message<commit_after># Esri Leaflet Stream
A plugin for Esri Leaflet that enables consuming [Stream Services](http://server.arcgis.com/en/geoevent-extension/latest/process-event-data/stream-services.htm) published by ArcGIS for Server. [View Demo](https://rowanwins.github.io/esri-leaflet-stream/example/)

### Basic Usage
**Step 1.** Include the required js in your document. 

```html
   	<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.

```js
	var buses = L.esri.streamFeatureLayer({
		url: 'https://geoeventsample3.esri.com:6443/arcgis/rest/services/SeattleBus/StreamServer'
	}).addTo(map);
```

### Background Information
[Esri Stream Services](http://server.arcgis.com/en/geoevent-extension/latest/process-event-data/stream-services.htm) 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](http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r300000288000000).



### Options
| 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](http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000n1000000) | 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](http://resources.arcgis.com/en/help/main/10.2/index.html#/SQL_reference_for_query_expressions_used_in_ArcGIS/00s500000033000000/) can be found here. |
| fields | Array | An array of fieldnames to pull from the service. Includes all fields by default. |

#### Example
```js
	var buses = L.esri.streamFeatureLayer({
		url: 'https://geoeventsample3.esri.com:6443/arcgis/rest/services/SeattleBus/StreamServer',
		useMapViewExtent: true,
		where: "BusNo='2679'",
		fields: ['BusNo', 'Heading'],
		pointToLayer: function (geojson, latlng) {
{'fraction_non_alphanumeric': 0.13036117381489842, 'fraction_numerical': 0.02784048156508653, 'mean_word_length': 4.453333333333333, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6376681', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1565, 'n_words': 483}