<?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 Difficulty displaying map and layers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096204#M74589</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I've been asked to work on a simple web app, but I'm a novice when it comes to the JS API and I'm having problems getting a basemap and layers up. Could anyone here help me out&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;

    &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;
    &amp;lt;title&amp;gt;Demo&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.20/esri/themes/light/main.css"&amp;gt;
    &amp;lt;style&amp;gt;
      html, body, #mapDiv {
        padding: 0;
        margin: 0;
        height: 100%;
      }
      #textbox{
        background-color: #fff;
        box-shadow: 0 0 5px #888;
        font-size: 1.1em;
        max-width: 15em;
        padding: 0.5em;
        position: absolute;
        right: 20px;
        top: 20px;
        z-index: 40;
      }
    &amp;lt;/style&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.20/"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!--wrong version?--&amp;gt;
    &amp;lt;script&amp;gt;
        
  require([
    "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", "esri/Graphic", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color", "esri/geometry/Circle", "esri/rest/support/Query", "esri/geometry/Point", "esri/layers/GraphicsLayer"
  ], function(
    MapView, FeatureLayer, Graphic, SimpleFillSymbol, SimpleLineSymbol, Color, Circle, Query, Point, GraphicsLayer, Map
  ) {
  
	const feedlotFL = new FeatureLayer({
      url: "https://arcgis.dnr.state.mn.us/arcgis/rest/services/ewr/practicum_feedlot/MapServer/0",
	  outFields: ["*"]
    });
	
	// Selected feedlots
	const selectedFeedlotsGL = new GraphicsLayer();
	
	// Map
	const feedlotMap = new Map({
		basemap: "arcgis-topographic", //wrong basemap type?
		layers: [feedlotFL, selectedFeedlotsGL]
	});
	
	// View
	const mapView = new MapView({
      container: "mapDiv",
	  map: feedlotMap
    });
	
	mapView.on("click", evt =&amp;gt; {
		// TODO: Clear the graphics
		
		const circleSymb = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL,
		  new SimpleLineSymbol(SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,
		  new Color([0, 0, 0]),2), 
		  new Color([255, 255, 0, 0.25])
		);   
		
		// Buffer type
		const circle = new Circle({
			center: evt.mapPoint,
			radius: 25,
			// geodesic: true,
			radiusUnit: "feet"
		});
	  
		const bufferGraphic = new Graphic(circle, circleSymb);
		mapView.graphics.add(bufferGraphic);
		  
		let query = new Query({
			geometry: mapView.toMap(evt),
			distance: 25,
			units: "feet",
			spatialRelationship: "intersects",
			returnGeometry: true,
			outFields: ["*"]
		});
	  
		feedlotFL.queryFeatures(query).then(response =&amp;gt; {

			document.getElementById('textbox').innerHTML = "&amp;lt;b&amp;gt;The number of feedlots within the buffer is &amp;lt;i&amp;gt;" + feedlotCount + "&amp;lt;/i&amp;gt;.&amp;lt;/b&amp;gt;"
			
			const selectedFeedlots = [];
			for (let i = 0; i &amp;lt; feedlotCount; i++) {
				selectedFeedlots.push(response.features[i]);
			}
		
			addGraphics(selectedFeedlots);
		
			function addGraphics(feedlots) {
				
				feedlots.forEach(function(feature){
				  const eachSelectedFeedlotPt = new Graphic({
					geometry: feature.geometry,
					symbol: {
					 type: "simple-marker",
					  color: [0,0,0],
					  outline: {
					   width: 2,
					   color: [0,255,255],
					 },
					  size: "10px"
					},
				  });
				  selectedFeedlotsGL.add(eachSelectedFeedlotPt);
				});
			}
	
		});
		
	});
  });
&amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;span id="textbox"&amp;gt;Click on the map to select feedlots within 10 miles&amp;lt;/span&amp;gt;
    &amp;lt;div id="mapDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 08 Sep 2021 01:53:54 GMT</pubDate>
    <dc:creator>GrantHaynes</dc:creator>
    <dc:date>2021-09-08T01:53:54Z</dc:date>
    <item>
      <title>Difficulty displaying map and layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096204#M74589</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I've been asked to work on a simple web app, but I'm a novice when it comes to the JS API and I'm having problems getting a basemap and layers up. Could anyone here help me out&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;

    &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;
    &amp;lt;title&amp;gt;Demo&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.20/esri/themes/light/main.css"&amp;gt;
    &amp;lt;style&amp;gt;
      html, body, #mapDiv {
        padding: 0;
        margin: 0;
        height: 100%;
      }
      #textbox{
        background-color: #fff;
        box-shadow: 0 0 5px #888;
        font-size: 1.1em;
        max-width: 15em;
        padding: 0.5em;
        position: absolute;
        right: 20px;
        top: 20px;
        z-index: 40;
      }
    &amp;lt;/style&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.20/"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!--wrong version?--&amp;gt;
    &amp;lt;script&amp;gt;
        
  require([
    "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", "esri/Graphic", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color", "esri/geometry/Circle", "esri/rest/support/Query", "esri/geometry/Point", "esri/layers/GraphicsLayer"
  ], function(
    MapView, FeatureLayer, Graphic, SimpleFillSymbol, SimpleLineSymbol, Color, Circle, Query, Point, GraphicsLayer, Map
  ) {
  
	const feedlotFL = new FeatureLayer({
      url: "https://arcgis.dnr.state.mn.us/arcgis/rest/services/ewr/practicum_feedlot/MapServer/0",
	  outFields: ["*"]
    });
	
	// Selected feedlots
	const selectedFeedlotsGL = new GraphicsLayer();
	
	// Map
	const feedlotMap = new Map({
		basemap: "arcgis-topographic", //wrong basemap type?
		layers: [feedlotFL, selectedFeedlotsGL]
	});
	
	// View
	const mapView = new MapView({
      container: "mapDiv",
	  map: feedlotMap
    });
	
	mapView.on("click", evt =&amp;gt; {
		// TODO: Clear the graphics
		
		const circleSymb = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL,
		  new SimpleLineSymbol(SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,
		  new Color([0, 0, 0]),2), 
		  new Color([255, 255, 0, 0.25])
		);   
		
		// Buffer type
		const circle = new Circle({
			center: evt.mapPoint,
			radius: 25,
			// geodesic: true,
			radiusUnit: "feet"
		});
	  
		const bufferGraphic = new Graphic(circle, circleSymb);
		mapView.graphics.add(bufferGraphic);
		  
		let query = new Query({
			geometry: mapView.toMap(evt),
			distance: 25,
			units: "feet",
			spatialRelationship: "intersects",
			returnGeometry: true,
			outFields: ["*"]
		});
	  
		feedlotFL.queryFeatures(query).then(response =&amp;gt; {

			document.getElementById('textbox').innerHTML = "&amp;lt;b&amp;gt;The number of feedlots within the buffer is &amp;lt;i&amp;gt;" + feedlotCount + "&amp;lt;/i&amp;gt;.&amp;lt;/b&amp;gt;"
			
			const selectedFeedlots = [];
			for (let i = 0; i &amp;lt; feedlotCount; i++) {
				selectedFeedlots.push(response.features[i]);
			}
		
			addGraphics(selectedFeedlots);
		
			function addGraphics(feedlots) {
				
				feedlots.forEach(function(feature){
				  const eachSelectedFeedlotPt = new Graphic({
					geometry: feature.geometry,
					symbol: {
					 type: "simple-marker",
					  color: [0,0,0],
					  outline: {
					   width: 2,
					   color: [0,255,255],
					 },
					  size: "10px"
					},
				  });
				  selectedFeedlotsGL.add(eachSelectedFeedlotPt);
				});
			}
	
		});
		
	});
  });
&amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;span id="textbox"&amp;gt;Click on the map to select feedlots within 10 miles&amp;lt;/span&amp;gt;
    &amp;lt;div id="mapDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Sep 2021 01:53:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096204#M74589</guid>
      <dc:creator>GrantHaynes</dc:creator>
      <dc:date>2021-09-08T01:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulty displaying map and layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096422#M74601</link>
      <description>&lt;P&gt;I started messing around with the CSS, and then the Map and MapView setup just to see if it wasn't set to something that worked.&amp;nbsp; But then I noticed that in the Require call you had 'Map' at the end, but it was the first javascript library call.&amp;nbsp; I switched that so that 'Map' was at the beginning and it is working, at least for the basemap.&amp;nbsp; Not sure about your layers and graphics.&amp;nbsp; Here is what I was tinkering with:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;

    &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;
    &amp;lt;title&amp;gt;Demo&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.20/esri/themes/light/main.css"&amp;gt;
    &amp;lt;style&amp;gt;
        html, body, #mapDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }

        #textbox {
            background-color: #fff;
            box-shadow: 0 0 5px #888;
            font-size: 1.1em;
            max-width: 15em;
            padding: 0.5em;
            position: absolute;
            right: 20px;
            top: 20px;
            z-index: 40;
        }
    &amp;lt;/style&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.20/"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!--wrong version?--&amp;gt;
    &amp;lt;script&amp;gt;

  require([
	  "esri/Map",
	  "esri/views/MapView",
	  "esri/layers/FeatureLayer",
	  "esri/Graphic",
	  "esri/symbols/SimpleFillSymbol",
	  "esri/symbols/SimpleLineSymbol",
	  "esri/Color",
	  "esri/geometry/Circle",
	  "esri/rest/support/Query",
	  "esri/geometry/Point",
	  "esri/layers/GraphicsLayer"
  ], function(
    Map, MapView, FeatureLayer, Graphic, SimpleFillSymbol, SimpleLineSymbol, Color, Circle, Query, Point, GraphicsLayer
  ) {

	const feedlotFL = new FeatureLayer({
      url: "https://arcgis.dnr.state.mn.us/arcgis/rest/services/ewr/practicum_feedlot/MapServer/0",
	  outFields: ["*"]
    });

	// Selected feedlots
	const selectedFeedlotsGL = new GraphicsLayer();

	// Map
	const feedlotMap = new Map({
        basemap: "topo-vector", //wrong basemap type?
		layers: [feedlotFL, selectedFeedlotsGL]
	});

	// View
	const mapView = new MapView({
		container: "mapDiv",
		map: feedlotMap,
        center: [-99.1, 35.5],
        zoom: 9
    });

	mapView.on("click", evt =&amp;gt; {
		// TODO: Clear the graphics

		const circleSymb = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL,
		  new SimpleLineSymbol(SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,
		  new Color([0, 0, 0]),2),
		  new Color([255, 255, 0, 0.25])
		);

		// Buffer type
		const circle = new Circle({
			center: evt.mapPoint,
			radius: 25,
			// geodesic: true,
			radiusUnit: "feet"
		});

		const bufferGraphic = new Graphic(circle, circleSymb);
		mapView.graphics.add(bufferGraphic);

		let query = new Query({
			geometry: mapView.toMap(evt),
			distance: 25,
			units: "feet",
			spatialRelationship: "intersects",
			returnGeometry: true,
			outFields: ["*"]
		});

		feedlotFL.queryFeatures(query).then(response =&amp;gt; {

			document.getElementById('textbox').innerHTML = "&amp;lt;b&amp;gt;The number of feedlots within the buffer is &amp;lt;i&amp;gt;" + feedlotCount + "&amp;lt;/i&amp;gt;.&amp;lt;/b&amp;gt;"

			const selectedFeedlots = [];
			for (let i = 0; i &amp;lt; feedlotCount; i++) {
				selectedFeedlots.push(response.features[i]);
			}

			addGraphics(selectedFeedlots);

			function addGraphics(feedlots) {

				feedlots.forEach(function(feature){
				  const eachSelectedFeedlotPt = new Graphic({
					geometry: feature.geometry,
					symbol: {
					 type: "simple-marker",
					  color: [0,0,0],
					  outline: {
					   width: 2,
					   color: [0,255,255],
					 },
					  size: "10px"
					},
				  });
				  selectedFeedlotsGL.add(eachSelectedFeedlotPt);
				});
			}

		});

	});
  });
    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;span id="textbox"&amp;gt;Click on the map to select feedlots within 10 miles&amp;lt;/span&amp;gt;
    &amp;lt;div id="mapDiv"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Sep 2021 15:17:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096422#M74601</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-09-08T15:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulty displaying map and layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096448#M74603</link>
      <description>&lt;P&gt;In the Require, your 'Map' variable doesn't correspond to the right javascript library.&amp;nbsp; Also, if you click on the map the Console is saying that you don't define feedlotCount before you use in the For statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 15:05:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096448#M74603</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-09-09T15:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulty displaying map and layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096453#M74607</link>
      <description>&lt;P&gt;I keep trying to post some code that works, but basically if you move 'Map' from the end of the variable list in the Require statement to the beginning to correspond to the "esri\Map" library exposed there it will start working.&amp;nbsp; The feedlotCount variable needs to be set prior to using it as well but that you can probably handle.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 15:52:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096453#M74607</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-09-08T15:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulty displaying map and layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096664#M74616</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
    "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", "esri/Graphic", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color", "esri/geometry/Circle", "esri/rest/support/Query", "esri/geometry/Point", "esri/layers/GraphicsLayer"
  ], function(
   Map, MapView, FeatureLayer, Graphic, SimpleFillSymbol, SimpleLineSymbol, Color, Circle, Query, Point, GraphicsLayer, 
  ) {
  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kindly do these changes to your code.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;bring 'Map' from the end of the variable list in the Require statement to the beginning to correspond to the "esri\Map" shown in the code. in require statement you should maintain the sequence.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 08:53:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/difficulty-displaying-map-and-layers/m-p/1096664#M74616</guid>
      <dc:creator>RitikaManderwal</dc:creator>
      <dc:date>2021-09-09T08:53:22Z</dc:date>
    </item>
  </channel>
</rss>

