Hello!
I am building a web app that uses point location data from an API endpoint we have. The data return is in JSON format and includes fields for latitude and longitude. I would like the user to be able to draw a circle of a user-chosen radius and export the selected points as a csv (or be able to display the selected in a table and download from there).
So far, I am able to take the API's return and plot the points on a map using GraphicsLayer() and looping through the results to plot them:
const popupMemberLocs = new PopupTemplate({
title: "{name}",
content: [{
title: "{name}",
content: "<b>Member Type:</b> {provType} <br/>" +
"<b>Specialty:</b> {specialty} <br/><br/>" +
"<b>Address:</b><br/> {address}"
}]
})
let memberLocations = new GraphicsLayer();
apiReturn.forEach(point => {
const graphic = new Graphic({
geometry: {
type: 'point',
longitude: point.GCD_LONGITUDE,
latitude: point.GCD_LATITUDE
},
symbol: {
type: "simple-marker",
color: "red",
size: "8px"
},
attributes: {
name: point.FIRST_NAME + " " + point.LAST_NAME,
memType: point.MEM_TYPE_DESC,
specialty: point.MEM_SPECIALTY_DESC,
address: point.GCD_STREET_ADDRESS + " " +
(point.GCD_SUBADDRESS ? point.GCD_SUBADDRESS : " ") + "<br/>" +
point.GCD_CITY + ", " +
point.GCD_ST_ABBR + " " +
point.GCD_ZIPCODE
},
popupTemplate: popupMemberLocs
});
memberLocations.add(graphic)
});
map.add(memberLocations);
Where should I go from here? The samples I've come across seem to mostly utilize hosted feature layers, so I'm hoping I may have missed one about JSON, or there's a different method of getting the points and their attributes onto a map that's more flexible.
Thank you!