Select to view content in your preferred language

How do you post initExtent into JavaScript code

742
2
Jump to solution
05-06-2013 08:56 AM
melissaGomez
Occasional Contributor
Need some assistance. Can someone direct me? I need to know where I can post the following IntiExtent:

var initExtent = new esri.geometry.Extent({"xmin":-17893.572423357622,"ymin":6709881.59745682,"xmax":-12385.329072411998,"ymax":6714133.407158158,"spatialReference":{"wkid":102100}});
map = new esri.Map("map",{extent:initExtent});

Into the following code:

<!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">
      <!--The viewport meta tag is used to improve the presentation and behavior of the samples 
      on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title> World Street Map</title>

    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css">
    <style>
      html, body, #map {
        padding:0;
        margin:0;
        height:100%;
      }
    </style>

    <script>var dojoConfig = {parseOnLoad: true};</script>
    <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/"></script>
    <script>
      dojo.require("esri.map");
      
      var map;
      
      dojo.ready(function() {
        map = new esri.Map("map", {
          basemap: "streets",
          center: [-0.136, 51.510],
          zoom: 15
        });
      });
    </script>
  </head>
  
  <body class="claro">
    <div id="map"></div>
  </body>
</html>
 
Please let me know. Thanks..
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor
Hi Melissa,

Here is an example:

<!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"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title> World Street Map</title>  <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css"> <style> html, body, #map { padding:0; margin:0; height:100%; } </style>  <script>var dojoConfig = {parseOnLoad: true};</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/"></script> <script> dojo.require("esri.map");  var map;     dojo.ready(function(){    var initExtent = new esri.geometry.Extent({"xmin":-17893.572423357622,"ymin":6709881.59745682,"xmax":-12385.329072411998,"ymax":6714133.407158158,"spatialReference":{"wkid":102100}});    map = new esri.Map("map",{extent:initExtent});        var baseMap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");        map.addLayer(baseMap); });   </script> </head>  <body class="claro"> <div id="map"></div> </body> </html> 

View solution in original post

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Melissa,

Here is an example:

<!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"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title> World Street Map</title>  <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css"> <style> html, body, #map { padding:0; margin:0; height:100%; } </style>  <script>var dojoConfig = {parseOnLoad: true};</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/"></script> <script> dojo.require("esri.map");  var map;     dojo.ready(function(){    var initExtent = new esri.geometry.Extent({"xmin":-17893.572423357622,"ymin":6709881.59745682,"xmax":-12385.329072411998,"ymax":6714133.407158158,"spatialReference":{"wkid":102100}});    map = new esri.Map("map",{extent:initExtent});        var baseMap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");        map.addLayer(baseMap); });   </script> </head>  <body class="claro"> <div id="map"></div> </body> </html> 
0 Kudos
melissaGomez
Occasional Contributor
Thank you, this helps..
0 Kudos