Javascript and ArcGIS Server

4137
10
04-26-2016 09:25 AM
PennySawyer1
New Contributor

I am new to Javascript one of the assignments says to copy the c:\inetpub\wwroot; does this have to do with the web adaptor through the GIS Server?  I copied the url map service I have hosted to the GIS Server from my code and it works but I do see the map displayed.

0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus

Penny,

The c:\inetpub\wwroot; has to do with Microsoft IIS on your machine. Can you provide more detail as

one of the assignments says to copy the c:\inetpub\wwroot;

does not make any sense.

0 Kudos
StevenGraf1
Occasional Contributor III

I think we are missing some of the information from the question.  The wwwroot folder is created when you install IIS.   You would never need to copy it.  The wwwroot folder is where the web adaptor is installed and also where you store web applications.  Do you mean you need to copy your application to the wwwroot folder?

-Steven

0 Kudos
PennySawyer1
New Contributor

Hi Steven,

I purchased a book titled :Building Web Applications with ArcGIS."  The  code below is what they provided and from the illustration in the book ; I should see the map within the code. When I run the code in chrome I see everything except the map.

<html>

<head>

<title>Bestaurants Web Application</title>

<link rel="stylesheet" href="arcgisjs/esri.css">

<script src="arcgisjs/3.10/init.js"></script>

<script>

dojo.require("esri.map");

function startup()

{

  //alert("map is about to load");

  //create the map object and load it into the 'mymap' div element

  var map = new esri.Map("mymap");

  //load the layer into an object

  var lyr = new esri.layers.ArcGISDynamicMapServiceLayer

  (

  "http://arcgismachine:6080/arcgis/rest/services/Bestaurants/MapServer"

  );

    

  //add the layer to map

  map.addLayer(lyr);

}

dojo.addOnLoad(startup);

</script>

</head>

<body>

<table border =1 width = '1000px' height = '700px' align =center>

<tr>

<td colspan =2 width='100%' height ='10%'>

  <!-- The toolbar where we will place tools -->

  The toolbar that contains useful tools to interact with the map and search for restaurants  <b> (100% width and 10% height) </b>

</td>

</tr>

<tr>

<td width='20%' height ='40%'>

  <!-- The legend of the map goes here -->

  The legend items go here <br> <b>(20% width and 40% height) </b>

</td>

<td width='80%' height ='85%' rowspan =2 valign = top>

  <div id='mymap' class='arcgismap' >

  </div>

</td>

</tr>

<tr>

<td width='20%' height ='40%'>

   <!-- The search results will go here -->

   The search results goes here, we will display the search for the users in this box <br> <b>(20% width and 40% height)</b>

</td>

</tr>

<tr>

  <td colspan =2 width='100%' height ='5%'>

  <!-- The status bar for displaying messages goes here -->

  The status bar goes here  <b> (100% width and 5% height)</b>

  </td>

</tr>

</table>

</body>

</html>

0 Kudos
PennySawyer1
New Contributor

Also, I checked on our GIS Server and we do not have a web adapter.  Part of the exercise is that I copy c:\inetpub\wwroot. I guess that make since why I am not seeing the map.

0 Kudos
StevenGraf1
Occasional Contributor III

You don't need the web adaptor.  When you have :6080 in your url, you are basically going directly to arcgis server and skipping a web adaptor if one was present.  Are there any features in your bestaurants layer?  I'm still not sure what the exercise means when it says to copy the c:\inetpub\wwwroot.  Could you upload a photo of the exercise or type out the exercise?

-Steven

0 Kudos
StevenGraf1
Occasional Contributor III

Got to love Google..I found the exact exercise. It's telling you to copy the html file (or your entire web page folder) you made to the c:\inetpub\wwwroot folder.  This isn't really necessary for development.  You can launch the html page from any folder.  Once you put it in the wwwroot folder you could access it from anywhere via a url.

0 Kudos
StevenGraf1
Occasional Contributor III

I don't have the local esri.css, init.js, and dynamic map service so I replaced the URLS with some from Esri's developer site and it works.  I suspect that the file path to your esri css, init js or dynamic map service layer isn't correct.  You aren't specifying a basemap on your new esri.Map request so all you would see is the dynamic map service layer.  Your dynamic service url says 'arcgismachine

