Custom Maps
With CustomMaps we can define the images shown by the control, based on latitude, longitud, and zoom.
We use the GCopyright, GCopyrightCollection, GTileLayerOptions, GTileLayer, and GCustomMapType classes.
Their use is very simple and we can understand it following the example.
More important is the correct definition for the tileUrlTemplate property of GTileLayerOptions.
This is a template which defines the URL for the image that GoogleMaps will call, and is the one we have to manage. It's structure is as follows:
http://host/tile?x={X}&y={Y}&z={Z}.png
Where X is the latitude, Y is the longitude, and Z is the zoom. For example, http://host/tile?x=3&y=27&z=5.png
Code.aspx
<cc1:GMap ID="GMap1" runat="server" />
Code.aspx.cs
GMap1.setCenter(new GLatLng(37.4419, -122.1419), 13);
GCopyrightCollection myCopyright = new GCopyrightCollection("© ");
myCopyright.Add(new GCopyright("Demo",
new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)),
0,
"©2008 Subgurim"));
GTileLayerOptions tileLayerOptions = new GTileLayerOptions();
tileLayerOptions.tileUrlTemplate = "http://code.google.com/apis/maps/documentation/examples/include/tile_crosshairs.png";
GTileLayer tilelayer = new GTileLayer(myCopyright, 10, 10, tileLayerOptions);
GCustomMapType customMapType = new GCustomMapType(tilelayer, new GMercatorProjection(13), "Subgurim");
GMap1.Add(customMapType);