<?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: How to select a MapWidget by custom widget in Experience Builder Custom Widgets</title>
    <link>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403798#M276</link>
    <description>&lt;P&gt;It looks like you have two side-by-side maps and you want to compare satellite images of different times. Have you looked at the Swipe Widget?&amp;nbsp;&lt;A href="https://doc.arcgis.com/en/experience-builder/latest/configure-widgets/swipe-widget.htm" target="_blank"&gt;https://doc.arcgis.com/en/experience-builder/latest/configure-widgets/swipe-widget.htm&lt;/A&gt;&amp;nbsp;It is designed for this purpose.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 13:27:43 GMT</pubDate>
    <dc:creator>JeffreyThompson2</dc:creator>
    <dc:date>2024-04-01T13:27:43Z</dc:date>
    <item>
      <title>How to select a MapWidget by custom widget</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403251#M274</link>
      <description>&lt;P&gt;I would like to provide a list of maps for the user to choose the map where the layer will be added.&lt;/P&gt;&lt;P&gt;1) In the setting/setting.tsx file we provide the selection the map to work with custom widget, then, all layers are added in this map.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lmotta_ibama_0-1711842462187.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99491i6888873F49F7272C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lmotta_ibama_0-1711842462187.png" alt="lmotta_ibama_0-1711842462187.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;I'd like you to be able to choose which map the image (satellite) is placed on in the custom widget.&lt;BR /&gt;At the moment, only ONE map can be used.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lmotta_ibama_0-1711843693312.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99493i6A2B9050DFC8705D/image-size/large?v=v2&amp;amp;px=999" role="button" title="lmotta_ibama_0-1711843693312.png" alt="lmotta_ibama_0-1711843693312.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;*&amp;nbsp;The satellite image is added when you click on the picture (&lt;SPAN&gt;Thumbnails&lt;/SPAN&gt;)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2024 00:10:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403251#M274</guid>
      <dc:creator>lmotta_ibama</dc:creator>
      <dc:date>2024-03-31T00:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a MapWidget by custom widget</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403798#M276</link>
      <description>&lt;P&gt;It looks like you have two side-by-side maps and you want to compare satellite images of different times. Have you looked at the Swipe Widget?&amp;nbsp;&lt;A href="https://doc.arcgis.com/en/experience-builder/latest/configure-widgets/swipe-widget.htm" target="_blank"&gt;https://doc.arcgis.com/en/experience-builder/latest/configure-widgets/swipe-widget.htm&lt;/A&gt;&amp;nbsp;It is designed for this purpose.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 13:27:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403798#M276</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2024-04-01T13:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a MapWidget by custom widget</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403889#M277</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/677423"&gt;@JeffreyThompson2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Swipe Widget tool would be great, but this tool uses a previously defined data source (setting).&lt;/P&gt;&lt;P&gt;The my customized widget, the user can add and remove layers (WebTileLayer), which means that my data is dynamic and not fixed (necessary for the Swipe tool).&lt;/P&gt;&lt;P&gt;One solution is to make it so that we can select the MapView we want to add the layers to.&lt;/P&gt;&lt;P&gt;I discovered the MapViewManager class (jimu-arcgis), which allows you to identify MapViews. I think I'll be able to solve the problem.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="2"&gt;GIS Developer &amp;amp; Environmental Analyst&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="2"&gt;Monitoring and Combat Division (DMV)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="2"&gt;National Center to Prevent and Combat Forest fires (Prevfogo)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="2"&gt;Brazilian Institute of Environment and Renewable Natural Resources (Ibama)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 16:01:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403889#M277</guid>
      <dc:creator>lmotta_ibama</dc:creator>
      <dc:date>2024-04-01T16:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a MapWidget by custom widget</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403924#M278</link>
      <description>&lt;P&gt;If you have found a solution you are happy with that way, go ahead, but if you would like to use a swipe here's another way.&lt;/P&gt;&lt;P&gt;Any of the features and widgets in the JavaScript API can also be used in Experience Builder. The API also has a Switch Widget. If you use the Switch from the API, it will be much easier to control programmatically.&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Swipe.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Swipe.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 16:46:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1403924#M278</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2024-04-01T16:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a MapWidget by custom widget</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1404073#M280</link>
      <description>&lt;P&gt;This widget by JS API would solve the problem of comparing layers (images).&lt;/P&gt;&lt;P&gt;Conceptually, the widget I'm developing is for using the Planet's daily images (choose and add/remove), so its scope is defined.&lt;/P&gt;&lt;P&gt;Another custom widget using the JS API with Swipe would be wonderful.&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="2"&gt;GIS Developer &amp;amp; Environmental Analyst&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="2"&gt;Monitoring and Combat Division (DMV)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="2"&gt;National Center to Prevent and Combat Forest fires (Prevfogo)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="2"&gt;Brazilian Institute of Environment and Renewable Natural Resources (Ibama)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 21:37:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1404073#M280</guid>
      <dc:creator>lmotta_ibama</dc:creator>
      <dc:date>2024-04-01T21:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a MapWidget by custom widget</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1405255#M282</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lmotta_ibama_1-1712155609143.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/99911i62CC3D3F1AA375FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="lmotta_ibama_1-1712155609143.png" alt="lmotta_ibama_1-1712155609143.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The answer is: Yes, we can select the MapWidget (map).&lt;BR /&gt;&lt;BR /&gt;The figure shows two maps and there is a Select Widget (custom widget), in which we can select the map (MapRef or Map1) to add the desired images (cliking in the satellite picture inside ScrollList).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;How?&lt;/P&gt;&lt;P&gt;The class (API) that allows you to manage MapWidgets is MapViewManager ('jimu-arcgis').&lt;BR /&gt;The instance of this class can be obtained by "MapViewManager.getInstance()",&amp;nbsp;I preferred to obtain the instance by accessing one of the MapView [1].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[1] Code:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;export default function Widget(props: AllWidgetProps&amp;lt;any&amp;gt;) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&amp;nbsp;const createMapView = () =&amp;gt; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;const handlerViewsCreate = (views:{ [viewId: string]: JimuMapView }) =&amp;gt; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;if( !views) return;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// Mapview Reference (use for "extension search" and "footprints")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const viewId = Object.keys( views )[0];&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const wmvRef = views[ viewId ];&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;// MapViews = { 'Map_Ref': wmvRef.view, 'Map_1': item1.view, ..., 'Map N': itemN.view ]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const wmvIds = Object.keys( wmvRef.mapViewManager.jimuMapViewGroups ).filter( item =&amp;gt; item !== wmvRef.mapWidgetId );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const mvOthers = wmvIds.map( item =&amp;gt; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;const id = Object.keys( wmvRef.mapViewManager.jimuMapViewGroups[ item ].jimuMapViews )[0];&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;return wmvRef.mapViewManager.jimuMapViewGroups[ item ].jimuMapViews[ id ].view;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const mvsRef = { 'MapRef': wmvRef.view };&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;let idKey = 0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const mvsMap = Object.fromEntries( mvOthers.map( mv =&amp;gt; [ 'Map' + ++idKey, mv ] ) );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;const mvs = { ...mvsRef, ...mvsMap };&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;setMapViews( mvs );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; if(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; ! props.hasOwnProperty('useMapWidgetIds') ||&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; ! props.useMapWidgetIds ||&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; props.useMapWidgetIds.length !== 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; ) return;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; return(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;JimuMapViewComponent&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; useMapWidgetId={props.useMapWidgetIds[0]}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; onViewsCreate={handlerViewsCreate}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; onActiveViewChange={handlerActiveViewChange}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; &amp;nbsp;/&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp; )&lt;BR /&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;export default function Widget(props: AllWidgetProps&amp;lt;any&amp;gt;) { return (&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;lt;div style={divStyle}&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;{ createMapView() }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;lt;label className={css}&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Apr 2024 15:33:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/how-to-select-a-mapwidget-by-custom-widget/m-p/1405255#M282</guid>
      <dc:creator>lmotta_ibama</dc:creator>
      <dc:date>2024-04-03T15:33:46Z</dc:date>
    </item>
  </channel>
</rss>

