nevermind (can't get the geocode example to work with my services...)

Discussion created by tmeyer123 on Oct 20, 2010
nevermind, it worked on the 5th different address I used, not sure why, just gonna keep grinding on


using 9.3. I have a map service and geocode service I'm trying to substitute with the ones used in esri's sample, but my map won't perform the geocode/pan/zoom when you click 'locate'.

I'm wondering if:
var geom = esri.geometry.geographicToWebMercator(candidate.location);
won't work right with the NAD_STATE_PLANE projection of my services

Bold- altered
Purple- taken out due to javascript error from candidate.attributes.Loc_name (which I then tried candidate.attributes.aug_09_co_cl_zip_mod_loc2, to no avail)

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <!--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>Find Address</title>
    <link rel="stylesheet" type="text/css" href="">
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">

      var map, locator;

      function init() {
        var initExtent = new esri.geometry.Extent({"xmin":650000,"ymin":630000,"xmax":700000,"ymax":660000,"spatialReference":{"wkid":102651}});
        map = new esri.Map("map", { extent: initExtent});
        var tiledMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://fpscnsde:8399/arcgis/rest/services/transportation2/MapServer");

        locator = new esri.tasks.Locator("http://fpscnsde:8399/arcgis/rest/services/tran_geocode2/GeocodeServer");
        dojo.connect(locator, "onAddressToLocationsComplete", showResults);

      function locate() {;
        var add = dojo.byId("address").value.split(",");
        var address = {
          Street : add[0],
          Zone: add[1]


      function showResults(candidates) {
        var candidate;
        var symbol = new esri.symbol.SimpleMarkerSymbol();
        var infoTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />Score: ${score}<br />Source locator: ${locatorName}");

        symbol.setColor(new dojo.Color([255,0,0,0.75]));

        var points =  new esri.geometry.Multipoint(map.spatialReference);

        for (var i=0, il=candidates.length; i<il; i++) {
          candidate = candidates[i];
          if (candidate.score > 70) {
            var attributes = { address: candidate.address, score:candidate.score, locatorName:candidate.attributes.Loc_name };
            var geom = esri.geometry.geographicToWebMercator(candidate.location);
            var graphic = new esri.Graphic(geom, symbol, attributes, infoTemplate);
   esri.Graphic(geom, new esri.symbol.TextSymbol(attributes.address).setOffset(0, 8)));

  <body class="claro">
    Address : <input type="text" id="address" size="60" value="519 W Dickson, 72701" /> <i>(Address, City, State, Zip)</i>
    <input type="button" value="Locate" onclick="locate()" /><br />
    <br />
    <div id="map" style="width:1200px; height:600px; border:1px solid #000;"></div>

when I click 'locate', it moves the map slightly (and incorrectly) and I then loose the ability to pan

this is my second day of trying to figure this out, thanks to anyone!