<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating a featurelayer from an array of locations in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-a-featurelayer-from-an-array-of-locations/m-p/1133632#M75914</link>
    <description>&lt;P&gt;You can iterate over the array and add them to the source of the FeatureLayer.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const data = [
  { latitude: 59.441193, longitude: 24.729494 },
  { latitude: 59.432365, longitude: 24.742992 },
  { latitude: 59.431602, longitude: 24.757563 },
  { latitude: 59.437843, longitude: 24.765759 },
  { latitude: 59.439644, longitude: 24.779041 },
  { latitude: 59.434776, longitude: 24.756681 },
];

const featureLayer = new FeatureLayer({
  geometryType: "point",
  objectIdField: "OBJECTID",
  source: data.map((a) =&amp;gt; ({
    geometry: {
      type: "point",
      ...a,
    },
  })),
});&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 13 Jan 2022 21:47:42 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2022-01-13T21:47:42Z</dc:date>
    <item>
      <title>Creating a featurelayer from an array of locations</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-a-featurelayer-from-an-array-of-locations/m-p/1133593#M75911</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I was wondering if it would be possible to turn a 2d array of latitude and longitude into a featurelayer? Would this be difficult to accomplish? This is what the data looks like:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var data = [
        { "latitude": 59.441193, "longitude": 24.729494 },
        { "latitude": 59.432365, "longitude": 24.742992 },
        { "latitude": 59.431602, "longitude": 24.757563 },
        { "latitude": 59.437843, "longitude": 24.765759 },
        { "latitude": 59.439644, "longitude": 24.779041 },
        { "latitude": 59.434776, "longitude": 24.756681 }
    ];&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Jan 2022 20:26:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-a-featurelayer-from-an-array-of-locations/m-p/1133593#M75911</guid>
      <dc:creator>BushraSyed1</dc:creator>
      <dc:date>2022-01-13T20:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a featurelayer from an array of locations</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-a-featurelayer-from-an-array-of-locations/m-p/1133632#M75914</link>
      <description>&lt;P&gt;You can iterate over the array and add them to the source of the FeatureLayer.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const data = [
  { latitude: 59.441193, longitude: 24.729494 },
  { latitude: 59.432365, longitude: 24.742992 },
  { latitude: 59.431602, longitude: 24.757563 },
  { latitude: 59.437843, longitude: 24.765759 },
  { latitude: 59.439644, longitude: 24.779041 },
  { latitude: 59.434776, longitude: 24.756681 },
];

const featureLayer = new FeatureLayer({
  geometryType: "point",
  objectIdField: "OBJECTID",
  source: data.map((a) =&amp;gt; ({
    geometry: {
      type: "point",
      ...a,
    },
  })),
});&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Jan 2022 21:47:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/creating-a-featurelayer-from-an-array-of-locations/m-p/1133632#M75914</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-01-13T21:47:42Z</dc:date>
    </item>
  </channel>
</rss>

