<?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 Create a Map from a MapServer URL - map coming back blank in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-a-map-from-a-mapserver-url-map-coming-back/m-p/1548090#M85874</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I am doing a JavaScript sdk prototype and trying to create a Map based on a mapserver URL. Below is my code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried creating the base layer and then adding one of the feature layers but the map keeps coming back as blank.&lt;/P&gt;&lt;P&gt;I did the same prototype with a webmap and it worked just fine. I think I am missing something basic but I cannot figure it out.&lt;/P&gt;&lt;P&gt;Any guidance is appreciated.&lt;/P&gt;&lt;P&gt;thank you,&lt;/P&gt;&lt;P&gt;Rakesh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let webmap = undefined;&lt;BR /&gt;let map = undefined;&lt;BR /&gt;let view = undefined;&lt;BR /&gt;let layers = undefined;&lt;BR /&gt;var srpCoordinates = [];&lt;BR /&gt;var coordinates = [];&lt;BR /&gt;let graphicsLayer = undefined;&lt;BR /&gt;let graphicsTextLayer = undefined;&lt;BR /&gt;let basemap = undefined;&lt;/P&gt;&lt;P&gt;let renderMap = () =&amp;gt; {&lt;BR /&gt;//alert("hello");&lt;BR /&gt;require([&lt;BR /&gt;"esri/config",&lt;BR /&gt;"esri/WebMap",&lt;BR /&gt;"esri/Map",&lt;BR /&gt;"esri/Basemap",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/widgets/ScaleBar",&lt;BR /&gt;"esri/widgets/Legend",&lt;BR /&gt;"esri/Graphic",&lt;BR /&gt;"esri/layers/GraphicsLayer",&lt;BR /&gt;"esri/layers/MapImageLayer",&lt;BR /&gt;"esri/layers/TileLayer", "esri/layers/FeatureLayer",&lt;BR /&gt;], function (esriConfig, WebMap, Map, Basemap, MapView, ScaleBar, Legend, Graphic, GraphicsLayer, MapImageLayer, TileLayer,FeatureLayer) {&lt;/P&gt;&lt;P&gt;var portalUrl = "";&lt;BR /&gt;graphicsLayer = new GraphicsLayer();&lt;BR /&gt;graphicsTextLayer = new GraphicsLayer();&lt;/P&gt;&lt;P&gt;const baseLayer = new TileLayer({&lt;BR /&gt;url: "/MapServer"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const featurelayer1 = new FeatureLayer({&lt;BR /&gt;url: "/MapServer/111"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;basemap = new Basemap({&lt;BR /&gt;baseLayers: [baseLayer],&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;map = new Map({&lt;BR /&gt;basemap: basemap,&lt;BR /&gt;layers:[featurelayer1]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;zoom: 13,&lt;BR /&gt;map: map,&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;const scalebar = new ScaleBar({&lt;BR /&gt;view: view&lt;BR /&gt;});&lt;BR /&gt;view.ui.add(scalebar, "bottom-left");&lt;/P&gt;&lt;P&gt;//***disabled the legend for now&lt;/P&gt;&lt;P&gt;//const legend = new Legend({&lt;BR /&gt;// view: view&lt;BR /&gt;//});&lt;BR /&gt;//view.ui.add(legend, "top-right");&lt;/P&gt;&lt;P&gt;////load the map layers&lt;BR /&gt;//webmap.loadAll().then(() =&amp;gt; {&lt;BR /&gt;// let gateLayer = undefined;&lt;BR /&gt;// layers = webmap.layers;&lt;BR /&gt;// console.log(layers.length);&lt;BR /&gt;// // loop through all operational layers in your webmap&lt;BR /&gt;// webmap.layers.forEach((layer) =&amp;gt; {&lt;BR /&gt;// console.log("layer.id", layer.id, layer.title);&lt;BR /&gt;// if (layer.title.includes("Gate Boundary")) {&lt;BR /&gt;// gateLayer = layer;&lt;BR /&gt;// }&lt;BR /&gt;// console.log(layer.spatialReference);&lt;BR /&gt;// // check your layer here&lt;BR /&gt;// });&lt;/P&gt;&lt;P&gt;// //webmap.layers.remove(gateLayer);&lt;BR /&gt;// webmap.layers.removeAll();&lt;BR /&gt;//});&lt;/P&gt;&lt;P&gt;//console.log(webmap.layers.length);&lt;BR /&gt;//webmap.layers.forEach((layer) =&amp;gt; {&lt;BR /&gt;// console.log("layer.id", layer.id, layer.title);&lt;BR /&gt;// console.log(layer.spatialReference);&lt;BR /&gt;// // check your layer here&lt;BR /&gt;//});&lt;/P&gt;&lt;P&gt;//TODO: need to figure out spinner&lt;BR /&gt;MapLoaded();&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2024 23:58:01 GMT</pubDate>
    <dc:creator>RakeshAjwani</dc:creator>
    <dc:date>2024-10-14T23:58:01Z</dc:date>
    <item>
      <title>Create a Map from a MapServer URL - map coming back blank</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-a-map-from-a-mapserver-url-map-coming-back/m-p/1548090#M85874</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I am doing a JavaScript sdk prototype and trying to create a Map based on a mapserver URL. Below is my code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried creating the base layer and then adding one of the feature layers but the map keeps coming back as blank.&lt;/P&gt;&lt;P&gt;I did the same prototype with a webmap and it worked just fine. I think I am missing something basic but I cannot figure it out.&lt;/P&gt;&lt;P&gt;Any guidance is appreciated.&lt;/P&gt;&lt;P&gt;thank you,&lt;/P&gt;&lt;P&gt;Rakesh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let webmap = undefined;&lt;BR /&gt;let map = undefined;&lt;BR /&gt;let view = undefined;&lt;BR /&gt;let layers = undefined;&lt;BR /&gt;var srpCoordinates = [];&lt;BR /&gt;var coordinates = [];&lt;BR /&gt;let graphicsLayer = undefined;&lt;BR /&gt;let graphicsTextLayer = undefined;&lt;BR /&gt;let basemap = undefined;&lt;/P&gt;&lt;P&gt;let renderMap = () =&amp;gt; {&lt;BR /&gt;//alert("hello");&lt;BR /&gt;require([&lt;BR /&gt;"esri/config",&lt;BR /&gt;"esri/WebMap",&lt;BR /&gt;"esri/Map",&lt;BR /&gt;"esri/Basemap",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/widgets/ScaleBar",&lt;BR /&gt;"esri/widgets/Legend",&lt;BR /&gt;"esri/Graphic",&lt;BR /&gt;"esri/layers/GraphicsLayer",&lt;BR /&gt;"esri/layers/MapImageLayer",&lt;BR /&gt;"esri/layers/TileLayer", "esri/layers/FeatureLayer",&lt;BR /&gt;], function (esriConfig, WebMap, Map, Basemap, MapView, ScaleBar, Legend, Graphic, GraphicsLayer, MapImageLayer, TileLayer,FeatureLayer) {&lt;/P&gt;&lt;P&gt;var portalUrl = "";&lt;BR /&gt;graphicsLayer = new GraphicsLayer();&lt;BR /&gt;graphicsTextLayer = new GraphicsLayer();&lt;/P&gt;&lt;P&gt;const baseLayer = new TileLayer({&lt;BR /&gt;url: "/MapServer"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const featurelayer1 = new FeatureLayer({&lt;BR /&gt;url: "/MapServer/111"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;basemap = new Basemap({&lt;BR /&gt;baseLayers: [baseLayer],&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;map = new Map({&lt;BR /&gt;basemap: basemap,&lt;BR /&gt;layers:[featurelayer1]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;zoom: 13,&lt;BR /&gt;map: map,&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;const scalebar = new ScaleBar({&lt;BR /&gt;view: view&lt;BR /&gt;});&lt;BR /&gt;view.ui.add(scalebar, "bottom-left");&lt;/P&gt;&lt;P&gt;//***disabled the legend for now&lt;/P&gt;&lt;P&gt;//const legend = new Legend({&lt;BR /&gt;// view: view&lt;BR /&gt;//});&lt;BR /&gt;//view.ui.add(legend, "top-right");&lt;/P&gt;&lt;P&gt;////load the map layers&lt;BR /&gt;//webmap.loadAll().then(() =&amp;gt; {&lt;BR /&gt;// let gateLayer = undefined;&lt;BR /&gt;// layers = webmap.layers;&lt;BR /&gt;// console.log(layers.length);&lt;BR /&gt;// // loop through all operational layers in your webmap&lt;BR /&gt;// webmap.layers.forEach((layer) =&amp;gt; {&lt;BR /&gt;// console.log("layer.id", layer.id, layer.title);&lt;BR /&gt;// if (layer.title.includes("Gate Boundary")) {&lt;BR /&gt;// gateLayer = layer;&lt;BR /&gt;// }&lt;BR /&gt;// console.log(layer.spatialReference);&lt;BR /&gt;// // check your layer here&lt;BR /&gt;// });&lt;/P&gt;&lt;P&gt;// //webmap.layers.remove(gateLayer);&lt;BR /&gt;// webmap.layers.removeAll();&lt;BR /&gt;//});&lt;/P&gt;&lt;P&gt;//console.log(webmap.layers.length);&lt;BR /&gt;//webmap.layers.forEach((layer) =&amp;gt; {&lt;BR /&gt;// console.log("layer.id", layer.id, layer.title);&lt;BR /&gt;// console.log(layer.spatialReference);&lt;BR /&gt;// // check your layer here&lt;BR /&gt;//});&lt;/P&gt;&lt;P&gt;//TODO: need to figure out spinner&lt;BR /&gt;MapLoaded();&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 23:58:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-a-map-from-a-mapserver-url-map-coming-back/m-p/1548090#M85874</guid>
      <dc:creator>RakeshAjwani</dc:creator>
      <dc:date>2024-10-14T23:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Map from a MapServer URL - map coming back blank</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-a-map-from-a-mapserver-url-map-coming-back/m-p/1548835#M85894</link>
      <description>&lt;P&gt;These will need to be actual URLs pointing to a service:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;const baseLayer = new TileLayer({&lt;BR /&gt;url: "/MapServer"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const featurelayer1 = new FeatureLayer({&lt;BR /&gt;url: "/MapServer/111"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;Example if you update your code to call these example services:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;const baseLayer = new TileLayer({&lt;BR /&gt;portalItem: {&lt;BR /&gt;id: "382e5ab1c3e940bfbf470c4e6c64134c"&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const featurelayer1 = new FeatureLayer({&lt;BR /&gt;url: "&lt;A href="https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/weather_stations_010417/FeatureServer/0" target="_blank"&gt;https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/weather_stations_010417/FeatureServer/0&lt;/A&gt;",&lt;BR /&gt;outFields: ["*"]&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;You'll see something render on the map.&lt;BR /&gt;&lt;BR /&gt;And lastly your code didn't include actually calling renderMap(), but I'm assuming you're calling that somewhere.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 20:36:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-a-map-from-a-mapserver-url-map-coming-back/m-p/1548835#M85894</guid>
      <dc:creator>JamesIng</dc:creator>
      <dc:date>2024-10-15T20:36:08Z</dc:date>
    </item>
  </channel>
</rss>

