Ok I am sorry .. I'll try finding a free domain and host the map code
their first ..

On Dec 13, 3:21 am, rohit <[email protected]> wrote:
> I am trying to create a map app using google maps API. My aim is to
> get some locations as input from the user (as string of addresses like
> "Mountain view, CA"... etc), store those strings in an array and then
> use that array as an input to a function that can in an iterative
> manner calculate the driving distance between every pair of address in
> the array and store those distances in a new 2-D array where ,
> dist[i][j] = driving distance b/w i and j
> dist[i][j] = 0 for i = j
> dist[i][j] = dist [j][i]
> while searching for solutions to the problem I did come across some
> potential solutions like 
> -http://briancray.com/2009/06/23/calculate-driving-distance-google-map...
> but the solution provided here calculates the driving distance between
> any 2 addresses that are entered by the user in 2 separate forms. My
> question is how can I sort of automate this process while using an
> array as the input?(Like using a loop or something to do this, i am
> not pretty sure about this)
> I am pasting the code I have made so far here (As i don't have a
> domain of my own).
> It just takes as input an address and puts a marker on that location &
> prints all the points that the user has marked so far.
>
> //Code
> <head>
> </script>
>     <script type="text/javascript">
>
>     var map = null;
>     var geocoder = null;
>     var list = new Array();
>     var i = 0;
>
>     function initialize() {
>       if (GBrowserIsCompatible()) {
>         map = new GMap2(document.getElementById("map_canvas"));
>         map.setCenter(new GLatLng(28° 40' 0, 77° 13' 0), 13);
>         geocoder = new GClientGeocoder();
>         map.setUIToDefault();
>
>       }
>     }
>
>     function AddAddress(address) {
>       if (geocoder) {
>         geocoder.getLatLng(
>           address,
>           function(point) {
>             if (!point) {
>               alert(address + " not found");
>             } else {
>               map.setCenter(point, 13);
>               var marker = new GMarker(point);
>               map.addOverlay(marker);
>               marker.openInfoWindowHtml(address);
>               list[i]=address;
>               i++;
>               document.getElementById("List").innerHTML=list;
>
>             }
>           }
>         );
>       }
>     }
>
>     </script>
>   </head>
>
>   <body onload="initialize()" onunload="GUnload()">
>     <form action="#" onsubmit="AddAddress(this.address.value); return
> false">
>       <p>
>         <input type="text" size="30" name="address" value="New Delhi" /
>
>         <input type="submit" value="Go!" />
>       </p>
>     </form>
>       <div id="map_canvas" style="width: 400px; height: 300px"></div>
>       <h3>You Entered</h3>
>       <div id="List"></div>
>   </body>
>
> //Code

--

You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.


Reply via email to