Docstoc

Re Google Maps API

Document Sample
Re Google Maps API Powered By Docstoc
					                                             Re: Google Maps API

Re: Google Maps API

Source:
http://www.tech−archive.net/Archive/Internet−Server/microsoft.public.inetserver.asp.db/2006−07/msg00025.html



      • From: PinkBishop <pinkbishop@xxxxxxxxxxx>
      • Date: Wed, 05 Jul 2006 21:53:12 −0400

Thank You... will give it a try.


On Tue, 4 Jul 2006 02:25:18 −0500, "McKirahan" <News@xxxxxxxxxxxxx>
wrote:


        "PinkBishop" <pinkbishop@xxxxxxxxxxx> wrote in message
        news:7suja2pgnme9t0bfpp4i7mh4l7tir48vgq@xxxxxxxxxx



                 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


Re: Google Maps API                                                                                    1
                                 Re: Google Maps API
      '*
      '* 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

Re: Google Maps API                                                       2
                                       Re: Google Maps API

      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();

Re: Google Maps API                                                         3
                                   Re: Google Maps API
      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") + ". &nbsp;
      ";
      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                                            4

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:14
posted:11/27/2011
language:English
pages:4