I am trying to add a bunch of map markers to a map using Django template tag variables as the latitude and longitude but things aren't working too well. Here is what I have in the view javascript code. I load the code in as an external JS file. Here is what i have to initialize everything. Also when I did this the google map didn't even show up any more. It disappeared.
function initialize() {
var latLng = new google.maps.LatLng(41.85, -87.65);
map = new google.maps.Map(document.getElementById('map_canvas'), {
zoom: 8,
center: latLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
marker = new google.maps.Marker({
position: latLng,
title: 'Point A',
map: map,
draggable: true
});
// Update current position inf o and load in markers from database
loadMarkers();
updateMarkerPosition(latLng);
geocodePosition(latLng);
And here is what loadMarkers() looks like
function loadMarkers(){
{% for mark in latest_marks %}
var point = new google.maps.LatLng({{mark.lat}},{{mark.lng}});
var marker = new google.maps.Marker({
position: point,
map: map,
});
{% endfor %}
}
Any help would be appreciated. Cheers.
map: map,. Those make javascript barf.