Hi
I have a stream layer configured in web app builder.
data is related to ongoing trips tracking. stream layer only gets data related to active trips.
map is not clearing previous trips data(point)
can anyone suggest me where to clear the map graphics
Thanks
Solved! Go to Solution.
it solved by below lines in stream layer object
purgeOptions: {
displayCount: 2000,
age: 2.5
}
hi Robert thanks for your reply, can we able to add this line in WAB code or need to create a custom application
Thanks
Are you talking about a WAB app hosted on AGOL?
I downloaded WAB code from online, I'm trying to clear graphics clear in that code
Then yes it will require custom development to add that line.
Robert, I created a custom html page, where I need to add clear graphics line
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>StreamLayer-Simple</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.27/esri/css/esri.css">
<style type="text/css">
html,
body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
.banner {
margin-top: 5px;
margin-bottom: 5px;
color: #000080;
font-size: 2em;
font-weight: bold;
}
#mapDiv {
height: 90%;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
<script src="https://js.arcgis.com/3.27/"></script>
</head>
<body>
<div class="banner">
Scooter Data Stream Feed
</div>
<div id="mapDiv"></div>
</body>
<script type="text/javascript">
require([
"esri/map",
"esri/InfoTemplate",
"esri/layers/StreamLayer",
"dojo/domReady!"
], function(Map, InfoTemplate, StreamLayer){
var url = "http://abc.123.com/arcgis/rest/services/StatusinputStream/StreamServer";
var streamLayer = new StreamLayer(url, {
infoTemplate: new InfoTemplate("Attributes", "${*}")
});
var map = new Map("mapDiv", {
basemap: "topo",
center: [-90, 50],
zoom: 13
});
map.addLayer(streamLayer);
});
</script>
</html>
Then just call the clear method on the streamLayer object.
it solved by below lines in stream layer object
purgeOptions: {
displayCount: 2000,
age: 2.5
}