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

222
0
08-15-2022 08:43 PM
Storylm
New Contributor II

Hello everyone!

I am currently trying to categorize routes,  how do I determine which id the line is from the obtained route?Reference material: Closest facility routing .

Here is the code I am using:

const facilities = [
          {
            id: "school",
            center: [-122.67484, 45.52087],
          },
          {
            id: "library",
            center: [-122.68365, 45.52327],
          },
          {
            id: "playground",
            center: [-122.66406, 45.52378],
          },
          {
            id: "amusementPark",
            center: [-122.6631, 45.52093],
          },
          {
            id: "factory",
            center: [-122.66208, 45.5197],
          },
          {
            id: "hospital",
            center: [-122.66247, 45.51845],
          },
          {
            id: "market",
            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,
              },
            })
          );
        });
      }

 

0 Kudos
0 Replies