Using Google Maps


AspMap allows you to add a street or satellite map from Google Maps as a background layer of your Map control. 


Your use of the Google Maps API is subject to the terms of a legal agreement between you and Google, Inc.
Please read the Google Maps API Terms of Service for more information.


The following conditions take place when a GoogleMapsLayer object is added as a background layer:

  1. The coordinate system of the Map control will be set to PCS_PopularVisualisationMercator (this is the native coordinate system of Google Maps);

  2. 20 zoom levels from Google Maps will be added to the ZoomLevels collection of the Map control;

  3. The FullExtent property of the Map control will be set to the full extent of Google Maps;

  4. You have to explicitly or implicitly (via a .prj file for your shapefiles) specify the coordinate system for each layer added to the Map control.


It is highly recommended to place the Map control inside an ASP.NET AJAX UpdatePanel to avoid initializing the Google Maps engine on each postback.


The following sample code demonstrates how to add a satellite map from Google Maps:

Imports AspMap
Imports AspMap.Web
Imports AspMap.Web.Extensions

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

' You have to sign up for a Maps API key at
' The key below will work only for 'localhost'
Dim gml As GoogleMapsLayer = New GoogleMapsLayer("AIzaSyAAPkc5UaLRr4BIr9eapnB8zNXHUKQXUeo")

gml.MapType = GoogleMapType.Satellite

map.BackgroundLayer = gml

' set the transparency of the main map image to display other layers over the satellite map
map.ImageFormat = ImageFormat.Png
map.ImageOpacity = 0.4

End Sub

See the GoogleMapsApp.aspx sample in the standard samples.





© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)