<?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: map.getLayer(id) always retuns null in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677040#M15194</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then could you please suggest me the way to perform Definition query on the sublayer of map service ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think that only setting &amp;lt;featureLayer&amp;gt;.url (&amp;lt;layerpath&amp;gt;) and &amp;lt;featureLayer&amp;gt;.definitionexpression wont surve the purpose ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please suggest.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lu.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Jun 2011 04:58:13 GMT</pubDate>
    <dc:creator>NitinBele</dc:creator>
    <dc:date>2011-06-27T04:58:13Z</dc:date>
    <item>
      <title>map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677036#M15190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to access a layer from my mapservice so that I can query and apply definition expression to it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I am always getting null valye when I access map.getLayer("id") method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help on the right direction is greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jesse&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2011 01:40:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677036#M15190</guid>
      <dc:creator>JesseMetcalfe</dc:creator>
      <dc:date>2011-06-24T01:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677037#M15191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my case I want to access sublayer from a parent layer in the map service.I m too getting null reference when I fire map.getLayer() function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help please ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lucas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2011 04:47:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677037#M15191</guid>
      <dc:creator>NitinBele</dc:creator>
      <dc:date>2011-06-24T04:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677038#M15192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jesse,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Make sure you are passing the getlayer the name of the Map Service as you have it named in the app.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;esri:ArcGISDynamicMapServiceLayer id="Parcels" url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer"/&amp;gt;
var arc:ArcGISDynamicMapServiceLayer = map.getLayer("Parcels") as ArcGISDynamicMapServiceLayer();&amp;nbsp; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677038#M15192</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T04:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677039#M15193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Lucas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; You can not retrieve a sublayer from the map using this or any function, only a whole Map Service.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2011 11:04:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677039#M15193</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2011-06-24T11:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677040#M15194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then could you please suggest me the way to perform Definition query on the sublayer of map service ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think that only setting &amp;lt;featureLayer&amp;gt;.url (&amp;lt;layerpath&amp;gt;) and &amp;lt;featureLayer&amp;gt;.definitionexpression wont surve the purpose ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please suggest.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lu.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jun 2011 04:58:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677040#M15194</guid>
      <dc:creator>NitinBele</dc:creator>
      <dc:date>2011-06-27T04:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677041#M15195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just to mention that My map service has 4 feature classes (0,1,2,3) and 3 tables (4,5,6).My requirement is to define query on featureclass -1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I know that var layer:ArcGISDynamicMapServiceLayer = map.getLayer("Parcels") as ArcGISDynamicMapServiceLayer(); will give me reference of Map Service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do I have to publish that feature class seperately ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lu.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jun 2011 05:01:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677041#M15195</guid>
      <dc:creator>NitinBele</dc:creator>
      <dc:date>2011-06-27T05:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677042#M15196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Lu,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; You said &lt;/SPAN&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;My requirement is to define query on featureclass -&amp;nbsp; 1&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt; Well the QueryTask allows you to specify the exact layer of&amp;nbsp; the map service that you which to query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Set the URL to the ArcGIS Server REST resource that represents a single layer or table, e.g.&amp;nbsp; &lt;A href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5&lt;/A&gt;.&amp;nbsp; Note the number "5" at the end of the URL which indicates which&amp;nbsp; specific layer you want to query when querying a map service or a&amp;nbsp; feature service.&amp;nbsp; For an image server, the map service itself is the 'single' layer, so&amp;nbsp; the URL would end with "/MapServer" (without a number).&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;Now if you only want to visually display a particular layer of a map service on the map than setting the layerDefinitions for the ArcGISDynamicMapServiceLayer is the way to go. A featurelayer is a option but this places all the rendering strain on the client machine and is be overkill for your requirement.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGISDynamicMapServiceLayer info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer.html"&gt;http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;QueryTask Info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/tasks/QueryTask.html"&gt;http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/tasks/QueryTask.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jun 2011 11:04:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677042#M15196</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2011-06-27T11:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677043#M15197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Robert, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That was really helpfull.However I am using FeatureLayer for defining expression and I need to move to layerDefinition.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did not fully understood the concept of layerDefinitions though.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;let say my map service is -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;address&amp;gt;/ArcGIS/rest/services/XYZ/MapServer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It has three Feature Classes - &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a - &amp;lt;address&amp;gt;ArcGIS/rest/services/XYZ/MapServer/0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;b - &amp;lt;address&amp;gt;ArcGIS/rest/services/XYZ/MapServer/1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;c - &amp;lt;address&amp;gt;ArcGIS/rest/services/XYZ/MapServer/2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I want to assign LayerDefinition expression (Name = "ABC") to &amp;lt;address&amp;gt;ArcGIS/rest/services/XYZ/MapServer/1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then what should go to my layerDefinitions array ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myDynamicLayer.layerDefinitions = [&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; null,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Name = 'ABC'",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; null,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please suggest ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jun 2011 03:57:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677043#M15197</guid>
      <dc:creator>NitinBele</dc:creator>
      <dc:date>2011-06-29T03:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677044#M15198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Lu,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; The layerDefinitions array is a array that contains a sql statement for every layer in the map service. In your case it would look like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;myDynamicLayer.layerDefinitions = [null, "NAME = 'ABC'", null];&lt;/PRE&gt;&lt;SPAN&gt;&lt;FONT face="monospace"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jun 2011 11:58:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677044#M15198</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2011-06-29T11:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677045#M15199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Robert, it worked like charm.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lucas.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2011 05:15:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677045#M15199</guid>
      <dc:creator>NitinBele</dc:creator>
      <dc:date>2011-07-06T05:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677046#M15200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Lucas,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; You can not retrieve a sublayer from the map using this or any function, only a whole Map Service.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this real? can't we retrieve the state of any FeatureLayer? Where do we can find this limitation on the documentation Robert?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ezequias&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2014 16:06:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677046#M15200</guid>
      <dc:creator>EzequiasRodrigues_da_Rocha</dc:creator>
      <dc:date>2014-04-28T16:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: map.getLayer(id) always retuns null</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677047#M15201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ezequias,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; The name "layer" is used by the API in a way that can be confusing. Think of a layer as more of a map service in MOST cases. When working with an ArcGISDynamicMapServiceLayer you are not able to get reference to an individual sublayer of the map service by using map.getLayer function. Using ArcGISDynamicMapServiceLayer you can get access to the sublayers visibility and you can set the layer definition but not a lot more. You can not really call this a limitation that is stated in the documentation, it is more of understanding what abilities the ArcGISDynamicMapServiceLayer actually has by reading the docs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2014 23:59:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/map-getlayer-id-always-retuns-null/m-p/677047#M15201</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-04-28T23:59:39Z</dc:date>
    </item>
  </channel>
</rss>

