<?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: URL Parameters (?find and ?show) with ArcGIS API for JS in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128319#M75659</link>
    <description>&lt;P&gt;This functionality is already built into the browser.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams" target="_blank" rel="noopener"&gt;https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const params = new URLSearchParams(window.location.search)
const myParams = {}

for (let key of params.keys()) {
  myParams[key] = params.get(key)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We also have a util in the API that can help too.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-urlUtils.html#urlToObject" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-core-urlUtils.html#urlToObject&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const { query } = urlUtils.urlToObject(window.location.href)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you can use your URL parameters to write a query or navigate to a coordinate, create definition expressions, whatever floats your boat.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Dec 2021 15:32:57 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2021-12-22T15:32:57Z</dc:date>
    <item>
      <title>URL Parameters (?find and ?show) with ArcGIS API for JS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128248#M75655</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I’d like to use URL parameters (specifically &lt;STRONG&gt;?find=&lt;/STRONG&gt; and &lt;STRONG&gt;?show=&lt;/STRONG&gt;) in a map I’m building using the JS API.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Seems like this should be fairly standard (maybe even worthy of a pre-made widget?) but I’m not finding a current solution (lots of old posts using previous versions of js or the WAB, etc.).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For &lt;STRONG&gt;?find=&lt;/STRONG&gt; I have a points layer that I would like to query / pan / zoom to (e.g., &lt;EM&gt;&lt;STRONG&gt;?find=CB&lt;/STRONG&gt;&lt;/EM&gt;, which would zoom the map to the Chemistry Building (CB).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For &lt;STRONG&gt;?show=&lt;/STRONG&gt; I have about 10 layers that I would like to have the option of turning on (e.g., &lt;STRONG&gt;?&lt;/STRONG&gt;&lt;EM&gt;&lt;STRONG&gt;show=parking&lt;/STRONG&gt;&lt;/EM&gt;, which would turn On the parking layer).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anyone have any code samples of how to do this? Or able to direct me to a tutorial that would help?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(Or suggestions as to a better way to give users the ability to link directly to their desired map state?)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks in advance,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;~stefan&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 07:05:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128248#M75655</guid>
      <dc:creator>WWUMap</dc:creator>
      <dc:date>2021-12-22T07:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: URL Parameters (?find and ?show) with ArcGIS API for JS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128319#M75659</link>
      <description>&lt;P&gt;This functionality is already built into the browser.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams" target="_blank" rel="noopener"&gt;https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const params = new URLSearchParams(window.location.search)
const myParams = {}

for (let key of params.keys()) {
  myParams[key] = params.get(key)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We also have a util in the API that can help too.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-urlUtils.html#urlToObject" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-core-urlUtils.html#urlToObject&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const { query } = urlUtils.urlToObject(window.location.href)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you can use your URL parameters to write a query or navigate to a coordinate, create definition expressions, whatever floats your boat.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 15:32:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128319#M75659</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-22T15:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: URL Parameters (?find and ?show) with ArcGIS API for JS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128512#M75667</link>
      <description>&lt;P&gt;Thanks&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384" target="_self"&gt;&lt;SPAN class=""&gt;ReneRubalcava&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;I was trying to figure out the urlUtils last night..., but it's working now.&lt;/P&gt;&lt;P&gt;Any advice or recommendation for using urlUtils vs. URLSearchParams in the browser?&lt;/P&gt;&lt;P&gt;~stefan&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 00:25:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128512#M75667</guid>
      <dc:creator>WWUMap</dc:creator>
      <dc:date>2021-12-23T00:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: URL Parameters (?find and ?show) with ArcGIS API for JS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128653#M75673</link>
      <description>&lt;P&gt;Since you're already using the API, urlUtils would probably be the simplest route.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 16:12:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128653#M75673</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-23T16:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: URL Parameters (?find and ?show) with ArcGIS API for JS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128744#M75683</link>
      <description>&lt;P&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp; -&amp;nbsp; Follow-up question: The urlUtils is working great when there is a parameter added to the URL, but the map won't load if there is &lt;STRONG&gt;&lt;EM&gt;not&lt;/EM&gt; &lt;/STRONG&gt;a URL parameter. Is there a check/test that can deal with the default URL (without a parameter)?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Dec 2021 08:16:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1128744#M75683</guid>
      <dc:creator>WWUMap</dc:creator>
      <dc:date>2021-12-26T08:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: URL Parameters (?find and ?show) with ArcGIS API for JS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1129734#M75740</link>
      <description>&lt;P&gt;FOLLOW-UP SOLUTION (also from&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;) to the follow-up question on how to handle cases where there is &lt;STRONG&gt;&lt;EM&gt;not&lt;/EM&gt; &lt;/STRONG&gt;a URL parameter: use &lt;EM&gt;&lt;STRONG&gt;query?&lt;/STRONG&gt;&lt;/EM&gt; instead of just &lt;EM&gt;query&lt;/EM&gt;&amp;nbsp;in the const statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;const { query } = urlUtils.urlToObject(window.location.href) ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;const myUrlParm = &lt;STRONG&gt;query?&lt;/STRONG&gt;.find;&lt;/P&gt;&lt;P&gt;Thanks Rene&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 20:32:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/url-parameters-find-and-show-with-arcgis-api-for/m-p/1129734#M75740</guid>
      <dc:creator>WWUMap</dc:creator>
      <dc:date>2021-12-30T20:32:26Z</dc:date>
    </item>
  </channel>
</rss>

