<?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: Removing duplicates from an array in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367511#M34087</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are a couple of ways to do this, like &lt;A href="https://gist.github.com/aram208/6589215"&gt;this&lt;/A&gt; or &lt;A href="http://stackoverflow.com/questions/13486479/how-to-get-an-array-of-unique-values-from-an-array-containing-duplicates-in-java"&gt;this&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Nov 2014 15:19:18 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2014-11-10T15:19:18Z</dc:date>
    <item>
      <title>Removing duplicates from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367510#M34086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert, et al&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On further testing (click on the 3rd button "city models") I see that there are duplicates in my object ids which are being used to create the countries layer.&amp;nbsp; This causing my application to run slow.&amp;nbsp; A look at the console.log of the featureCollection on line 300 rquery.run(function(error, featureCollection, response) will show what I mean&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to remove the duplicates (so there is only one objectid per country) before the layer is added to my map?&lt;/P&gt;&lt;P&gt;Spec attached&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 04:37:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367510#M34086</guid>
      <dc:creator>joepublic</dc:creator>
      <dc:date>2014-11-04T04:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367511#M34087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are a couple of ways to do this, like &lt;A href="https://gist.github.com/aram208/6589215"&gt;this&lt;/A&gt; or &lt;A href="http://stackoverflow.com/questions/13486479/how-to-get-an-array-of-unique-values-from-an-array-containing-duplicates-in-java"&gt;this&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 15:19:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367511#M34087</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2014-11-10T15:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367512#M34088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestions Ken.&lt;/P&gt;&lt;P&gt;But my question is for a specific case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is here: rquery.objectIds();... This creates an&lt;/P&gt;&lt;P&gt;array of opjectIds with dupes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to  remove the dupes before I pass the array to :&lt;/P&gt;&lt;P&gt;countries = L.geoJson(featureCollection).addTo(map);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 16:18:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367512#M34088</guid>
      <dc:creator>joepublic</dc:creator>
      <dc:date>2014-11-10T16:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367513#M34089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The above examples could be tweaked a little for that.&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14156376423064799" jivemacro_uid="_14156376423064799"&gt;
&lt;P&gt;var unique = {};&lt;/P&gt;
&lt;P&gt;var distinctFeatures = featuresCollection.features.filter(function(feature) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var oid = feature.properties.OBJECTID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if (!unique[oid]) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unique[oid] = oid;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return false;&lt;/P&gt;
&lt;P&gt;});&lt;/P&gt;
&lt;P&gt;featureCollection.features = distinctFeatures;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;That's a quick and dirty way of doing it based on the example Ken provided.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 16:40:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367513#M34089</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2014-11-10T16:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Removing duplicates from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367514#M34090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rene!!&lt;/P&gt;&lt;P&gt;I work with this and let you know if I still problems&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 17:02:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/removing-duplicates-from-an-array/m-p/367514#M34090</guid>
      <dc:creator>joepublic</dc:creator>
      <dc:date>2014-11-10T17:02:25Z</dc:date>
    </item>
  </channel>
</rss>

