Hi,
I am new to ArcGIS and trying to get the "CountryName" by clicking on a point on the map. How will I get the country name corresponding to the point that got clicked?
The below code shows the way I am displaying the wells on the Map and values I am getting from the database. I need to get the country name(like UnitedStates, Mexico...etc). So that I will query my own database base on this country name.
loadModules(
["esri/Map", "esri/views/MapView", "esri/Graphic", "esri/config"],
{
css: true,
}
).then(([Map, MapView, Graphic, esriConfig]) => {
const map = new Map({
basemap: "topo",
});
let view = new MapView({
container: this.mapRef.current,
map: map,
// ui: {
// components: ["attribution"],
// },
center: [-80, 35],
zoom: 3,
});
view.ui.move("zoom", "bottom-right");
let wellsInfo = this.props.wellsInfo;
let points = [];
let pointGraphics = [];
let count = 0;
if (wellsInfo.wells.length > 0) {
wellsInfo.wells.filter((wellObj) => {
count = count + 1;
let pointObj = {
type: "point",
longitude: wellObj.longitude,
latitude: wellObj.latitude,
wellId: wellObj.wellId,
};
points.push(pointObj);
});
console.log(count);
points.map((pointObj) => {
let pointGraphicObj = new Graphic({
geometry: pointObj,
symbol: {
type: "simple-marker",
color: "black",
size: 6,
outline: {
width: 0.5,
color: "black",
},
},
attributes: pointObj,
popupTemplate: {
// autocasts as new PopupTemplate()
title: "Well",
content: [
{
type: "fields",
fieldInfos: [
{
fieldName: "wellId",
},
{
fieldName: "longitude",
},
{
fieldName: "latitude",
},
],
},
],
},
});
pointGraphics.push(pointGraphicObj);
});
view.graphics.addMany(pointGraphics);