Hi,

Its quite simple:

Just add two textboxes to your page where the user will input the from
and To location. Then on button click, call this method

function ShowPath()
{
        var gdir ;
        var fromAddress = document.getElementById
("TextboxFrom").value;
        var toAddress = document.getElementById("TextboxTo").value;

        var map = new GMap2(document.getElementById("map_canvas"));
        var geocoder = new GClientGeocoder();

        if (geocoder)
        {
            geocoder.getLatLng(fromAddress,function(point) {

                                                            if (!
point)
                                                            {
                                                              alert
(fromAddress + " not found");
                                                            }
                                                            else
                                                            {
 
map.setCenter(point, 15);
                                                              var
marker = new GMarker(point);
 
map.addOverlay(marker);
                                                              //
marker.openInfoWindowHtml(fromAddress);
                                                            }
                                                        }
                            );
        }

        if (geocoder)
        {
            geocoder.getLatLng(toAddress,function(point) {

                                                            if (!
point)
                                                            {
                                                              alert
(toAddress + " not found");
                                                            }
                                                            else
                                                            {
 
map.setCenter(point, 15);
                                                              var
marker = new GMarker(point);
 
map.addOverlay(marker);
                                                              //
marker.openInfoWindowHtml(toAddress);
                                                            }
                                                        }
                            );
        }
        gdir  = new GDirections(map, document.getElementById
("directions"));
        gdir.load("from: " + fromAddress + " to: " + toAddress);
}

Hope this helps...

On Jan 25, 11:09 am, rahul <[email protected]> wrote:
> Hello All
>
> I need to develop one like this:http://maps.google.co.in/maps?
> hl=en&tab=wl. Can any one help me in getting the source for the above.
>
> regards
> Rahul R

-- 
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