Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

google maps allways get the same map

 
david dabush
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new with google maps API and i try to get a map by defining cordinates.
but i allways get the same map

function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
geocoder = new google.maps.Geocoder();
var address = "HaYarkon 100 TelAviv Israel";
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK)
{
TelAviv = new google.maps.LatLng(results[0].geometry.location.lat(),results[0].geometry.location.lng());
}
});

var myOptions = {
zoom:7,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: TelAviv
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
directionsDisplay.setMap(map);
}
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks as if the address you're searching for is hardcoded - why wouldn't you always get the same map?
 
david dabush
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no, dont loook on the example
even if i change the cordinate i still get the same map allways of Los-Angeles Area
this is just an Example of Tel-Aviv cordinates but i still get Los-Angeles map
 
K. Gil
Ranch Hand
Posts: 75
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
isn't that javascript? :)

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
david dabush wrote:no, dont loook on the example

Then what are we supposed to look at?

Please post the real code you'd like us to examine and be sure to UseCodeTags.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic