Hi, I'm trying to add a FeatureLayer to my map, but I can't seem to be able to create a FeatureLayer. I tried with the featureCollection and the url (that was valid) but neither option worked. I added Firebug and JavaScript Debuger, but I don't really know how to use them yet. So I don't know how to get an error message to help me.
Any suggestions?
<code>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <!--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></title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/tundra/tundra.css" /> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/esri/dijit/css/Popup.css" /> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.7/js/dojo/dijit/themes/claro/claro.css" /> <style type="text/css"> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map{ margin: 0; padding: 0; } </style> <script type="text/javascript">var dojoConfig = { parseOnLoad: true };</script> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5" type="text/javascript"></script> <script type="text/javascript"> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("esri.map"); var map; function CreateFeatureLayer(graphics) { //document.write("CreateFeatureLayer" + "<br />");
function getSymbol(type) { var url = "" switch (type) { case "Permanent": url = "images/circle_blue.svg"; break; case "Equipment": url = "images/triangle_blue.svg"; break; case "Temporary": url = "images/star_blue.svg"; break; case "Sprinkler": url = "images/square_blue.svg"; break; }
return new esri.symbol.PictureMarkerSymbol(url, 20, 20); }
function GetGraphicArray(theString) { //document.write("GetGraphicArray" + "<br />"); var firstsplit = theString.split(';'); var singleElement var secondSplit var infoTemplate var pt var graphic var graphics = new Array();
function init() { //document.write("init" + "<br />"); var initExtent = new esri.geometry.Extent({"xmin":-562799.140878082,"ymin":5331608.39701711,"xmax":1547257.08731259,"ymax":6786507.98048048,"spatialReference":{"wkid":3400}}); map = new esri.Map("map",{extent:initExtent});
theString = "Main Camp,Permanent,This is the main scout's camp.,6,50,Valid;" + "Summer camp,Temporary,This is the summer scout's camp.,5.9,49.8,Valid;" + "Winter camp,Temporary,This is the winter scout's camp.,6,49.8,Valid;" + "Bulldozer 1,Equipment,This is a Bulldozer.,4,46,Valid;" + "Bulldozer 2,Equipment,This is a Bulldozer.,4,47,Valid;" + "Sprinkler 33,Sprinkler,This is a sprinkler,5,49,Valid;" + "Sprinkler 34,Sprinkler,This is a sprinkler,5,49.5,Valid";