Including a Google Map mash up with an Info popup/bubble in your webpage

Here are 4 simple steps to include a Google map in your ASP.Net web page :

Dim Coord As CoordinateCoord = Geocode.GetCoordinates(“1600 Amphitheatre Parkway,Mountain View, CA  94043″)

_LONGITUDE = Coord.Longitude  ‘_LONGITUDE is a class level public variable
_LATITUDE = Coord.Latitude ‘_LONGITUDE is a class level public variable

  • In your ASPX page,
<table> 

<tr align="center"> 

<td colspan="2"> 

<div id="map" style="width: 450px; height: 300px"> 

</div> 

<script src="http://maps.google.com/maps?file=api&v=2&key=XXXXXXXX" type="text/javascript"> 

</script> 

<script type="text/javascript"> 

//<![CDATA[  

function load() { 

if (GBrowserIsCompatible()){ 

var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(<%=LATITUDE %>, <%=LONGITUDE %>), 13); 

var point = new GLatLng(<%=LATITUDE %>, <%=LONGITUDE %>);
var marker = new GMarker(point);map.addOverlay(marker); 

marker.openInfoWindowHtml('<b>html content</b>');} 

} 

//]]> 

</script> 

</td> 

</tr> 

</table> 

Just replace the XXXXXXXXXXXXXX with your API key and you are good to go. Happy Mapping !

2 Responses

  1. Great writeup. Keep the good work going. I visit your blog regularly.
    Mine is http://www.taxe.wordpress.com. Do visit and share your views…

  2. [url=http://hotfrog.fr/Entreprises/VIAGRA-ACHETER-VIAGRA-VIAGRA-ONLINE]viagra[/url] panel

Leave a Reply