Google Maps API
Anybody have any experience with plotting map points with Google Maps
API from an Access DB?
I have a database with about 90 locations that I would like positioned
in the Google Maps. I found a cool tool to get the long and latitudes
to complete the database, now just need to figure out how to get all
that data to appear on the maps.
All guidance appreicated.
Re: Google Maps API
"PinkBishop" <pinkbishop [at] hotmail.com> wrote in message
news:7suja2pgnme9t0bfpp4i7mh4l7tir48vgq [at] 4ax.com...
>
>
> Anybody have any experience with plotting map points with Google Maps
> API from an Access DB?
>
> I have a database with about 90 locations that I would like positioned
> in the Google Maps. I found a cool tool to get the long and latitudes
> to complete the database, now just need to figure out how to get all
> that data to appear on the maps.
>
> All guidance appreicated.
Will this help? Watch for word-wrap.
I developed this 8 months ago but haven't looked at it since.
It originally had three different color "pins" denoting types of locations.
GoogleMap.vbs generates an XML file from your database table.
Change the name of the database (cMDB) and table (cSQL).
GoogleMap.htm displays a Google Map with your data.
Change "key" value for "http://maps.google.com".
[ GoogleMap.vbs ]
Option Explicit
'*
'* Declare Constants
'*
Const cVBS = "GoogleMap.vbs"
Const cXML = "GoogleMap.xml"
Const cMDB = "GoogleMap.mdb"
Const cDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Const cSQL = "SELECT * FROM [GoogleMapTable] ORDER BY AutoNumber"
'*
'* Declare Variables
'*
Dim intOTF
intOTF = 0
Dim strOTF
Dim strSFN
strSFN = WScript.ScriptFullName
strSFN = Left(strSFN,InStrRev(strSFN,"\"))
'*
'* Declare Objects
'*
Dim objMDB
Set objMDB = CreateObject("ADODB.Connection")
objMDB.Open cDSN & cMDB
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objOTF
Set objOTF = objFSO.OpenTextFile(strSFN & cXML,2,True)
objOTF.WriteLine("<markers>")
Dim objRST
'*
'* Progress Started
'*
WScript.Echo(cVBS & ": Started at " & Now)
'*
'* Read table and write XML file for Google Maps.
'*
Set objRST = objMDB.Execute(cSQL)
Do While Not objRST.EOF
strOTF = " <marker id='" & objRST("AutoNumber")
strOTF = strOTF & "' lat='" & objRST("Latitude")
strOTF = strOTF & "' lng='" & objRST("Longitude")
strOTF = strOTF & "' csz='" & objRST("City") & ", " &
objRST("State") & " " & objRST("Zip")
strOTF = strOTF & "' cty='" & objRST("County")
strOTF = strOTF & "'/>"
strOTF = Replace(strOTF,"'",Chr(34))
objOTF.WriteLine(strOTF)
intOTF = intOTF + 1
objRST.MoveNext
Loop
objRST.Close
Set objRST = Nothing
'*
'* Progress Finished
'*
objOTF.WriteLine("</markers>")
Set objOTF = Nothing
Set objFSO = Nothing
Set objMDB = Nothing
'*
WScript.Echo(cVBS & ": Finished at " & Now & " (" & intOTF & ")")
[ GoogleMap.htm ]
<!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>
<title>GoogleMap.htm</title>
<script type="text/javascript"
src="http://maps.google.com/maps?file=api&v=1&key=??????">
</script>
</head>
<body>
<center>
<div id="map" style="width: 600px; height: 600px; border: solid 2px
black"></div>
<script type="text/javascript">
//<![CDATA[
var icon1 = new GIcon();
icon1.image =
"http://labs.google.com/ridefinder/images/mm_20_white.png";
icon1.shadow =
"http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon1.iconSize = new GSize(12, 20);
icon1.shadowSize = new GSize(22, 20);
icon1.iconAnchor = new GPoint(6, 20);
icon1.infoWindowAnchor = new GPoint(5, 1);
function createMarker(point, icon, html) {
var marker = new GMarker(point, icon);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
if (GBrowserIsCompatible()) {
var map = new GMap(document.getElementById("map"));
map.centerAndZoom(new GPoint(-89.50000, 40.20000), 10);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
var markers = "GoogleMap.xml";
var request = GXmlHttp.create();
request.open("GET", markers, true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = request.responseXML;
var markers =
xmlDoc.documentElement.getElementsByTagName("marker");
for (var i=0; i<markers.length; i++) {
var html = "<span style='font-family:Arial,Helvetica;
font-size:8pt'>";
html += markers[i].getAttribute("id") + ".
";
html += markers[i].getAttribute("csz") + "<br>";
html += markers[i].getAttribute("cty") + " County";
html += "</span>";
var lati =
parseFloat(markers[i].getAttribute("lat"));
var long =
parseFloat(markers[i].getAttribute("lng"));
var point = new GPoint(long, lati);
var marker = createMarker(point, icon1, html);
map.addOverlay(marker);
}
}
}
request.send(null);
}
//]]>
</script>
</center>
</body>
</html>
Re: Google Maps API
Thank You... will give it a try.
On Tue, 4 Jul 2006 02:25:18 -0500, "McKirahan" <News [at] McKirahan.com>
wrote:
>"PinkBishop" <pinkbishop [at] hotmail.com> wrote in message
>news:7suja2pgnme9t0bfpp4i7mh4l7tir48vgq [at] 4ax.com...
>>
>>
>> Anybody have any experience with plotting map points with Google Maps
>> API from an Access DB?
>>
>> I have a database with about 90 locations that I would like positioned
>> in the Google Maps. I found a cool tool to get the long and latitudes
>> to complete the database, now just need to figure out how to get all
>> that data to appear on the maps.
>>
>> All guidance appreicated.
>
>Will this help? Watch for word-wrap.
>
>I developed this 8 months ago but haven't looked at it since.
>It originally had three different color "pins" denoting types of locations.
>
>GoogleMap.vbs generates an XML file from your database table.
> Change the name of the database (cMDB) and table (cSQL).
>
>GoogleMap.htm displays a Google Map with your data.
> Change "key" value for "http://maps.google.com".
>
>
>[ GoogleMap.vbs ]
>
> Option Explicit
> '*
> '* Declare Constants
> '*
> Const cVBS = "GoogleMap.vbs"
> Const cXML = "GoogleMap.xml"
> Const cMDB = "GoogleMap.mdb"
> Const cDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
> Const cSQL = "SELECT * FROM [GoogleMapTable] ORDER BY AutoNumber"
> '*
> '* Declare Variables
> '*
> Dim intOTF
> intOTF = 0
> Dim strOTF
> Dim strSFN
> strSFN = WScript.ScriptFullName
> strSFN = Left(strSFN,InStrRev(strSFN,"\"))
> '*
> '* Declare Objects
> '*
> Dim objMDB
> Set objMDB = CreateObject("ADODB.Connection")
> objMDB.Open cDSN & cMDB
> Dim objFSO
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Dim objOTF
> Set objOTF = objFSO.OpenTextFile(strSFN & cXML,2,True)
> objOTF.WriteLine("<markers>")
> Dim objRST
> '*
> '* Progress Started
> '*
> WScript.Echo(cVBS & ": Started at " & Now)
> '*
> '* Read table and write XML file for Google Maps.
> '*
> Set objRST = objMDB.Execute(cSQL)
> Do While Not objRST.EOF
> strOTF = " <marker id='" & objRST("AutoNumber")
> strOTF = strOTF & "' lat='" & objRST("Latitude")
> strOTF = strOTF & "' lng='" & objRST("Longitude")
> strOTF = strOTF & "' csz='" & objRST("City") & ", " &
>objRST("State") & " " & objRST("Zip")
> strOTF = strOTF & "' cty='" & objRST("County")
> strOTF = strOTF & "'/>"
> strOTF = Replace(strOTF,"'",Chr(34))
> objOTF.WriteLine(strOTF)
> intOTF = intOTF + 1
> objRST.MoveNext
> Loop
> objRST.Close
> Set objRST = Nothing
> '*
> '* Progress Finished
> '*
> objOTF.WriteLine("</markers>")
> Set objOTF = Nothing
> Set objFSO = Nothing
> Set objMDB = Nothing
> '*
> WScript.Echo(cVBS & ": Finished at " & Now & " (" & intOTF & ")")
>
>[ GoogleMap.htm ]
>
><!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>
><title>GoogleMap.htm</title>
><script type="text/javascript"
> src="http://maps.google.com/maps?file=api&v=1&key=??????">
></script>
></head>
><body>
><center>
><div id="map" style="width: 600px; height: 600px; border: solid 2px
>black"></div>
><script type="text/javascript">
>//<![CDATA[
>var icon1 = new GIcon();
> icon1.image =
>"http://labs.google.com/ridefinder/images/mm_20_white.png";
> icon1.shadow =
>"http://labs.google.com/ridefinder/images/mm_20_shadow.png" ;
> icon1.iconSize = new GSize(12, 20);
> icon1.shadowSize = new GSize(22, 20);
> icon1.iconAnchor = new GPoint(6, 20);
> icon1.infoWindowAnchor = new GPoint(5, 1);
>function createMarker(point, icon, html) {
> var marker = new GMarker(point, icon);
> GEvent.addListener(marker, "click", function() {
> marker.openInfoWindowHtml(html);
> });
> return marker;
>}
>if (GBrowserIsCompatible()) {
> var map = new GMap(document.getElementById("map"));
> map.centerAndZoom(new GPoint(-89.50000, 40.20000), 10);
> map.addControl(new GSmallMapControl());
> map.addControl(new GMapTypeControl());
> var markers = "GoogleMap.xml";
> var request = GXmlHttp.create();
> request.open("GET", markers, true);
> request.onreadystatechange = function() {
> if (request.readyState == 4) {
> var xmlDoc = request.responseXML;
> var markers =
>xmlDoc.documentElement.getElementsByTagName("marker");
> for (var i=0; i<markers.length; i++) {
> var html = "<span style='font-family:Arial,Helvetica;
>font-size:8pt'>";
> html += markers[i].getAttribute("id") + ".
>";
> html += markers[i].getAttribute("csz") + "<br>";
> html += markers[i].getAttribute("cty") + " County";
> html += "</span>";
> var lati =
>parseFloat(markers[i].getAttribute("lat"));
> var long =
>parseFloat(markers[i].getAttribute("lng"));
> var point = new GPoint(long, lati);
> var marker = createMarker(point, icon1, html);
> map.addOverlay(marker);
> }
> }
> }
> request.send(null);
>}
>//]]>
></script>
></center>
></body>
></html>
>
>
Re: Google Maps API
Can you provide a link to the cool tool you found to determine latitude and longitude?
Thanks
Re: Google Maps API
<Dabbler> wrote in message news:eOMcFaIvGHA.4756 [at] TK2MSFTNGP04.phx.gbl...
> Can you provide a link to the cool tool you found to determine latitude
and longitude?
I don't remember what I used.
Google is your fried;
latitude longitude lookup
identified:
Look up the exact location of millions of places.
http://www.lat-long.com/
U.S. Gazetteer
http://www.census.gov/cgi-bin/gazetteer
Latitude And Longitude Lookup
http://www.calculatorcat.com/latitude_longitude.phtml
Convert Degrees Minutes Seconds to Decimal Degrees
http://www.uky.edu/KGS/gis/converter.htm