Link to home
Start Free TrialLog in
Avatar of Shaggy1
Shaggy1Flag for Afghanistan

asked on

SQL Server Google Maps Lat/Long C# .net

I need to retrieve Lat/Longitude (which are seperate columns in my sql db) and show them as points in Google Maps in my .net site. I've been looking and looking but can't find any real definitive answer to this. Would appreciate the help.  I already have the lat/long so i don't need to use the geocoder. Thanks!
Avatar of mrxrsd
mrxrsd

Do you know this component? http://en.googlemaps.subgurim.net/

For integrating google maps into your code you need to access the google
apis.Click on the following lick.

http://code.google.com/apis/maps/index.html

Next step signup the google maps api key and give your website address to generate the unique key for that site.Then it will generate one key for the site. If you use this key to another site it won't work.

Example :

Key is

ABQIAAAAmnOQlz4O2XMui-auz2pa9BQCy-*

Integrate the following code in your webpages.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAmnOQlz4O2XMui-auz2pa9BQCy-*"
type="text/javascript"></script>
<script type="text/javascript">

//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}

//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 500px; height: 300px"></div>
</body>
</html>

Open in new window


Hope this very useful to you.  
Avatar of Shaggy1

ASKER

Thanks for the response. Already familiar with Google API, got my key , etc. I need to be able to retrieve Lat/Long that i have stored in my database and create the points on the map.
Avatar of Shaggy1

ASKER

Just saw the last link , i'll try it out
Avatar of nishant joshi
this might help you....... GoogleMapDemo.aspx.cs
Avatar of Shaggy1

ASKER

nishantcomp2512,

Empty code except references....on that file.
ASKER CERTIFIED SOLUTION
Avatar of nishant joshi
nishant joshi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shaggy1

ASKER

Thanks! This helped.