clear graphics in stream layer Web App builder code

331
8
Jump to solution
03-18-2019 08:55 AM
MRReddy
Occasional Contributor

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

0 Kudos
1 Solution

Accepted Solutions
MRReddy
Occasional Contributor

it solved by below lines in stream layer object

purgeOptions: {

displayCount: 2000,

age: 2.5

}

View solution in original post

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor
0 Kudos
MRReddy
Occasional Contributor

hi Robert thanks for your reply, can we able to add this line in WAB code or need to create a custom application

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Are you talking about a WAB app hosted on AGOL?

0 Kudos
MRReddy
Occasional Contributor

I downloaded WAB code from online, I'm trying to clear graphics clear in that code

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Then yes it will require custom development to add that line.

0 Kudos
MRReddy
Occasional Contributor

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>
0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Then just call the clear method on the streamLayer object.

0 Kudos
MRReddy
Occasional Contributor

it solved by below lines in stream layer object

purgeOptions: {

displayCount: 2000,

age: 2.5

}

0 Kudos