-
-
Save dbouwman/8347059 to your computer and use it in GitHub Desktop.
Example showing how to use a map service layer as a Feature Layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="MapService Layer as Feature Layer" /> | |
<title>Create a Map</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> | |
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css"> | |
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> | |
<style> | |
html, body, #mapDiv { | |
padding: 0; | |
margin: 0; | |
height: 100%; | |
} | |
</style> | |
<script src="http://js.arcgis.com/3.8/"></script> | |
<script> | |
dojo.require("esri.map"); | |
dojo.require("esri.layers.FeatureLayer"); | |
var map, l; | |
function init(){ | |
map = new esri.Map("mapDiv", { | |
center: [-111.8, 40.7], | |
zoom: 3, | |
basemap: "streets" | |
}); | |
l = new esri.layers.FeatureLayer('http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5', {mode:1}); | |
map.addLayer(l); | |
} | |
dojo.ready(init); | |
</script> | |
</head> | |
<body class="claro"> | |
<div id="mapDiv"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment