From a6b31fa638ee85205f69ee0142938f73164c8ec8 Mon Sep 17 00:00:00 2001 From: Abhinav Saini Date: Tue, 12 Mar 2024 22:42:50 +0530 Subject: [PATCH] minor changes --- javascript/flex_poly.js | 3 +-- javascript/index.js | 3 --- python/Here_Maps.py | 8 ++------ python/Testing/Test_Here_Maps.py | 6 ------ ruby/main.rb | 2 +- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/javascript/flex_poly.js b/javascript/flex_poly.js index d0fcca9..6feb5ed 100644 --- a/javascript/flex_poly.js +++ b/javascript/flex_poly.js @@ -181,7 +181,7 @@ function encodeUnsignedNumber(val) { function encodeScaledValue(value) { // Transform a integer `value` into a variable length sequence of characters. - // `appender` is a callable where the produced chars will land to + // `appender` is a callable where the produced chars will land to let numVal = Num(value); const negative = numVal < 0; numVal <<= Num(1); @@ -195,7 +195,6 @@ function encodeScaledValue(value) { module.exports = { encode, decode, - ABSENT, LEVEL, ALTITUDE, diff --git a/javascript/index.js b/javascript/index.js index 6f64c46..f0d8c7e 100644 --- a/javascript/index.js +++ b/javascript/index.js @@ -42,12 +42,9 @@ const getPoints = body => body.routes const getPolyline = body => polyline.encode(getPoints(JSON.parse(body))); - const getRoute = (cb) => request.get(url, cb); const handleRoute = (e, r, body) => { - console.log(body) - const _polyline = getPolyline(body); console.log(_polyline); diff --git a/python/Here_Maps.py b/python/Here_Maps.py index c5bc8a0..666fdc5 100644 --- a/python/Here_Maps.py +++ b/python/Here_Maps.py @@ -13,6 +13,7 @@ TOLLGURU_API_URL = "https://apis.tollguru.com/toll/v2" POLYLINE_ENDPOINT = "complete-polyline-from-mapping-service" +# From and To locations source = "Philadelphia, PA" destination = "New York, NY" @@ -25,7 +26,6 @@ "departure_time": "2021-01-05T09:46:08Z", } - def get_geocodes_from_here_maps(address): """Fetching geocodes form Here maps""" params = {"searchtext": address, "apiKey": HERE_API_KEY} @@ -35,7 +35,6 @@ def get_geocodes_from_here_maps(address): ]["DisplayPosition"].values() return (latitude, longitude) - def get_polyline_from_here_maps( source_latitude, source_longitude, destination_latitude, destination_longitude ): @@ -60,10 +59,7 @@ def get_polyline_from_here_maps( ) # we converted that to encoded(google) polyline return polyline_from_heremaps - -"""Calling Tollguru API""" - - +# Calling Tollguru API def get_rates_from_tollguru(polyline): # Tollguru resquest parameters headers = {"Content-type": "application/json", "x-api-key": TOLLGURU_API_KEY} diff --git a/python/Testing/Test_Here_Maps.py b/python/Testing/Test_Here_Maps.py index 6fcb347..fc6d2af 100644 --- a/python/Testing/Test_Here_Maps.py +++ b/python/Testing/Test_Here_Maps.py @@ -21,7 +21,6 @@ "departure_time": "2021-01-05T09:46:08Z", } - def get_geocodes_from_here_maps(address): """Fetching geocodes form here maps""" url = "https://geocoder.ls.hereapi.com/6.2/geocode.json" @@ -32,7 +31,6 @@ def get_geocodes_from_here_maps(address): ]["DisplayPosition"].values() return (latitude, longitude) - def get_polyline_from_here_maps( source_latitude, source_longitude, destination_latitude, destination_longitude ): @@ -57,10 +55,7 @@ def get_polyline_from_here_maps( ) # we converted that to encoded(google) polyline return polyline_from_heremaps - """Calling Tollguru API""" - - def get_rates_from_tollguru(polyline): # Tollguru resquest parameters headers = {"Content-type": "application/json", "x-api-key": TOLLGURU_API_KEY} @@ -83,7 +78,6 @@ def get_rates_from_tollguru(polyline): else: raise Exception(response_tollguru["message"]) - """Testing""" # Importing Functions from csv import reader, writer diff --git a/ruby/main.rb b/ruby/main.rb index b1ed350..d9242a7 100644 --- a/ruby/main.rb +++ b/ruby/main.rb @@ -12,6 +12,7 @@ TOLLGURU_API_URL = "https://apis.tollguru.com/toll/v2" POLYLINE_ENDPOINT = "complete-polyline-from-mapping-service" +# From and To locations source = 'Philadelphia, PA' destination = 'New York, NY' @@ -36,7 +37,6 @@ def get_coord_hash(loc) destination = get_coord_hash(destination) # GET Request to HERE Maps for Polyline - HERE_URL = "#{HERE_API_URL}?transportMode=car&origin=#{source["lat"]},#{source["lng"]}&destination=#{destination["lat"]},#{destination["lng"]}&apiKey=#{HERE_API_KEY}&return=polyline" RESPONSE = HTTParty.get(HERE_URL).body json_parsed = JSON.parse(RESPONSE)