Introduction
Note
This documentation is for Google Map Control 7.0 and above.
These tutorials require a previous knowledge of ASP.NET WebForms. They will take you step-by-step through creating applications that is using Google Map Control. We have provided tutorials to get you started on various application types.
ASP.NET Google Map Control is ASP.NET custom control that wraps most of Google Maps API functionality to provide and easy way of working with Google maps in ASP.NET application without even writing a line of JavaScript code.
Starting from version 7.0 and above Google Map control became a commercial product and have to be purchased for use. Trial period of 30 days is provided by default to give you some time to play with it and try it. You can continue using for free version 6 of the control, but old versions will not longer be developed and supported.
Get Google Map Control
Install the NuGet package GoogleMapControl in you ASP.NET application or just run the following command in the Package Manager Console
PM> Install-Package GoogleMapControl
Installing the package will add Google Map Control assembly (GoogleMaps.dll) to your project and will do automatically the required changes to Web.config in order to register control tags for use in your application.
<add tagPrefix="map" namespace="GoogleMaps" assembly="GoogleMaps" />
<add tagPrefix="map" namespace="GoogleMaps.Markers" assembly="GoogleMaps" />
<add tagPrefix="map" namespace="GoogleMaps.Directions" assembly="GoogleMaps" />
<add tagPrefix="map" namespace="GoogleMaps.Overlays" assembly="GoogleMaps" />
<add tagPrefix="map" namespace="GoogleMaps.Polylines" assembly="GoogleMaps" />
<add tagPrefix="map" namespace="GoogleMaps.Drawing" assembly="GoogleMaps" />
Get Google Maps API Key
Google Map Control is using Google Maps API for which you need to sign up for Google Maps API Key.
Once you got your Google Maps API Key you have two options:
- add the key per Google Map Control instance usage
<map:GoogleMap ID="GoogleMap1" runat="server" ApiKey="YOUR_API_KEY" MapType="HYBRID" Zoom="8" Latitude="42.1229" Longitude="24.7879" CssClass="map" DefaultAddress="sofia" Width="100%">
</map:GoogleMap>
- add the key in Web.config file per all Google Map Control usage
<appSettings>
...
<add key="GoogleMaps.ApiKey" value="YOUR_API_KEY" />
...
</appSettings>
Actually you can use/combine both sometimes. When both are used the one with higher priority is key applied to the control instance. That could be helpfull in scenarious when you want to add more than one Google Maps API Key support to you applications.