<?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 Does a featureLayer, based on a featureCollection, support query by ObjectID? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746143#M69019</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's possible to create a featureLayer on-the-fly using a featureCollection, as described at &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/FeatureLayerConst2" rel="nofollow" target="_blank"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/FeatureLayerConst2&lt;/A&gt;&lt;SPAN&gt;, which also mentions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="color: #000000; font-family: Lucida Grande;"&gt;The feature layer generates a unique object id for new features.&lt;/SPAN&gt;&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="color:#000000;"&gt;&lt;SPAN style="font-family:Lucida Grande;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color:#000000;"&gt;&lt;FONT face="Lucida Grande"&gt;Does not support queries that need to be performed on the server, e.g. queries with a where clause&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this mean that a featureLayer based on a featureCollection will not support &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/queryFeatures" rel="nofollow" target="_blank"&gt;featureLayer.queryFeatures&lt;/A&gt;&lt;SPAN&gt; based on query.objectIds as in this example?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; var query = new esri.tasks.Query(); query.objectIds = [features[0].attributes.OBJECTID]; query.outFields = [ "*" ]; // Query for the features with the given object ID featureLayer.queryFeatures(query, function(featureSet) { });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm seeing sporadic results, with the query sometimes working and sometimes not working. Unfortunately I don't have an easily reproducible piece of code that I can share.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any advice,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Feb 2013 23:19:26 GMT</pubDate>
    <dc:creator>StephenLead</dc:creator>
    <dc:date>2013-02-17T23:19:26Z</dc:date>
    <item>
      <title>Does a featureLayer, based on a featureCollection, support query by ObjectID?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746143#M69019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's possible to create a featureLayer on-the-fly using a featureCollection, as described at &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/FeatureLayerConst2" rel="nofollow" target="_blank"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/FeatureLayerConst2&lt;/A&gt;&lt;SPAN&gt;, which also mentions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="color: #000000; font-family: Lucida Grande;"&gt;The feature layer generates a unique object id for new features.&lt;/SPAN&gt;&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;&lt;SPAN style="color:#000000;"&gt;&lt;SPAN style="font-family:Lucida Grande;"&gt;&lt;/SPAN&gt;&lt;SPAN style="color:#000000;"&gt;&lt;FONT face="Lucida Grande"&gt;Does not support queries that need to be performed on the server, e.g. queries with a where clause&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this mean that a featureLayer based on a featureCollection will not support &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/queryFeatures" rel="nofollow" target="_blank"&gt;featureLayer.queryFeatures&lt;/A&gt;&lt;SPAN&gt; based on query.objectIds as in this example?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; var query = new esri.tasks.Query(); query.objectIds = [features[0].attributes.OBJECTID]; query.outFields = [ "*" ]; // Query for the features with the given object ID featureLayer.queryFeatures(query, function(featureSet) { });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm seeing sporadic results, with the query sometimes working and sometimes not working. Unfortunately I don't have an easily reproducible piece of code that I can share.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any advice,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 23:19:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746143#M69019</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2013-02-17T23:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Does a featureLayer, based on a featureCollection, support query by ObjectID?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746144#M69020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Steve,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want query to be done on client side then you can directly loop through graphics and find the graphic with the matching object id. How does it matter when you are doing query on the client side if you do it or api does it for you?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Rahul&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 01:57:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746144#M69020</guid>
      <dc:creator>RahulMetangale1</dc:creator>
      <dc:date>2013-02-19T01:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Does a featureLayer, based on a featureCollection, support query by ObjectID?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746145#M69021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Rahul,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Say I have 10,000 features to loop through until I find the right one - I'd assume that running a query by ObjectID would be a lot faster than having to process all of those features, and evaluate each one to check whether it has the right OID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 21:42:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746145#M69021</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2013-02-19T21:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Does a featureLayer, based on a featureCollection, support query by ObjectID?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746146#M69022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Steve, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you explain more as to "sporadic results"? I've been working on similar tasks but haven't seen issues (or at least I'm not paying attention if they are happening like you have..).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 21:56:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746146#M69022</guid>
      <dc:creator>LukePhilips</dc:creator>
      <dc:date>2013-02-19T21:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Does a featureLayer, based on a featureCollection, support query by ObjectID?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746147#M69023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I seem to have answered my own question, which is that a featureLayer based on a featureCollection &lt;/SPAN&gt;&lt;STRONG&gt;does&lt;/STRONG&gt;&lt;SPAN&gt; support query by objectID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Read on if you're interested in verifying this.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sample code &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.stephenlead.com/maps/featureLayerFromCollection.html" rel="nofollow" target="_blank"&gt;here&lt;/A&gt;&lt;SPAN&gt; - it's pretty rough, with no error checking, but here's how to demonstrate that it works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- an empty featureLayer is created when the map loads&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- hit the Find button at the top left of the map&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- any lakes with a name starting with "LAKE CR%" will be added to the feature layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- these are shown in pink on the map, and their ObjectIDs are written to the firebug console&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- make a note of one of the ObjectIds and enter it into the text box at the top left&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- hit the Query ObjectId button and see the results in the console&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you use the Find button again, it deletes the existing features and re-adds new features, which have incremented ObjectIds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my other code, I'm finding that in this case the queryFeatures function is not finding the new features (eg where objectId = 14). Since it's working correctly here, my "sporadic" problems must lie elsewhere in my code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Update: in my other code, I was only passing a single ObjectID object, rather than an array of [ObjectIds] as required. Strangely, this worked some of the time.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 23:04:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/does-a-featurelayer-based-on-a-featurecollection/m-p/746147#M69023</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2013-02-19T23:04:53Z</dc:date>
    </item>
  </channel>
</rss>

