Use now 3 parameters for matrix: loc/dst/src

This commit is contained in:
Fabien Girard
2015-12-02 18:11:15 +01:00
committed by Patrick Niklaus
parent 478d4a571a
commit f2ee0aad20
7 changed files with 72 additions and 27 deletions
+6 -2
View File
@@ -41,9 +41,13 @@ def request_route waypoints, params={}
request_path "viaroute", waypoints, defaults.merge(params)
end
def request_table waypoints, params={}
def request_table waypoints, sources, params={}
defaults = { 'output' => 'json' }
request_path "table", waypoints, defaults.merge(params)
options = defaults.merge(params)
locs = (sources.size > 0) ? (waypoints.compact.map { |w| "dst=#{w.lat},#{w.lon}" } + sources.compact.map { |w| "src=#{w.lat},#{w.lon}" }) : waypoints.compact.map { |w| "loc=#{w.lat},#{w.lon}" }
params = (locs + options.to_param).join('&')
uri = generate_request_url ("table" + '?' + params)
response = send_request uri, waypoints, options, sources
end
def got_route? response