require([ "esri/map", "esri/arcgis/utils", "dojo/domReady!" ], function(Map, arcgisUtils){ arcgisUtils.createMap("1a40fa5cc1ab4569b79f45444d728067", "mapDiv").then(function (response) { map = response.map; }); });
map = new Map("mapDiv", { center: [-77.4329, 37.5410], zoom: 6, basemap: "streets"
<script> var map; require(["esri/map", "esri/arcgis/utils", "esri/dijit/Legend", "dojo/domReady!" ], function(Map, arcgisUtils, Legend ) { arcgisUtils.createMap("1a40fa5cc1ab4569b79f45444d728067", "mapDiv").then(function (response) { map = response.map; var legend = new Legend({ map: map, layerInfos:(arcgisUtils.getLegendLayers(response)) }, "legendDiv"); legend.startup(); }); }); </script>
Solved! Go to Solution.
i can get to it from your URL but when I run from here.....as seen below code....I get this in the console error on WebMap
It has to be something with IIS....maybe the IIS that comes with Win8 is not able to get out or wont get to that URL???
I am lost here...
Tried the Geocoder example from API examples and it just spins endlessly when I submit an address.
I get this error with the Geocoder Example
ERROR Geocoder example https://developers.arcgis.com/en/javascript/jssamples/locator_simple.html
MLHttpRequest cannot load http://services.arcgisonline.com/ArcGIS/rest/info?f=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
ERROR FOR WebMap:
OPTIONS file://www.arcgis.com/sharing/rest/content/items/7f843bb0a37849f68a5a2cc3d2b06288?f=json init.js:158
r {stack: "Error: Unable to load file://www.arcgis.com/sharin???uest.h (http://js.arcgis.com/3.8/init.js:160:167)", message: "Unable to load file://www.arcgis.com/sharing/rest/???7f843bb0a37849f68a5a2cc3d2b06288?f=json status: 0", response: Object, status: 0, responseText: ""???}
_ssl: undefined
log: undefined
message: "Unable to load file://www.arcgis.com/sharing/rest/content/items/7f843bb0a37849f68a5a2cc3d2b06288?f=json status: 0"
response: Object
responseText: ""
stack: "Error: Unable to load file://www.arcgis.com/sharing/rest/content/items/7f843bb0a37849f68a5a2cc3d2b06288?f=json status: 0??? at Error (native)??? at new r (http://js.arcgis.com/3.8/init.js:221:367)??? at XMLHttpRequest.h (http://js.arcgis.com/3.8/init.js:160:167)"
status: 0
xhr: XMLHttpRequest
__proto__: a<script> require([ "esri/map", "esri/arcgis/utils", "dojo/domReady!" ], function(Map, arcgisUtils){ arcgisUtils.createMap("7f843bb0a37849f68a5a2cc3d2b06288", "mapDiv").then(function (response) { map = response.map; }); }); </script>
<script>
var map;
require(["esri/map", "esri/arcgis/utils", "esri/dijit/Legend", "dojo/domReady!"
], function(Map, arcgisUtils, Legend) {
arcgisUtils.createMap("240ssf435dfgfgdgdgfdc02386aebbae", "mapDiv").then(function (response) {
map = response.map;
var legend = new Legend({
map: map,
layerInfos:(arcgisUtils.getLegendLayers(response))
}, "legendDiv");
legend.startup();
});
});
</script>
I am running through some tutorials and having an issue
https://developers.arcgis.com/en/javascript/jstutorials/intro_agstemplate_amd.html
I am trying to use the Web Map Id they said you can in the example and then the map vanishes. I dont know how to get another one I can use.
I assume that the web map id is not working....what else can I be doing wrong
If you haven't created a web map yet, you can use 1a40fa5cc1ab4569b79f45444d728067 for testing.require([ "esri/map", "esri/arcgis/utils", "dojo/domReady!" ], function(Map, arcgisUtils){ arcgisUtils.createMap("1a40fa5cc1ab4569b79f45444d728067", "mapDiv").then(function (response) { map = response.map; }); });
If I use this from the first example then the map shows up finemap = new Map("mapDiv", { center: [-77.4329, 37.5410], zoom: 6, basemap: "streets"<script> var map; require(["esri/map", "esri/arcgis/utils", "esri/dijit/Legend", "dojo/domReady!" ], function(Map, arcgisUtils, Legend ) { arcgisUtils.createMap("1a40fa5cc1ab4569b79f45444d728067", "mapDiv").then(function (response) { map = response.map; var legend = new Legend({ map: map, layerInfos:(arcgisUtils.getLegendLayers(response)) }, "legendDiv"); legend.startup(); }); }); </script>
I have an ArcGIS online app running...this is the URL I can use to paste into a browser and it displays fine.
NOTE: I changed the appid below....this is the ID I am trying to use in my Java Script app and its not working
This wont work as is...I shared the Web Map Application to Public as I changed it aroudn a bit...must using it for reference
http://maps.arcgis.com/apps/OnePane/basicviewer/index.html?appid=240ssf435dfgfgdgdgfdc02386aebbae
<script> var map; require(["esri/map", "esri/arcgis/utils", "esri/dijit/Legend", "dojo/domReady!" ], function(Map, arcgisUtils, Legend) { arcgisUtils.createMap("240ssf435dfgfgdgdgfdc02386aebbae", "mapDiv").then(function (response) { map = response.map; var legend = new Legend({ map: map, layerInfos:(arcgisUtils.getLegendLayers(response)) }, "legendDiv"); legend.startup(); }); }); </script>
I have Fiddler2 installed.....
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 200 HTTP fiddler2.com /UpdateCheck.aspx?isBeta=False 595 private text/plain; charset=utf-8 fiddler:2824
2 302 HTTP js.arcgis.com /3.8compact/ 0 chrome:4952
HOw do I use the Java Script console....new at this sorry...but trying
It gets to here and stops...Funning thing is...I created a new HTML file and pasted the code thats in your example and still nothing....exactly what you had in there.
Confused.
THANK YOU VERY MUCH
Thanks
1. I tried to grab your code and placed that in a new html page and it does not work....thats confusing
2. I went into my Organization account and set up a web map with simply basemanp. Shared it to public
id=7f843bb0a37849f68a5a2cc3d2b06288
http://dgif-virginia.maps.arcgis.com/home/item.html?id=7f843bb0a37849f68a5a2cc3d2b06288
I assume this is the ID I need? If not where do I get it?
Or this one once I open the web map
webmap=7f843bb0a37849f68a5a2cc3d2b06288
http://dgif-virginia.maps.arcgis.com/home/webmap/viewer.html?webmap=7f843bb0a37849f68a5a2cc3d2b06288
<!DOCTYPE html> <html> <head> <title>Create a Web Map</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> <style> html,body,#mapDiv,.map.container{ padding:0; margin:0; height:100%; } </style> <script>var dojoConfig = { parseOnLoad:true };</script> <script src="http://js.arcgis.com/3.8compact/"></script> <script> require([ "esri/map", "esri/arcgis/utils", "dojo/domReady!" ], function(Map, arcgisUtils){ arcgisUtils.createMap("1a40fa5cc1ab4569b79f45444d728067", "mapDiv").then(function (response) { map = response.map; }); }); </script> </head> <body> <div id="mapDiv"></div> </body> </html>