<?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: Newbie Question about toggling Feature Layers - JavaScript API in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424653#M39072</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In order for this toggle to work using feature layers that need explicit code to define the layer, outFields, popups or info windows, do I go ahed and define the layers as i would normally do so in my initialization of the map, such as below?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flayer = new esri.layers.FeatureLayer("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://mymapserver1/ArcGIS/rest/services/Amenities/AllAmenities_test/MapServer/8" rel="nofollow" target="_blank"&gt;http://mymapserver1/ArcGIS/rest/services/Amenities/AllAmenities_test/MapServer/8&lt;/A&gt;&lt;SPAN&gt;", {&lt;/SPAN&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoTemplate: popupTemplate,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields: ["NAME,ADDRESS,ZIPCODE,PHONE"]&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(flayer);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and then add the code to call the map service with that layer and other feature layers?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, i am getting confused.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Nov 2012 17:08:38 GMT</pubDate>
    <dc:creator>DavidLetz</dc:creator>
    <dc:date>2012-11-19T17:08:38Z</dc:date>
    <item>
      <title>Newbie Question about toggling Feature Layers - JavaScript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424648#M39067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I am on my second week of learning the API, and have questions about controlling visibility of Feature layers. I have seen examples of doing this with basemap layers, but not feature layers. For example, say I have a map service that has 5 feature layers (parks, hospitals, fire stations, etc) for a certain Texas county. I need a way for the user to 1) toggle the visibility of each feature layer, and 2) the feature layer that is visible be functional as far as info windows/popups working with the symbols on the layer. I found this page &lt;/SPAN&gt;&lt;A href="http://blogs.uww.edu/giscenter/2011/08/11/toggle-feature-layers-with-arcgis-javascript-api/"&gt;http://blogs.uww.edu/giscenter/2011/08/11/toggle-feature-layers-with-arcgis-javascript-api/&lt;/A&gt;&lt;SPAN&gt; but it is not making sense. Am I missing an example in the API samples that addresses this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your replies.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 15:02:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424648#M39067</guid>
      <dc:creator>DavidLetz</dc:creator>
      <dc:date>2012-11-15T15:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question about toggling Feature Layers - JavaScript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424649#M39068</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;BR /&gt;&lt;SPAN&gt;Toggling the visibility of feature layers is very similar to toggling the visibility of dynamic layers. There's an example &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/samples/map_explicitlayerlist/index.html" rel="nofollow noopener noreferrer" target="_blank"&gt;here&lt;/A&gt;&lt;SPAN&gt; that shows that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's also APIs you can use to do this like &lt;/SPAN&gt;&lt;A href="https://code.google.com/p/gmaps-utility-gis/" rel="nofollow noopener noreferrer" target="_blank"&gt;gmaps-utility-gis&lt;/A&gt;&lt;SPAN&gt;. It provides a table of contents to toggle layer visibility as seen in this &lt;/SPAN&gt;&lt;A href="http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/examples/toc.html" rel="nofollow noopener noreferrer" target="_blank"&gt;example&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On the maps I use I usually just put a checkbox for each layer with a class I know on them. Then I can attach an onclick event to those checkboxes like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.query(".layerSelectCheckbox").connect("onclick", function (ev) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* check layer visibility */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:09:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424649#M39068</guid>
      <dc:creator>MattO_Hara</dc:creator>
      <dc:date>2021-12-11T19:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question about toggling Feature Layers - JavaScript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424650#M39069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply. Being the noob that I am, what I really need is a way to toggle the fields of a feature layer. For instance, I have a feature layer for the parks in my county. I want the user to be able to find parks with certain attributes, like pinic areas, pavillions, baseball fields, etc. So whne they click the checkbox for "pavillions" those parks that have paviilions will be shown on the map. Same for any other attribute. I was looking at this sample as a possible way: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 17:12:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424650#M39069</guid>
      <dc:creator>DavidLetz</dc:creator>
      <dc:date>2012-11-16T17:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question about toggling Feature Layers - JavaScript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424651#M39070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for the reply. Being the noob that I am, what I really need is a way to toggle the fields of a feature layer. For instance, I have a feature layer for the parks in my county. I want the user to be able to find parks with certain attributes, like pinic areas, pavillions, baseball fields, etc. So whne they click the checkbox for "pavillions" those parks that have paviilions will be shown on the map. Same for any other attribute. I was looking at this sample as a possible way: &lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you thought about using the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/communities/local-government/"&gt;ArcGIS for Local Goverment&lt;/A&gt;&lt;SPAN&gt; templates? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;They have a &lt;/SPAN&gt;&lt;A href="http://localgovtemplates2.esri.com/ParkFinder/default.htm"&gt;Parks Finder Application&lt;/A&gt;&lt;SPAN&gt; that is very similar to what you have described. Fairly easy to set up.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 17:23:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424651#M39070</guid>
      <dc:creator>CraigMcDade</dc:creator>
      <dc:date>2012-11-16T17:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question about toggling Feature Layers - JavaScript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424652#M39071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unless you break your data out in to ... parks with slides, parks with picnic tables etc. as individual layers you are probably going to have to go under the hood a bit and figure out about definition queries.&amp;nbsp; That way, when a person clicks a radio button or checkbox etc that value gets added to the definition query to add that type.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At first the definition query would be something simple like FID &amp;gt;1 then when a person clicks the picnic table checkbox it would append "AND picnicfield is not null" etc.&amp;nbsp; There is a sample that uses definition queries here: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_layer_definition.html"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_layer_definition.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course, your attribute table of the parks will need to have the specific fields in there detailing what amenities are located at each park.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't perused the ArcGIS Online Map that mcdade31 mentioned, but it is also worth a look.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2012 18:26:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424652#M39071</guid>
      <dc:creator>PaulBushore</dc:creator>
      <dc:date>2012-11-16T18:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question about toggling Feature Layers - JavaScript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424653#M39072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In order for this toggle to work using feature layers that need explicit code to define the layer, outFields, popups or info windows, do I go ahed and define the layers as i would normally do so in my initialization of the map, such as below?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flayer = new esri.layers.FeatureLayer("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://mymapserver1/ArcGIS/rest/services/Amenities/AllAmenities_test/MapServer/8" rel="nofollow" target="_blank"&gt;http://mymapserver1/ArcGIS/rest/services/Amenities/AllAmenities_test/MapServer/8&lt;/A&gt;&lt;SPAN&gt;", {&lt;/SPAN&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoTemplate: popupTemplate,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields: ["NAME,ADDRESS,ZIPCODE,PHONE"]&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(flayer);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and then add the code to call the map service with that layer and other feature layers?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, i am getting confused.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 17:08:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/newbie-question-about-toggling-feature-layers/m-p/424653#M39072</guid>
      <dc:creator>DavidLetz</dc:creator>
      <dc:date>2012-11-19T17:08:38Z</dc:date>
    </item>
  </channel>
</rss>

