I just ran a quick test using your code but pointing to my local install and everything works fine. I suspect that your local install is not setup correctly. If you try the url to your init.js file in a browser does it display the file contents? http://<myserver>/arcgis_js_api/library/3.3/jsapi/init.jsWhen you setup the local install did you follow the install instructions and update the init.js and dojo.js files to replace the [HOSTNAME_AND_PATH_TO_JSAPI] with the correct values?
Can you post the code you are using?
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--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>Map</title> <link rel="stylesheet" href="http://localhost:8090/arcgis_js_api/library/3.3/jsapi/js/dojo/dijit/themes/claro.css"> <link rel="stylesheet" href="http://localhost:8090/arcgis_js_api/library/3.3/jsapi/js/esri/css/esri.css"> <style> html, body { height: 97%; width: 98%; margin: 1%; } #rightPane{ width:20%; } #topPane{ border: solid #97DCF2 1px; } #resultsdiv{ font-size: small; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script type="text/javascript" src="3.3.js"></script> <script> dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.layout.AccordionContainer"); dojo.require("esri.map"); var locator; var map; var geoResults; function init() { //Singapore Location var initExtent = new esri.geometry.Extent({"xmin":11530566.441108467,"ymin":144898.1479504113,"xmax":11579333.265154345,"ymax":159459.40183871775,"spatialReference":{"wkid":102100}}); map = new esri.Map("map",{ wrapAround180:true, extent:initExtent, zoom: 11 }); var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"); map.addLayer(basemap); dojo.connect(map, 'onLoad', function(theMap) { //resize the map when the browser resizes dojo.connect(dijit.byId('map'), 'resize', map,map.resize); }); //Create geocoder locator = new esri.tasks.Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"); //Show result when the geocoding is complete dojo.connect(locator, "onAddressToLocationsComplete", function(geocodeResults) { geoResults = geocodeResults; var rdiv = dojo.byId("resultsdiv"); var content = []; var i=0; rdiv.innerHTML = (""); dojo.forEach(geocodeResults, function(result) { if(result.score > 80){ content.push("<fieldset>"); content.push("<i>Score:</i> " + result.score); content.push("<br/>"); //Create hyperlink; call function zoomTo() content.push("<i>Address Found In</i> : " + "<a onclick =' zoomTo("+ i +")'>" + result.address + "</a>"); content.push("<br/>"); content.push("</fieldset>"); } i++; }); rdiv.innerHTML += content.join(""); alert("Geo Code Done\n(Click on results)"); }); }//end of inti() dojo.ready(init); //Function for "Center At Address" button function zoomTo(index) { map.graphics.clear(); var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 5, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0, 0.5]), 8), new dojo.Color([255, 0, 0, 0.9])); var pointMeters = esri.geometry.geographicToWebMercator(geoResults[index].location); var locationGraphic = new esri.Graphic(pointMeters, symbol); var font = new esri.symbol.Font().setSize("12pt").setWeight(esri.symbol.Font.WEIGHT_BOLD); var textSymbol = new esri.symbol.TextSymbol(geoResults[index].address, font, new dojo.Color([255, 0, 0, 0.8])).setOffset(5, 15); //add the location graphic and text with the address to the map map.graphics.add(locationGraphic); map.graphics.add(new esri.Graphic(pointMeters, textSymbol)); } //Perform the geocode. This function runs when the "Locate" button is pushed. function locate() { var address = { 'SingleLine': dojo.byId("address1").value }; var options = { address:address, outFields:["*"] }; //optionally return the out fields if you need to calculate the extent of the geocoded point locator.addressToLocations(options); } </script> </head> <body class="claro"> <div id="content" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline', gutters:true" style="width: 100%; height: 100%; margin: 0;"> <div id="rightPane" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'left'"> <div data-dojo-type="dijit.layout.AccordionContainer"> <div data-dojo-type="dijit.layout.ContentPane" id="topPane" data-dojo-props="title:'Search', selected:true"> <div id="legendDiv"> Locate Single Address <input type="text" id="address1" size="32" value="Choa Chu Kang"/> <p><button onclick="locate()">Locate</button> <hr> Batch GeoCode (File) <input type="text" size="32" value=".xlsx"/> <p><button onclick="">Batch Locate</button> <hr> </div> </div> <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'Results'"> <div id="resultsdiv"></div> </div> </div> </div> <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'" style="overflow:hidden;"> </div> </div> </body> </html>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.