如何在google maps API上通过city + zipCode获取距离

111*_*110 1 javascript google-maps google-api google-maps-api-3

http://maps.googleapis.com/maps/api/distancematrix/xml?origins=PLACE,ZIPCODE&destinations=PLACE,ZIPCODE&sensor=false
Run Code Online (Sandbox Code Playgroud)

我需要通过地名和邮政编码来获得两个地方之间的距离.但是,当我传递由"逗号"分隔的参数时,它不起作用.如何传递这两个参数?

小智 5

使用+分隔地名和邮政编码:

http://maps.googleapis.com/maps/api/distancematrix/xml?origins=NEW+YORK+11535&destinations=WASHINGTON+20544&sensor=false
Run Code Online (Sandbox Code Playgroud)