centerAndZoom Issue

2298
1
Jump to solution
03-04-2013 06:50 AM
TheoReaves
New Contributor II
Hello.  I am new to working with esri mapping, and to dojo.

I have a link on my right content pannel, to zoom the map to a location:

<a href="javascript:zoomTo(870974.25311024, 278611.38852797);">10:30 156 W NORTH ROWLETT                ST</a>


Here is my "zoomTo" function:
      function zoomToBAD(lat, lon) {        //alert('zoomTo function');         var point = new esri.geometry.Point(lon, lat, {           wkid: "2274"         });         //alert('2');         var wmpoint = esri.geometry.geographicToWebMercator(point);         //alert('3');                  try{    map.centerAndZoom(wmpoint,0.2);   }catch(err){    alert('Error centering map');   }         //alert('done');       }                    function zoomTo(lat,lon){        try{        var zoomLevel = 15;         var point = new esri.geometry.Point([lat, lon], new esri.SpatialReference({             wkid: 2274         }));         console.log("Zooming to location...", point, zoomLevel);         map.centerAndZoom(point, zoomLevel);         console.log("Zoom complete");          }         catch(err){          alert(err);         }             }


I've tried both of these functions.  Neither generate an error, but my map does not do anything. 
Any help would be appreciated.

Thanks,
Theo
0 Kudos
1 Solution

Accepted Solutions
TheoReaves
New Contributor II
Ok, found my problem.  I had the wrong wkid.  After putting in the right one for my map, all appears to be working now.

View solution in original post

0 Kudos
1 Reply
TheoReaves
New Contributor II
Ok, found my problem.  I had the wrong wkid.  After putting in the right one for my map, all appears to be working now.
0 Kudos