0

I want to implement a Google Map on my .NET page. I used the tool from Subgurim,

I could add the components well, but when browsing the page, I get tons of Javascript errors like:

GUnload is undefined

And the map is not shown. I read many posts describing my problem, but the only hint seems to be the maps API was not loaded.

I got a API key from Google. I am not very familiar with the interface; I activated both Google maps API services (v2 and v3) and got a key from "API access" for both separately.

I downloaded the Subgurim Maps version 3.4.1.

string streetAddress = "100 Russell St. Melbourne. VIC. 3000. Australia";
string mapKey = ConfigurationManager.AppSettings["googlemaps.subgurim.net"];
Subgurim.Controles.GeoCode geoCode = GMap1.getGeoCodeRequest(streetAddress, mapKey);
Subgurim.Controles.GLatLng gLatLng = new Subgurim.Controles.GLatLng(geoCode.Placemark.coordinates.lat, geoCode.Placemark.coordinates.lng);

GMap1.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal);
Subgurim.Controles.GMarker oMarker = new Subgurim.Controles.GMarker(gLatLng);
GMap1.addGMarker(oMarker);
Marc Climent
  • 9,434
  • 2
  • 50
  • 55
AGuyCalledGerald
  • 7,882
  • 17
  • 73
  • 120
  • You managed to get an API key for API v2 or v3? GUnload indicates v2 code, which is deprecated, and I thought they were no longer giving out new keys for API v2. The v3 API key is something different altogether (it's not required to use the v3 API, it's more for monitoring usage). – duncan Mar 27 '12 at 16:24
  • On the services tab, I activated first v3, then v2 and got a key from "API Access" for both (deleting the previous key). I am not sure I did it right. Either didn´t work. – AGuyCalledGerald Mar 27 '12 at 16:31

2 Answers2

0

Without access to your code, I deduce that you have included the Version 3 <script> tag but have coded the map in Version 2. Thus your code includes lots of G objects, including GUnload, which are not included in Version 3 and the API knows nothing about.

The immediate solution would be to include the Version 2 script. The full solution (since Version 2 is deprecated) is to convert the map to Version 3. I've no idea whether Subgurim makes that possible.

The new (short) key works for Version 3 and Version 2.

Andrew Leach
  • 12,945
  • 1
  • 40
  • 47
0

The problem was that the GMap control I used was in part of the page that was set visible="false". This caused the Javascript error.

AGuyCalledGerald
  • 7,882
  • 17
  • 73
  • 120