Additional Code - zip file 174 KB

Author's Help File - zip file 72 KB


Listing 1: Browser Cap Section

<browserCaps>
	<case match="Gecko/[-\d]+">
		browser=Netscape
		frames=true
		tables=true
		cookies=true
		javascript=true
		javaapplets=true
		cmascriptversion=1.5
		w3cdomversion=1.0
		css1=true
		css2=true
		xml=true
		tagwriter=System.Web.UI.HtmlTextWriter
		<case match="rv:1.0[^\.](?'letters'\w*)">
		version=6.0
		majorversion=6
		minorversion=0
		<case match="^b" with="${letters}">
			   beta=true
		</case>
		</case>
		<case match="rv:1(\.\d+)(\.\d)(?'letters '\w*)">
		version=7.0
		majorversion=7
		minorversion=0
		<case match="^b" with="${letters}">
		beta=true
		</case>
	</case>
	</case>
</browserCaps>

Listing 2: Basic Map

	private void Page_Load(object sender, System.EventArgs e)
	{
		GMapControl1.Width=400;
		GMapControl1.Height=400;
		GMapControl1.MapType=MapControl.GMapType.MAP;
		GMapControl1.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		GMapControl1.CenterAndZoom
		  (new GPoint(36.224264,-86.628273),9);
	}

Listing 3: Setting Properties

	private void Page_Load(object sender, System.EventArgs e)
	{
			GMapControl1.Width=400;
			GMapControl1.Height=400;
			GMapControl1.MapType=MapControl.GMapType.MAP;
			GMapControl1.ScrollControlType=MapControl.GMapScrollControl.LARGE ;
			GMapControl1.EnableDragging=false;
			GMapControl1.ShowMapTypeControl=true;
			GMapControl1.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
			GMapControl1.CenterAndZoom
			  (new GPoint(36.224264,-86.628273),9);
		}

Listing 4: Overlaying Markers

	private void Page_Load(object sender, System.EventArgs e)
	{
		GMapControl1.Width=400;
		GMapControl1.Height=400;
		GMapControl1.MapType=MapControl.GMapType.MAP;
		GMapControl1.ScrollControlType=MapControl.GMapScrollControl.LARGE ;
		GMapControl1.ShowMapTypeControl=true;
		GMapControl1.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		GPoint myPoint= new GPoint(36.1645,-86.7811);
		GPoint myPoint2= new GPoint(36.224264,-85.928273);
		string sFormattedHtml="<b><font
		color=red>Nashville</font><b><br>
		</font><img src=http://localhost/maptest/images/images.jpg
		/><br><a href=http:
		  //test >Visit Nashville </a>";
		GMarker myMarker= new GMarker(myPoint);
		GMarker myMarker2= new GMarker(myPoint2);
		//Overloaded constructor
		GMapControl1.OverlayMarker(myMarker,sFormattedHtml);

		GMapControl1.OverlayMarker(myMarker2);
		GMapControl1.CenterAndZoom(myPoint,9);

	}

Listing 5: Custom Markers

	private void Page_Load(object sender, System.EventArgs e)
	{
		GMapControl1.Width=400;
		GMapControl1.Height=400;
		GMapControl1.MapType=MapControl.GMapType.MAP;
 		GMapControl1.ScrollControlType=MapControl.GMapScrollControl.LARGE ;
 		GMapControl1.ShowMapTypeControl=true;
		 GMapControl1.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		GPoint myPoint= new GPoint(36.1645,-86.7811);
		GPoint myPoint2= new GPoint(36.224264,-85.928273);
		string sFormattedHtml="<b><font color=red>
		Nashville</font><b><br> </font><img src=
		http://localhost/maptest/images/images.jpg
		    /><br><a href=http://test >Visit Nashville </a>";
		GMarker myMarker= new GMarker(myPoint);
		//Creating our custom icon
		GIcon myIcon = new GIcon();
		myIcon.ImageURL="http://labs.google.com/
		ridefinder/images/mm_20_blue.png";
		myIcon.ShadowImageURL="http://labs.google.com/
		ridefinder/images/mm_20_shadow.png";
		myIcon.ShadowSize= new GSize(22,20);
		myIcon.IconSize = new GSize(12,20);
		myIcon.IconAnchor= new GPoint(6,20);
		myIcon.InfoWindowAnchor= new GPoint(5,1);
		GMarker myMarker2= new GMarker(myPoint2);
		myMarker.Icon=myIcon;
		GMapControl1.OverlayMarker(myMarker,sFormattedHtml);
		myMarker2.Icon=myIcon; myMarker2.Icon.
		ImageURL="http://labs.google.com/ridefinder/images/mm_20_green.png";
		GMapControl1.OverlayMarker(myMarker2);
		GMapControl1.CenterAndZoom(myPoint,9);
	}


