查看原文:http://www.ibloger.net/article/359.html
参考地址:http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/fl_no_basemap
在线演示:http://help.arcgis.com/en/webapi/javascript/arcgis/samples/fl_no_basemap/index.html
代码如下:
<!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">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Feature Layer Only Map</title>
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css">
<style>
html, body, #map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script>
<script>
var map;
require([
"dojo/dom-construct",
"esri/map", "esri/layers/FeatureLayer", "esri/dijit/Popup",
"dojo/domReady!"],
function(domConstruct) {
var bounds = new esri.geometry.Extent({
"xmin":-16045622,
"ymin":-811556,
"xmax":7297718,
"ymax":11142818,
"spatialReference":{"wkid":102100}}
);
var popup = new esri.dijit.Popup(null, domConstruct.create("div"));
map = new esri.Map("map", {
extent: bounds,
infoWindow: popup
});
var url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/2";
var template = new esri.InfoTemplate("World Regions", "Region: ${REGION}");
var fl = new esri.layers.FeatureLayer(url, {
id: "world-regions",
infoTemplate: template
});
map.addLayer(fl);
}
);
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>