VinayBa

Map object creation

Discussion created by VinayBa on Aug 30, 2013
Latest reply on Aug 30, 2013 by VinayBa
HI All,

  I am confused over map object creation ,pls guide me.I add below code i got the map even if i dint refer any url

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Feature Layer Only Map</title>
    <link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css">
    <style>
      html, body, #map {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
    <script src="http://js.arcgis.com/3.6/"></script>
    <script>
 dojo.require("esri.symbols.SimpleFillSymbol");
 dojo.require("esri.symbols.SimpleLineSymbol");
 dojo.require("dojo/_base/Color");
 dojo.require("esri/graphic");
 var map;
 var infoTemplate;
      require([
        "dojo/dom-construct", 
        "esri/map", 
        "esri/layers/FeatureLayer",
        "esri/geometry/Extent",
        "esri/InfoTemplate",
  "esri/symbols/SimpleFillSymbol",
  "esri/symbols/SimpleLineSymbol", 
  "dojo/_base/Color", 
  "esri/graphic",
        "dojo/domReady!"
      ], function(
          domConstruct,
          Map,
          FeatureLayer,
          Extent,
          InfoTemplate,
    SimpleFillSymbol,
    SimpleLineSymbol,
    Color,
    graphic
        ) {
          var bounds = new Extent({
            "xmin":-16045622,
            "ymin":-811556,
            "xmax":7297718,
            "ymax":11142818,
            "spatialReference":{"wkid":102100}
          });
           map = new esri.Map("map", { 
          basemap: "streets", 
          zoom: 2 
        }); 
          
        }
      );
    </script>
  </head>
  <body>
    <div id="map"></div>
  </body>
</html>


but then i added below lines

var url = "http://10.32.9.106:6080/arcgis/rest/services/Administrative_Maps/World_Countries_v1/MapServer/0";

         

          var fl = new FeatureLayer(url, {
            id: "world-regions"
            //infoTemplate: template
          });
          
      
     map.addLayer(fl);


the map loaded then color of map changed and browser can anybody explain whats going on , how can i an initialize map without url and if i want map to be loaded from  my rest service http://10.32.9.106:6080/arcgis/rest/services/Administrative_Maps/World_Countries_v1/MapServer/0  what is  the right way.

Outcomes