//geocoder digit var geocodersArray = [{url: "http://gis.domain.com:6080/arcgis/rest/services/EON/AirportsGeocode/GeocodeServer", name:"Landing Facility Geocoder"}]; var geocoder = new esri.dijit.Geocoder({ map: map, autoComplete: true, maxLocations:10, geocoders: geocodersArray, geocoderMenu: false, arcgisGeocoder: false },"search"); geocoder.startup(); }
Solved! Go to Solution.
function updateLocator(ioArgs){ if(ioArgs.url === locatorUrl + "/findAddressCandidates"){ ioArgs.content['Single Line Input'] = ioArgs.content.singleLine; } return ioArgs; }
function updateLocator(ioArgs){ if(ioArgs.url === locatorUrl + "/findAddressCandidates"){ ioArgs.content['Single Line Input'] = ioArgs.content.singleLine; } return ioArgs; }
function updateLocator(ioArgs){ if(ioArgs.url === "http://sagisservices.thempc.org/saint/rest/services/Locators/SAGIS.CENTERLINES/GeocodeServer" + "/findAddressCandidates"){ ioArgs.content['Street'] = ioArgs.content.singleLine; } return ioArgs; }
geocoder.startup(); esri.setRequestPreCallback(updateLocator); dojo.connect(geocoder, "onFindResults", function (results) { dojo.some(results.results, function (result) { //display a popup for the first result map.infoWindow.setTitle(i18n.tools.search.title); map.infoWindow.setContent(result.name); map.infoWindow.show(result.feature.geometry); return true; }); }); dojo.connect(geocoder, "onClear", function () { if (map.infoWindow.isShowing) { map.infoWindow.hide(); } }); } function updateLocator(ioArgs) { if (ioArgs.url === "http://sagisservices.thempc.org/saint/rest/services/Locators/SAGIS.CENTERLINES/GeocodeServer" + "/findAddressCandidates") { ioArgs.content['Street'] = ioArgs.content.singleLine; } return ioArgs; }
var gc = [{ url: "http://sagisservices.thempc.org/saint/rest/services/Locators/SAGIS.CENTERLINES/GeocodeServer", name:"Custom Geocoder", singleLineFieldName: "Single Line Input" }];
<!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>Geocoder Widget</title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css"> <style> html, body, #map { height:100%; width:100%; margin:0; padding:0; } body { background-color:#FFF; overflow:hidden; font-family:"Trebuchet MS"; } #search { display: block; position: absolute; z-index: 2; top: 20px; left: 75px; } </style> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/"></script> <script> dojo.require("esri.map"); dojo.require("esri.dijit.Geocoder"); var geocoder; function init() { var map = new esri.Map("map",{ basemap: "topo", center: [-117.19,34.05], //long, lat zoom: 13 }); var gc = [{ url: "http://sagisservices.thempc.org/saint/rest/services/Locators/SAGIS.CENTERLINES/GeocodeServer", name:"Custom Geocoder", singleLineFieldName: "Single Line Input" }]; var geocoder = new esri.dijit.Geocoder({ map: map, autoComplete: true, maxLocations:10, geocoders: gc, geocoderMenu: false, arcgisGeocoder: false }, "search"); geocoder.startup(); } dojo.ready(init); </script> </head> <body> <div id="search"></div> <div id="map"></div> </body> </html>