Select to view content in your preferred language

Want to add id to the target point, how do I determine which id the line is from the obtained route?

344
0
08-01-2022 07:47 PM
Storylm
Occasional Contributor

document Link: https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ClosestFacilityParameters.html

 

 

 

const facilities = [
          {
            id: "a",
            center: [-122.67484, 45.52087],
          },
          {
            id: "b",
            center: [-122.68365, 45.52327],
          },
          {
            id: "c",
            center: [-122.66406, 45.52378],
          },
          {
            id: "d",
            center: [-122.6631, 45.52093],
          },
          {
            id: "e",
            center: [-122.66208, 45.5197],
          },
          {
            id: "f",
            center: [-122.66247, 45.51845],
          },
          {
            id: "g",
            center: [-122.66299, 45.51827],
          },
        ];

 function addFacilityGraphics() {
facilities.forEach((point) => {
facilitiesLayer.graphics.add(
new Graphic({
id: point.id
symbol: {
type: "web-style",
name: "grocery-store",
styleName: "Esri2DPointSymbolsStyle",
},
geometry: {
type: "point",
longitude: point.center[0],
latitude: point.center[1],
spatialReference: view.spatialReference,
},
})
);
});
}

 

 

Tags (2)
0 Kudos
0 Replies