Class GoogleStaticMap
The Google Static Maps API lets you embed a Google Maps image on your web page without requiring JavaScript or any dynamic page loading. The Google Static Maps API service creates your map based on URL parameters sent through a standard HTTP request and returns the map as an image you can display on your web page.
Inheritance
Inherited Members
Namespace:GoogleMaps
Assembly:GoogleMaps.dll
Syntax
public class GoogleStaticMap : WebControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor
Properties
Address
The address to geocode and set the static map center.
Declaration
public string Address { get; set; }
Property Value
Type | Description |
---|---|
System.String | The address. |
ApiClientID
The client ID to use Google Maps API under premium plan.
Declaration
public string ApiClientID { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ApiKey
All Maps API applications* should load the Maps API using an API key. Using an API key enables you to monitor your application's Maps API usage, and ensures that Google can contact you about your application if necessary. If your application's Maps API usage exceeds the Usage Limits (https://developers.google.com/maps/documentation/javascript/usage#usage_limits), you must load the Maps API using an API key in order to purchase additional quota. Google Maps API for Business developers must not include a key in their requests. Please refer to Loading the Google Maps JavaScript API for Business-specific instructions(https://developers.google.com/maps/documentation/business/clientside#MapsJS). To create your API key:
- Visit the APIs Console at https://code.google.com/apis/console and log in with your Google Account.
- Click the Services link from the left-hand menu.
- Activate the Google Maps API v3 service.
- Click the API Access link from the left-hand menu. Your API key is available from the API Access page, in the Simple API Access section. Maps API applications use the Key for browser apps.
Declaration
public string ApiKey { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ApiSignature
The digital signature to use Google Maps API under standard plan with pay-as-you-go or premium plan.
Declaration
public string ApiSignature { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Center
The LatLng static map center position.
A property which handles the Latitude
and Longitude
values.
The static map center LatLng can be set through Latitude
and Longitude
properties of
Center
or by comma separated values pair string.
For example:
GoogleStaticMap1.Center.Latitude = 42.1229;
GoogleStaticMap1.Center.Longitude = 24.7879;
or
GoogleStaticMap1.Center = "42.1229,24.7879";
Declaration
[PersistenceMode(PersistenceMode.InnerProperty)]
public LatLng Center { get; set; }
Property Value
Type | Description |
---|---|
LatLng | The center. |
Height
Defines the height dimensions of the map image. This parameter is affected by the scale parameter, described below; the final output size is the product of the size and scale values.
Declaration
public override Unit Height { get; set; }
Property Value
Type | Description |
---|---|
System.Web.UI.WebControls.Unit |
Overrides
ImageFormat
Defines the format of the resulting image. By default, the Google Static Maps API creates PNG images. There are several possible formats including GIF, JPEG and PNG types. Which format you use depends on how you intend to present the image. JPEG typically provides greater compression, while GIF and PNG provide greater detail. For more information, see GoogleStaticMap.ImageFormats.
Declaration
public GoogleStaticMap.ImageFormats? ImageFormat { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<GoogleStaticMap.ImageFormats> |
Language
Defines the language to use for display of labels on map tiles. Note that this parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used.
Declaration
public string Language { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MapType
Defines the type of map to construct. There are several possible maptype values, including roadmap, satellite, hybrid, and terrain.
Declaration
public MapType? MapType { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<MapType> |
Region
Defines the appropriate borders to display, based on geo-political sensitivities. Accepts a region code specified as a two-character ccTLD ('top-level domain') value.
Declaration
public string Region { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Scale
Affects the number of pixels that are returned. scale=2 returns twice as many pixels as scale=1 while retaining the same coverage area and level of detail (i.e. the contents of the map don't change). This is useful when developing for high-resolution displays, or when generating a map for printing. The default value is 1. Accepted values are 2 and 4 (4 is only available to Google Maps APIs Premium Plan customers.)
Declaration
public int Scale { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
TagKey
Gets the System.Web.UI.HtmlTextWriterTag value that corresponds to this Web server control. This property is used primarily by control developers.
Declaration
protected override HtmlTextWriterTag TagKey { get; }
Property Value
Type | Description |
---|---|
System.Web.UI.HtmlTextWriterTag |
Overrides
Width
Defines the width dimensions of the map image. Maps smaller than 180 pixels in width will display a reduced-size Google logo. This parameter is affected by the scale parameter, described below; the final output size is the product of the size and scale values.
Declaration
public override Unit Width { get; set; }
Property Value
Type | Description |
---|---|
System.Web.UI.WebControls.Unit |
Overrides
Zoom
Defines the zoom level of the map, which determines the magnification level of the map. This parameter takes a numerical value corresponding to the zoom level of the region desired.
Declaration
public int Zoom { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
GetStaticUrl()
Gets the generated Url of Google Static Maps API.
Declaration
protected virtual string GetStaticUrl()
Returns
Type | Description |
---|---|
System.String |
RenderBeginTag(HtmlTextWriter)
Renders the HTML opening tag of the control to the specified writer. This method is used primarily by control developers.
Declaration
public override void RenderBeginTag(HtmlTextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.HtmlTextWriter | writer | A System.Web.UI.HtmlTextWriter that represents the output stream to render HTML content on the client. |