<?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 get feature from objectid directly in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360141#M83096</link>
    <description>&lt;P&gt;Hi, I cannot figure out how to get feature in a layer or layerview from objectid directly, some function like "layerView.getFeatureById(objectid)".&amp;nbsp; I store the objectids in array but I don't know how to get the features back later. Could you help me, thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2023 04:04:45 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2023-12-13T04:04:45Z</dc:date>
    <item>
      <title>get feature from objectid directly</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360141#M83096</link>
      <description>&lt;P&gt;Hi, I cannot figure out how to get feature in a layer or layerview from objectid directly, some function like "layerView.getFeatureById(objectid)".&amp;nbsp; I store the objectids in array but I don't know how to get the features back later. Could you help me, thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 04:04:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360141#M83096</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-12-13T04:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: get feature from objectid directly</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360255#M83101</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;There is a method named queryFeatures() on many of the layer types where you can pass in a Query object defining a query with the object id you are looking for.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You'll first need to define a Query and then pass that query as a parameter into queryFeatures().&amp;nbsp; One thing to look out for is the casing for the ObjectID field can be different depending on the environment hosting the service. So you might want to log out the layers fields or look at the REST enpoint of the service to match the casing for ObjectID. (OBJECTID, ObjectID, etc...)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const query = new Query();
query.where = "OBJECTID = 49"

layer.queryFeatures(query).then((results) =&amp;gt; {
  console.log(results.features);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 14:23:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360255#M83101</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2023-12-13T14:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: get feature from objectid directly</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360426#M83109</link>
      <description>&lt;P&gt;Everything said here is accurate, but the nuances of the OID field name can be avoided by using &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#objectIds" target="_self"&gt;query.objectIds&lt;/A&gt; instead of &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#where" target="_self"&gt;query.where&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 17:24:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360426#M83109</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-12-13T17:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: get feature from objectid directly</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360709#M83113</link>
      <description>&lt;P&gt;Thank you both!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 02:21:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1360709#M83113</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-12-14T02:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: get feature from objectid directly</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1586103#M86526</link>
      <description>&lt;P&gt;This was helpful. I'm working only with JS API with our own GeoJSON data (not using ArcGIS portal or anything). The "&lt;SPAN&gt;nuances of the OID field" have been driving me crazy.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2025 18:44:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-feature-from-objectid-directly/m-p/1586103#M86526</guid>
      <dc:creator>AndyGorman</dc:creator>
      <dc:date>2025-02-17T18:44:25Z</dc:date>
    </item>
  </channel>
</rss>

