Variables as Coordinates in google.maps.LatLng

1,102 views
Skip to first unread message

Ben Reichert

unread,
Aug 11, 2011, 7:55:23 PM8/11/11
to google-map...@googlegroups.com

I am new to JavaScript and the Google Maps API. Is there a way to use the values of the variables latitude and longitude for coordinates in google.maps.LatLng? I cannot get this to work as is. Thanks!


var latitude = 46.000000

var longitude = -124.000000

  

myLocation = new google.maps.LatLng(latitude, longitude);

  var marker = new google.maps.Marker({

      position: myLocation, 

      map: map, 

      title:"Here I am!"

  });   

Jeremy Geerdes

unread,
Aug 11, 2011, 9:21:33 PM8/11/11
to google-map...@googlegroups.com
This code should work. Why don't you provide a link to the page you're trying to use it on so we can see what's going on.

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/Gt-75r8dpKIJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply all
Reply to author
Forward
0 new messages