'Need to add multiple point of location on ArcGIS map. Using a package esri-loader-hooks for React
I need to create a map using ArcGIS in React. i'm using a package esri-loader-hooks i need to add multiple point of location on map im currently using useGraphic for the map. But i can only add one point to map. need to add multiple point.
import "./App.css";
import {
useMap,
useGraphic,
} from "esri-loader-hooks";
function Map() {
const data = [
{ latitude: 40.7128, longitude: 74.006 },
{ latitude: -27.84115002878925, longitude: 30.24263351745168 },
{ latitude: -25.84115002878925, longitude: 70.24263351745168 },
];
const map = {
basemap: "gray-vector",
};
const options = {
view: {
center: [-118.805, 34.027],
zoom: 10,
},
};
const geometry = {
type: "point",
latitude: data?.[0]?.latitude,
longitude: data?.[0]?.longitude,
};
var symbol = {
type: "simple-marker",
color: [226, 119, 40],
};
const pointer = { geometry, symbol };
const [ref, view] = useMap(map, options);
useGraphic(view, pointer);
return <div className="App" ref={ref}></div>;
}
export default Map;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