Listing 6: Overlaying Lines

	private void Page_Load(object sender, System.EventArgs e)
	{
		GMapControl1.Width=400;
		GMapControl1.Height=400;
		GMapControl1.MapType=MapControl.GMapType.MAP; 
		GMapControl1.ScrollControlType=
		MapControl.GMapScrollControl.LARGE ;
		GMapControl1.ShowMapTypeControl=true;
		GMapControl1.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		// Creating the 3 points through which the line passes
		GPoint pt1 = new GPoint(40.631096,-75.488627);
		GPoint pt2= new GPoint(35.113813,-85.321043);
		GPoint pt3= new GPoint(33.590040,-101.866815);
		//Adding it to the points collections
		GPoints ptList= new GPoints();
		//Adding it to the points collections
		ptList.Add(pt1);
		ptList.Add(pt2);
		ptList.Add(pt3);
		//Adding the points collection to the line
		GLine myline = new GLine(ptList);
		//Setting the Color , weight and Opacity
		myline.LineColor=Color.Blue;
		myline.Weight =3;
		myline.Opacity=1;
		GMapControl1.OverlayLine(myline);
		GMapControl1.CenterAndZoom(pt2,14);
   }


Listing 7: Multiple Controls in a Page

	private void Page_Load(object sender, System.EventArgs e)
	{
		//First Control
		GMapControl1.Width=200;
		GMapControl1.Height=200; 
		GMapControl1.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		GMapControl1.CenterAndZoom(new GPoint(36.224264,-86.628273),9);
		//Second Control
		GMapControl2.Width=200;
		GMapControl2.Height=200;
		GMapControl2.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		GMapControl2.CenterAndZoom
		  (new GPoint(35.07,-85.27),9);
		//Third Control
		GMapControl3.Width=200;
		GMapControl3.Height=200; 
		GMapControl3.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		GMapControl3.CenterAndZoom(new GPoint(30.32,-97.77),9);
		//Fourth Control
		GMapControl4.Width=200;
	 	 GMapControl4.Height=200;
		 GMapControl4.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		GMapControl4.CenterAndZoom
		 (new GPoint(39.57,-75.10),9);
}



Listing 8: Data Binding in GMap Control

	private void Page_Load(object sender, System.EventArgs e)
{
		GMapControl1.Width=400;
		GMapControl1.Height=400;
		//create the datatable
		DataTable dt = new DataTable("Databind");
		dt.Columns.Add( new DataColumn ("latitude",typeof(double)));
		dt.Columns.Add( new DataColumn ("longitude",typeof(double)));
		dt.Columns.Add( new DataColumn
		  ("htmltext",typeof(string)));
		//Filling the datatable
		for( int i=0; i<10;i++)
		{
		DataRow dr= dt.NewRow();
		dr["latitude"]=36.224264+i;
		dr["longitude"]=-86.628273+i;
		dr["htmltext"]= "<b>POINTER NUM:
		  </b> " +i.ToString();
		dt.Rows.Add(dr);

		}
		GMapControl1.GoogleMapKey=ConfigurationSettings.AppSettings["DevKey"];
		GMapControl1.DataSource=dt;
		//set the latitude data field
		GMapControl1.MarkerLatitudeField=
		  "latitude";
		//set the longitude data field
		GMapControl1.MarkerLongitudeField=
		  "longitude";
		//set the text data field
		GMapControl1.MarkerText="htmltext";
		GMapControl1.DataBind();
		GMapControl1.CenterAndZoom
		(new GPoint(36.224264,-86.628273),14);
		}

Additional Code - zip file 174 KB

Author's Help File - zip file 72 KB