Select to view content in your preferred language

Please help: Zoom to Lat/Long not working

501
2
Jump to solution
07-02-2012 11:40 AM
DorotheaKnigge
Deactivated User
Hello,

I am developing a web application for managing collisions.  Users will be able to enter new collision data.  Collision data often comes with the "lats and longs" of where the incident occurred; therefore I would like to add a zoom to lat and long "Submit" button to the application.  The problem is that clicking the "Submit" button zooms out not in like it should.
I'm new to Javascript API development and would sincerely appreciate help in getting this to work.

Dorothea
0 Kudos
1 Solution

Accepted Solutions
FengZhang2
Deactivated User
First, the submit function needs to be changed as:

          function submit()  {     Lat = parseFloat(document.getElementById("inputLat").value);     Lng = parseFloat(document.getElementById("inputLng").value);      var pt = new esri.geometry.Point(Lng,Lat);     map.centerAndZoom(pt, .5);  }


There is a NIM bug report for this issue. [NIM079613 The Map.centerAndZoom(mapPoint, levelOrFactor) function falsely zooms out on a Dynamic MapServiceLayer with version 2.6, 2.7, and 2.8; but the same code works well with version 2.5 and before.]
http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDc5NjEz

If you switch to JS API version 2.5, it works fine.

View solution in original post

0 Kudos
2 Replies
FengZhang2
Deactivated User
First, the submit function needs to be changed as:

          function submit()  {     Lat = parseFloat(document.getElementById("inputLat").value);     Lng = parseFloat(document.getElementById("inputLng").value);      var pt = new esri.geometry.Point(Lng,Lat);     map.centerAndZoom(pt, .5);  }


There is a NIM bug report for this issue. [NIM079613 The Map.centerAndZoom(mapPoint, levelOrFactor) function falsely zooms out on a Dynamic MapServiceLayer with version 2.6, 2.7, and 2.8; but the same code works well with version 2.5 and before.]
http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDc5NjEz

If you switch to JS API version 2.5, it works fine.
0 Kudos
DorotheaKnigge
Deactivated User
Thank you so very much Feng Zhang, you have made my day!  It is working like it should.

Dorothea

(How do I award the points you deserve?)
0 Kudos