0

我想从谷歌地图解析源和目的地之间的所有位置,如下所示:Google Maps API v3 Directions Example

 <script type="text/javascript"> 

 var directionsService = new google.maps.DirectionsService();
 var directionsDisplay = new google.maps.DirectionsRenderer();

 var map = new google.maps.Map(document.getElementById('map'), {
   zoom:7,
   mapTypeId: google.maps.MapTypeId.ROADMAP
 });

 directionsDisplay.setMap(map);
 directionsDisplay.setPanel(document.getElementById('panel'));

 var request = {
   origin: 'Kolkata', 
   destination: 'Patna',
   travelMode: google.maps.DirectionsTravelMode.DRIVING
 };

//echo 'directionsService.route()';

 directionsService.route(request, function(response, status) {
   if (status == google.maps.DirectionsStatus.OK) {
     directionsDisplay.setDirections(response);
   }
 });
</script> 
</body> 
</html>

我想要类似http://maps.googleapis.com/maps/api/directions/xml?origin=%22+kolkata+%22&destination=%22+patna+%22&sensor=false

这样我就可以解析位置并将其存储在数据库中的表中。请帮助找到一种方法来做到这一点。在此先感谢

4

1 回答 1

0

我假设您需要(以您使用的任何语言)将 XML 放入数组或数据表(或等效项)中,然后将这些逐行插入数据库中。

PHP: http: //gaarf.info/2009/08/13/xml-string-to-php-array/

VB.NET:http://msdn.microsoft.com/en-us/library/ekw4dh3f(v=vs.71).aspx _

于 2012-08-23T12:57:06.143 回答