'  You may need to replace that with your computer name or is that your computer name?

<html>
<head>
<title>Bestaurants Web Application</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.16/esri/css/esri.css">
<script src="https://js.arcgis.com/3.16/"></script>

<script>
dojo.require("esri.map");
function startup()
{
  //alert("map is about to load");

  //create the map object and load it into the 'mymap' div element
  var map = new esri.Map("mymap");

  //load the layer into an object
  var lyr = new esri.layers.ArcGISDynamicMapServiceLayer
  (
  "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapSe..."
  );
    
  //add the layer to map
  map.addLayer(lyr);

}

dojo.addOnLoad(startup);


</script>

</head>
<body>

<table border =1 width = '1000px' height = '700px' align =center>


<tr>
<td colspan =2 width='100%' height ='10%'>
  <!-- The toolbar where we will place tools -->
  The toolbar that contains useful tools to interact with the map and search for restaurants  <b> (100% width and 10% height) </b>
</td>
</tr>




<tr>
<td width='20%' height ='40%'>
  <!-- The legend of the map goes here -->
  The legend items go here <br> <b>(20% width and 40% height) </b>
</td>
<td width='80%' height ='85%' rowspan =2 valign = top>
  <div id='mymap' class='arcgismap' >
  </div>
</td>
</tr>


<tr>
<td width='20%' height ='40%'>
   <!-- The search results will go here -->
   The search results goes here, we will display the search for the users in this box <br> <b>(20% width and 40% height)</b>
</td>
</tr>


<tr>

  <td colspan =2 width='100%' height ='5%'>
  <!-- The status bar for displaying messages goes here -->
  The status bar goes here  <b> (100% width and 5% height)</b>
  </td>


</tr>

</table>




</body>
</html>
0 Kudos
PennySawyer1
New Contributor

Here is my code that I wrote. When I run it from google chrome the url opens. Like I said I am just not seeing a visual of the map. I know it must be because, I do not have a web adapter installed to our GIS Server.

<html>

<head>

<title>Bestaurants Web Application</title>

<link rel= "stylesheet" href="arcgisjs/esri.css">

<script src="arcgisjs/3.10/init.js"></script>

<script>

dojo.required ("esri.map");

function startup()

{

   //alert ("map is about to load");

  

   //create the map object and load it in 'mymap' div element

   var map = new esri.Map ("mymap")

  

   //load the map into an object

   var lyr = new esri.layers.ArcGISDynamicMapServiceLayer

       {

            "http://gis.newtonnc.gov:6080/arcgis/manager/#f=BuildingWebApps"

       );

   

  //add the layer to map

  map.addLayer(lyr);

 

}

  dojo.addOnLoad (startup);

 

</script>

</head>

<body>

<table border =1 width = '1000px' height = '700px' align =center>

<tr>

<td colspan =2 width='100%' height ='10%'>

  <!-- The toolbar where we will place tools -->

  The toolbar that contains useful tools to interact with the map and search for restaurants  <b> (100% width and 10% height) </b>

</td>

</tr>

<tr>

<td width='20%' height ='40%'>

  <!-- The legend of the map goes here -->

  The legend items go here <br> <b>(20% width and 40% height) </b>

</td>

<td width='80%' height ='85%' rowspan =2 valign = top>

  <div id='mymap'class= "arcgismap">

  </div>

</td>

</tr>

<tr>

<td width='20%' height ='40%'>

   <!-- The search results will go here -->

   The search results goes here, we will display the search for the users in this box <br> <b>(20% width and 40% height)</b>

</td>

</tr>

<tr>

  <td colspan =2 width='100%' height ='5%'>

  <!-- The status bar for displaying messages goes here -->

  The status bar goes here  <b> (100% width and 5% height)</b>

  </td>

</tr>

</table>

</body>

</html>

0 Kudos
StevenGraf1
Occasional Contributor III

I don't think that's the issue.  You can load services without a web adaptor.  Your URL to your dynamic map service is wrong.  Dynamic map services must end with /MapServer

EX:  http://gis.newtonnc.gov:6080/rest/services/bestaurants/MapServer

0 Kudos