Tengo un problema al agregar marcadores de mapa a gmaps usando jquery. Aquí está mi código hasta ahora.
En este momento, el error que estoy recibiendo es Uncaught ReferenceError: GLatLng is not defined
Las cargas de mapas fina y los datos JSON se han recuperado y analizado sintácticamente correcta ... De lo que puedo decir ...;)
añadiendo Mapa Pins/o marcadores w/e se llama a em ...
EventsModel.prototype.fetchMapPoints = function()
{
$.ajax({
dataType: "json",
url: '../../events/map',
success: eventsV.writeMapPoints
});
}
EventsView.prototype.writeMapPoints = function(Locations)
{
if (Locations.length>0) {
for (i=0; i<Locations.length; i++) {
var location = Locations[i];
eventsV.addMapPin(location);
}
//zoomToBounds();
}
}
EventsView.prototype.addMapPin = function(location)
{
var point = new GLatLng(location.lat, location.lng);
var marker = new GMarker(point);
map.addOverlay(marker);
bounds.extend(marker.getPoint());
$("<li />")
.html(location.name)
.click(function(){
showMessage(marker, location.name);
})
.appendTo("#list");
GEvent.addListener(marker,"click", function(){
showMessage(this);
});
}
inicialización del mapa
EventsModel.prototype.fetchGmapScript = function()
{
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=eventsV.initializeMap";
document.body.appendChild(script);
}
EventsView.prototype.initializeMap = function()
{
var myLatlng = new google.maps.LatLng(coords.lat, coords.long);
var myOptions = {
zoom: 13,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("Map"), myOptions);
}
Esto es lo que se ve los datos JSON como
[{"Event":"c16a5320fa475530d9583c34fd356ef5","lat":"37.8966942","lng":"-122.0599376","Image":"321752348.png","name":"Winning apple store","Description":""},{"Event":"b6d767d2f8ed5d21a44b0e5886680cb9","lat":"37.8995050","lng":"-122.0619770","Image":"","name":"Koreana Kitchen","Description":"Peter isn't invited!"}]