Select to view content in your preferred language

Getting Started

10001
30
Jump to solution
01-18-2014 05:24 AM
jaykapalczynski
Honored Contributor
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 fine

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>
0 Kudos
1 Solution

Accepted Solutions
RobertoPepato
Deactivated User
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>


Do you have a skype (or any other IM) account? Let's try to figure it out via an IM conversation?

View solution in original post

0 Kudos
30 Replies
jaykapalczynski
Honored Contributor
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>
0 Kudos
RobertoPepato
Deactivated User
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 fine

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>


Hello Jay and be welcome to the Esri's forums.

Let's try to tackle your questions on two parts

1 - Your examples: I ran the samples your provided with the test mapId and it worked perfectly from my end. I've also created two fiddles so you can see it running and make some tweaks to understand the concepts if necessary. You can find the fiddles here:

http://jsfiddle.net/rpepato/eEcQf/
http://jsfiddle.net/rpepato/qQDzj/

Can you run your code from your browser and capture any js errors presented on the javascript console and post it back? This will help to identify your issue.

2 - Regarding to a new mapId: Subscribe to arcgis online through developers.arcgis.com and create a new map on arcgis online. Each map you create and save will receive a new id that you can use on your apps. Don't forget to make the map public so it can be accessible by anyone without authentication.

Regards.

Roberto Pepato
0 Kudos
jaykapalczynski
Honored Contributor
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

EDIT:  If I dont set to public is there a widget I need to add to prompt the user for a password that would be set in my Organization Account, or does this automatically happen when trying to access a secured feature?
0 Kudos
RobertoPepato
Deactivated User
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>


Oh, I see. Tried to run the example with the mapId provided for you and get the following error on JS console:

[ATTACH=CONFIG]30616[/ATTACH]

This could be caused by a couple of things:

1 - Invalid MapId: Both apps and maps have independent ids. Double check if you are using the mapId or the appId. You wan't to use the mapId.
2 - Unshared content: You need to share your map, so you can access it without authentication. If you you build a app an publish this app, you will need to make your map shared to everyone, so everyone can access through your app.

Let me know if this helps.

Roberto Pepato
0 Kudos
RobertoPepato
Deactivated User
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



I think that the fiddle thing that I mentioned above caused some confusion, so let me explain: When I said fiddle I was, in fact, referring to JSFiddle, an useful tool to share and tweak with JS code.

Fiddler is a great tool, but it's not related to our problem.

The javascript console is usually a browser extension that enables you to see any messages or errors in javascript processing. Some tools of this kind are: Firebug, Internet Explorer Developer Tools, Web Inspector, DragonFly, etc.
0 Kudos
jaykapalczynski
Honored Contributor
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
0 Kudos
jaykapalczynski
Honored Contributor
Getting the below in the Javascript console


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�?�(http://js.arcgis.com/3.8compact/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.8compact/init.js:221:367)�?�    at XMLHttpRequest.h (http://js.arcgis.com/3.8compact/init.js:160:167)"
status: 0
xhr: XMLHttpRequest
__proto__: a
init.js:187
w init.js:187
(anonymous function) init.js:186
c init.js:74
d init.js:74
resolve.callback init.js:75
c init.js:74
d init.js:74
reject.errback init.js:76
c init.js:74
d init.js:74
reject.errback init.js:76
c init.js:74
d init.js:74
reject.errback init.js:76
(anonymous function) init.js:190
f init.js:194
q init.js:194
w.reject init.js:197
a init.js:195
f init.js:195
q init.js:194
w.reject init.js:197
a init.js:195
f init.js:195
q init.js:194
w.reject init.js:197
a init.js:195
f init.js:195
q init.js:194
w.reject init.js:197
a init.js:195
f init.js:195
q init.js:194
w.reject init.js:197
r init.js:156
h
0 Kudos
RobertoPepato
Deactivated User
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


1. You tried to use my code (in fact the sample code) as is, without change the mapId and it doesn't work?
2. It looks like the Id is correct but I still can't get access to your map.

Take a look of the message I received after I try to access your map (and login):

[ATTACH=CONFIG]30617[/ATTACH]

Did you shared your map for all members of your organization or to everyone (public)?

[ATTACH=CONFIG]30618[/ATTACH]
0 Kudos
jaykapalczynski
Honored Contributor
Yea I tried your example EXACTLY....it works in Fiddle but not when I placed it in my IIS website.  Could there be something in IIS thats not letting me get there?
I used the map ID that you did in your Fiddle examples....that should work right?  Does not on my side

Am I not getting the correct ID to you?  Where exactly do I get it from....after I open it from within ArcGIS online org account?  When I try those ids I dont even get to where you are asking for a login

Do I have to have an editable Feature in the web map?  It should work with simply the basemap right>
Yes I shared it
[ATTACH=CONFIG]30619[/ATTACH]

Do you have an ID that works that I can test in my html code?
I have not idea whats going on....

This is my Whole page....all the code I am using

<!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>
0 Kudos