<?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-component api in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-component-api/m-p/1418765#M84498</link>
    <description>&lt;P&gt;The map and scene components have a map property that you can reference to add layers.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/components/storybook/?path=/docs/map-components_component-reference-map--docs" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/components/storybook/?path=/docs/map-components_component-reference-map--docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In the "next" version, which will be in 4.30, we added a method on the elements for addLayer and addLayers.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;async function load() {
	const Layer = await $arcgis.import("esri/layers/Layer");
	const url =
		"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2";
	const layer = await Layer.fromArcGISServerUrl({
		url
	});
	// Reference the map component
	const mapElem = document.querySelector("arcgis-map");
	mapElem.addEventListener("arcgisViewReadyChange", () =&amp;gt; {
		// works today
		// mapElem.map.add(layer);
	}, { once: true });
	// available in next, will be in 4.30
	mapElem.addLayer(layer);
}

load();&lt;/LI-CODE&gt;&lt;P&gt;Here is a codepen.&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/NWowrmo?editors=0010" target="_blank"&gt;https://codepen.io/odoe/pen/NWowrmo?editors=0010&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2024 15:26:22 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2024-05-03T15:26:22Z</dc:date>
    <item>
      <title>map-component api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-component-api/m-p/1418711#M84496</link>
      <description>&lt;P&gt;Does the arcgis map component only works with WebMap? How can I add a feature layer service to a map-component?&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 14:24:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-component-api/m-p/1418711#M84496</guid>
      <dc:creator>MKY</dc:creator>
      <dc:date>2024-05-03T14:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: map-component api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-component-api/m-p/1418765#M84498</link>
      <description>&lt;P&gt;The map and scene components have a map property that you can reference to add layers.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/components/storybook/?path=/docs/map-components_component-reference-map--docs" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/components/storybook/?path=/docs/map-components_component-reference-map--docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In the "next" version, which will be in 4.30, we added a method on the elements for addLayer and addLayers.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;async function load() {
	const Layer = await $arcgis.import("esri/layers/Layer");
	const url =
		"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2";
	const layer = await Layer.fromArcGISServerUrl({
		url
	});
	// Reference the map component
	const mapElem = document.querySelector("arcgis-map");
	mapElem.addEventListener("arcgisViewReadyChange", () =&amp;gt; {
		// works today
		// mapElem.map.add(layer);
	}, { once: true });
	// available in next, will be in 4.30
	mapElem.addLayer(layer);
}

load();&lt;/LI-CODE&gt;&lt;P&gt;Here is a codepen.&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/NWowrmo?editors=0010" target="_blank"&gt;https://codepen.io/odoe/pen/NWowrmo?editors=0010&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 15:26:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-component-api/m-p/1418765#M84498</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2024-05-03T15:26:22Z</dc:date>
    </item>
  </channel>
</rss>

