Yes sorry about that, Ive tested both versions, heres the v2 one:
google.load("maps", "2");
// make a json request to get the map data from the Map action
$(function() {
if (google.maps.BrowserIsCompatible()) {
//$.getJSON("http://" + window.location.host + "/Home/Map",
initialise);
var mapdata = $.getJSON("/GoogleMaps/Map", initialise);
}
});
function initialise(mapData) {
var map = new google.maps.Map2($("#map")[0]);
map.addControl(new google.maps.SmallMapControl());
map.addControl(new google.maps.MapTypeControl());
map.setMapType(G_SATELLITE_MAP);
var latlng = new google.maps.LatLng(52.370, 4.893);
var zoom = 8;
map.setCenter(latlng, zoom);
map.setCenter(latlng, zoom);
$.each(mapData.locations, function(i, location) {
setupLocationMarker(map, location);
});
}
function setupLocationMarker(map, location) {
console.debug(location.LatLng);
var latlng = new google.maps.LatLng(location.LatLng);
var marker = new google.maps.Marker(latlng);
map.addOverlay(marker);
}
On 16 sep, 15:17, Andrew Leach <[email protected]> wrote:
> On 16 September 2010 14:07, Stef <[email protected]> wrote:
>
> > Hi
> > I am trying to create markers from a database. I do this by outputting
> > the DB results to json and loading the json in the google maps code.
> > The JSON is valid and is being loaded.
>
> This looks like Version 3 code
>
> > var marker = new google.maps.Marker({
> > position: location.Latlng,
> > map: map,
> > });
> > }
>
> but I doubt that postion can be a string. You probably need to create
> a maps.LatLng object instead.
>
> Version 3 Group:http://groups.google.com/group/google-maps-js-api-v3/
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.