I am using arcgisAPI 4.5.
I have two points on map view. I want to highlight second point using a flag/checkbox.
Do I need to remove all graphic on the screen and add them back again using a different marker symbol
or is there a way to identify and update the point using id ?
Here is my code :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Intro to graphics - 4.5</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/Graphic",
"dojo/domReady!"
], function(
Map, MapView, Graphic,
) {
var map = new Map({
basemap: "hybrid"
});
var view = new MapView({
center: [-80, 35],
container: "viewDiv",
map: map,
zoom: 3
});
createPoint(-49.97,41.73);
createPoint(-49.97,47.73);
function createPoint(lng, lat){
var point = {
type: "point",
longitude: lng,
latitude: lat
};
var markerSymbol = {
type: "simple-marker",
color: [226, 119, 40],
outline: {
color: [255, 255, 255],
width: 2
}
};
var pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol
});
view.graphics.add(pointGraphic);
}
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>