<?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 Experience Builder MediaLayerView in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-medialayerview/m-p/1657347#M21104</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am using v1.19 and JS API 4.33 and was trying to develop custom widget similar to this&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-medialayer-interactive/live/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/layers-medialayer-interactive/live/&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My steps&lt;/P&gt;&lt;P&gt;a. upload image file using drag/drop functionality&amp;nbsp;&lt;/P&gt;&lt;P&gt;b. geoprocess the image&amp;nbsp;&lt;/P&gt;&lt;P&gt;c. Need to perform tranform interaction options (dr&lt;/P&gt;&lt;P&gt;import { React, AllWidgetProps, jsx } from 'jimu-core';&lt;BR /&gt;import { JimuMapViewComponent, JimuMapView } from 'jimu-arcgis';&lt;BR /&gt;import { Button } from 'jimu-ui';&lt;BR /&gt;import MediaLayer from '@arcgis/core/layers/MediaLayer';&lt;BR /&gt;import ImageElement from '@arcgis/core/layers/support/ImageElement';&lt;BR /&gt;import ExtentAndRotationGeoreference from '@arcgis/core/layers/support/ExtentAndRotationGeoreference';&lt;BR /&gt;import Extent from '@arcgis/core/geometry/Extent';&lt;BR /&gt;import SpatialReference from '@arcgis/core/geometry/SpatialReference';&lt;/P&gt;&lt;P&gt;interface State {&lt;BR /&gt;jimuMapView: JimuMapView | null;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;export default class Widget extends React.PureComponent&amp;lt;AllWidgetProps&amp;lt;any&amp;gt;, State&amp;gt; {&lt;BR /&gt;state: State = {&lt;BR /&gt;jimuMapView: null&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;mediaLayer: MediaLayer | null = null;&lt;BR /&gt;imageElement: ImageElement | null = null;&lt;/P&gt;&lt;P&gt;onImageUpload = (event: React.ChangeEvent&amp;lt;HTMLInputElement&amp;gt;) =&amp;gt; {&lt;BR /&gt;const file = event.target.files?.[0];&lt;BR /&gt;if (!file || !this.state.jimuMapView) return;&lt;/P&gt;&lt;P&gt;const reader = new FileReader();&lt;BR /&gt;reader.onload = () =&amp;gt; {&lt;BR /&gt;const imageUrl = reader.result as string;&lt;BR /&gt;const view = this.state.jimuMapView.view;&lt;/P&gt;&lt;P&gt;const extent = new Extent({&lt;BR /&gt;xmin: -118.818984489994,&lt;BR /&gt;ymin: 34.0137559967283,&lt;BR /&gt;xmax: -118.806796597377,&lt;BR /&gt;ymax: 34.0215816298725,&lt;BR /&gt;spatialReference: SpatialReference.WGS84&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const georef = new ExtentAndRotationGeoreference({ extent });&lt;/P&gt;&lt;P&gt;this.imageElement = new ImageElement({&lt;BR /&gt;image: imageUrl,&lt;BR /&gt;georeference: georef&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;this.mediaLayer = new MediaLayer({&lt;BR /&gt;source: [this.imageElement],&lt;BR /&gt;title: 'Uploaded Image',&lt;BR /&gt;interactionOptions: {&lt;BR /&gt;enable: true,&lt;BR /&gt;translateEnabled: true,&lt;BR /&gt;rotationEnabled: true,&lt;BR /&gt;scaleEnabled: true&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;view.map.add(this.mediaLayer);&lt;/P&gt;&lt;P&gt;view.whenLayerView(this.mediaLayer).then((layerView: any) =&amp;gt; {&lt;BR /&gt;layerView.interactive = true;&lt;BR /&gt;layerView.selectedElement = this.imageElement;&lt;BR /&gt;});&lt;BR /&gt;};&lt;BR /&gt;reader.readAsDataURL(file);&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;clearImage = () =&amp;gt; {&lt;BR /&gt;const view = this.state.jimuMapView?.view;&lt;BR /&gt;if (view &amp;amp;&amp;amp; this.mediaLayer) {&lt;BR /&gt;view.map.remove(this.mediaLayer);&lt;BR /&gt;this.mediaLayer = null;&lt;BR /&gt;this.imageElement = null;&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;render() {&lt;BR /&gt;return (&lt;BR /&gt;&amp;lt;div className="widget-interactive-image" style={{ padding: '1rem' }}&amp;gt;&lt;BR /&gt;&amp;lt;input type="file" accept="image/png, image/jpeg" onChange={this.onImageUpload} /&amp;gt;&lt;BR /&gt;&amp;lt;Button onClick={this.clearImage} style={{ marginTop: '10px' }}&amp;gt;&lt;BR /&gt;Clear Image&lt;BR /&gt;&amp;lt;/Button&amp;gt;&lt;BR /&gt;&amp;lt;JimuMapViewComponent&lt;BR /&gt;useMapWidgetId={this.props.useMapWidgetIds?.[0]}&lt;BR /&gt;onActiveViewChange={(jmv: JimuMapView) =&amp;gt; this.setState({ jimuMapView: jmv })}&lt;BR /&gt;/&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;ag/Resize/roate)&lt;BR /&gt;&lt;BR /&gt;Although i implemented above fes issues i encountered&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. rotation is not working&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Resize/Drag works only one time and it stops working&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. No Errors though but tool hangs and shows inactive on the image&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Oct 2025 01:10:30 GMT</pubDate>
    <dc:creator>RachappaBellappa1</dc:creator>
    <dc:date>2025-10-13T01:10:30Z</dc:date>
    <item>
      <title>Experience Builder MediaLayerView</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-medialayerview/m-p/1657347#M21104</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am using v1.19 and JS API 4.33 and was trying to develop custom widget similar to this&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-medialayer-interactive/live/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/layers-medialayer-interactive/live/&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My steps&lt;/P&gt;&lt;P&gt;a. upload image file using drag/drop functionality&amp;nbsp;&lt;/P&gt;&lt;P&gt;b. geoprocess the image&amp;nbsp;&lt;/P&gt;&lt;P&gt;c. Need to perform tranform interaction options (dr&lt;/P&gt;&lt;P&gt;import { React, AllWidgetProps, jsx } from 'jimu-core';&lt;BR /&gt;import { JimuMapViewComponent, JimuMapView } from 'jimu-arcgis';&lt;BR /&gt;import { Button } from 'jimu-ui';&lt;BR /&gt;import MediaLayer from '@arcgis/core/layers/MediaLayer';&lt;BR /&gt;import ImageElement from '@arcgis/core/layers/support/ImageElement';&lt;BR /&gt;import ExtentAndRotationGeoreference from '@arcgis/core/layers/support/ExtentAndRotationGeoreference';&lt;BR /&gt;import Extent from '@arcgis/core/geometry/Extent';&lt;BR /&gt;import SpatialReference from '@arcgis/core/geometry/SpatialReference';&lt;/P&gt;&lt;P&gt;interface State {&lt;BR /&gt;jimuMapView: JimuMapView | null;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;export default class Widget extends React.PureComponent&amp;lt;AllWidgetProps&amp;lt;any&amp;gt;, State&amp;gt; {&lt;BR /&gt;state: State = {&lt;BR /&gt;jimuMapView: null&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;mediaLayer: MediaLayer | null = null;&lt;BR /&gt;imageElement: ImageElement | null = null;&lt;/P&gt;&lt;P&gt;onImageUpload = (event: React.ChangeEvent&amp;lt;HTMLInputElement&amp;gt;) =&amp;gt; {&lt;BR /&gt;const file = event.target.files?.[0];&lt;BR /&gt;if (!file || !this.state.jimuMapView) return;&lt;/P&gt;&lt;P&gt;const reader = new FileReader();&lt;BR /&gt;reader.onload = () =&amp;gt; {&lt;BR /&gt;const imageUrl = reader.result as string;&lt;BR /&gt;const view = this.state.jimuMapView.view;&lt;/P&gt;&lt;P&gt;const extent = new Extent({&lt;BR /&gt;xmin: -118.818984489994,&lt;BR /&gt;ymin: 34.0137559967283,&lt;BR /&gt;xmax: -118.806796597377,&lt;BR /&gt;ymax: 34.0215816298725,&lt;BR /&gt;spatialReference: SpatialReference.WGS84&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const georef = new ExtentAndRotationGeoreference({ extent });&lt;/P&gt;&lt;P&gt;this.imageElement = new ImageElement({&lt;BR /&gt;image: imageUrl,&lt;BR /&gt;georeference: georef&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;this.mediaLayer = new MediaLayer({&lt;BR /&gt;source: [this.imageElement],&lt;BR /&gt;title: 'Uploaded Image',&lt;BR /&gt;interactionOptions: {&lt;BR /&gt;enable: true,&lt;BR /&gt;translateEnabled: true,&lt;BR /&gt;rotationEnabled: true,&lt;BR /&gt;scaleEnabled: true&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;view.map.add(this.mediaLayer);&lt;/P&gt;&lt;P&gt;view.whenLayerView(this.mediaLayer).then((layerView: any) =&amp;gt; {&lt;BR /&gt;layerView.interactive = true;&lt;BR /&gt;layerView.selectedElement = this.imageElement;&lt;BR /&gt;});&lt;BR /&gt;};&lt;BR /&gt;reader.readAsDataURL(file);&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;clearImage = () =&amp;gt; {&lt;BR /&gt;const view = this.state.jimuMapView?.view;&lt;BR /&gt;if (view &amp;amp;&amp;amp; this.mediaLayer) {&lt;BR /&gt;view.map.remove(this.mediaLayer);&lt;BR /&gt;this.mediaLayer = null;&lt;BR /&gt;this.imageElement = null;&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;render() {&lt;BR /&gt;return (&lt;BR /&gt;&amp;lt;div className="widget-interactive-image" style={{ padding: '1rem' }}&amp;gt;&lt;BR /&gt;&amp;lt;input type="file" accept="image/png, image/jpeg" onChange={this.onImageUpload} /&amp;gt;&lt;BR /&gt;&amp;lt;Button onClick={this.clearImage} style={{ marginTop: '10px' }}&amp;gt;&lt;BR /&gt;Clear Image&lt;BR /&gt;&amp;lt;/Button&amp;gt;&lt;BR /&gt;&amp;lt;JimuMapViewComponent&lt;BR /&gt;useMapWidgetId={this.props.useMapWidgetIds?.[0]}&lt;BR /&gt;onActiveViewChange={(jmv: JimuMapView) =&amp;gt; this.setState({ jimuMapView: jmv })}&lt;BR /&gt;/&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;ag/Resize/roate)&lt;BR /&gt;&lt;BR /&gt;Although i implemented above fes issues i encountered&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. rotation is not working&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Resize/Drag works only one time and it stops working&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. No Errors though but tool hangs and shows inactive on the image&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 01:10:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-medialayerview/m-p/1657347#M21104</guid>
      <dc:creator>RachappaBellappa1</dc:creator>
      <dc:date>2025-10-13T01:10:30Z</dc:date>
    </item>
  </channel>
</rss>

