Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone,

I am student and working my own application for knowing how to use Google map API v3.
and i call a Java script function named "Up_pan" from my application on Window phone 7.

JavaScript
function Up_pan() {

    var center = map.getCenter();
    var New_center = { lat: center.lat() + 1,
        lng: center.lng() + 1
    };
    map.panTo(New_center);
}


but it did not work.
Please someone help me.
Thank for reading and helping me.
Posted

This is my solution.
JavaScript
function up() {
         var center = map.getCenter();
        var New_center = new google.maps.LatLng(center.lat() + 0.001, center.lng() );
        map.setCenter(New_center);
}

Thx for reading and i hope it will help someone.
 
Share this answer
 
I believe it should look like this:
JavaScript
function Up_pan() {
  var center = map.getCenter();
  var New_center = new google.maps.LatLng(center.lat() + 1, center.lng() + 1);
  map.panTo(New_center);
}
The reason for this is because you weren't specifiying the right type for panTo. Note that your code is offsetting the center in a diagonal line.
 
Share this answer
 
v2
Thank a lot.
Your answer helped me a lot.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900