258
Views
15
Comments
Solved
REST URL Parameter
Question

I am trying to use the distance matrix by using the following:

https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins={x},{y}&destinations={xd},{yd}

Where x,y are latitude and longitude.

When i test it it works fine as seen in the picture

But when i use this in my app it says "not found"

Can any one help me?

2023-12-07 07-51-40
Remco Dekkinga
 
MVP
Solution

Hi Mario,

I found a solution.

Use the following url: https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins={origins}&&destinations={destinations} and make sure the origins and destinations are strings.

The x and y coordinates should be seen as one string and somehow when adding a separate x and y coordinate to build the string in the URL is breaking the functionality.

Let me know if this is the solution for you.

Kind regards,

Remco Dekkinga

UserImage.jpg
Mário Amorim

Remco Dekkinga wrote:

Hi Mario,

I found a solution.

Use the following url: https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins={origins}&&destinations={destinations} and make sure the origins and destinations are strings.

The x and y coordinates should be seen as one string and somehow when adding a separate x and y coordinate to build the string in the URL is breaking the functionality.

Let me know if this is the solution for you.

Kind regards,

Remco Dekkinga

For the 40,4 and 4,40 it works, but whn i try with my location it gives the same error.

I am passing to the origins input like this 

SyntaxEditor Code Snippet

"GetLocation.Location.Latitude,GetLocation.Location.Longitude"



2023-12-07 07-51-40
Remco Dekkinga
 
MVP

Hi Mario,

I've tried your REST api (including your key... Try to remove/hide the key to avoid other people from using your private key.) and I just got a successful response status. What are the input values that you tried when calling the REST in your application?

Kind regards,

Remco Dekkinga

UserImage.jpg
Mário Amorim

Hi,thanks for your reply.


I tried this input values:

2023-12-07 07-51-40
Remco Dekkinga
 
MVP

Hi Mario,

I used the exact same inputs, because you tried them on the initial image too. My flow looks like this.

In the Var1 assignment I assign the Status of the response to a text variable and show this on my screen. It returns "Ok".

Can you share the OML where the error happens?

Kind regards,

Remco Dekkinga

UserImage.jpg
Mário Amorim

I also get an ok status there but on the rows elements status i get not found and no distance or duration time.

UserImage.jpg
Mário Amorim

Do you get a distance or duration time? What is the status of your rows elements?

Thanks for your help

2023-12-07 07-51-40
Remco Dekkinga
 
MVP

You are correct. It gives a "NOT_FOUND" in the list of distances... Very strange indeed.

UserImage.jpg
Mário Amorim

Remco Dekkinga wrote:

You are correct. It gives a "NOT_FOUND" in the list of distances... Very strange indeed.

Yes it is, i am strugling with this problem for the last three days and tryed everything and cant find the problem


UserImage.jpg
Mário Amorim

if i use directly https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins=4,40&destinations=4,40 it works but when i try with input parameters it just doesnt work

UserImage.jpg
Mário Amorim

Dont know what to try more. i need them has input variables so i dont want to put them directly on the url

2023-12-07 07-51-40
Remco Dekkinga
 
MVP
Solution

Hi Mario,

I found a solution.

Use the following url: https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins={origins}&&destinations={destinations} and make sure the origins and destinations are strings.

The x and y coordinates should be seen as one string and somehow when adding a separate x and y coordinate to build the string in the URL is breaking the functionality.

Let me know if this is the solution for you.

Kind regards,

Remco Dekkinga

UserImage.jpg
Mário Amorim

Remco Dekkinga wrote:

Hi Mario,

I found a solution.

Use the following url: https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins={origins}&&destinations={destinations} and make sure the origins and destinations are strings.

The x and y coordinates should be seen as one string and somehow when adding a separate x and y coordinate to build the string in the URL is breaking the functionality.

Let me know if this is the solution for you.

Kind regards,

Remco Dekkinga

For the 40,4 and 4,40 it works, but whn i try with my location it gives the same error.

I am passing to the origins input like this 

SyntaxEditor Code Snippet

"GetLocation.Location.Latitude,GetLocation.Location.Longitude"



2023-12-07 07-51-40
Remco Dekkinga
 
MVP

I've tried it with the following locations:

origins=55.93,-3.118

destinations=50.087,14.421

Somewhere in the UK and in the Czech Republic.

Can you share the locations that are failing?

Kind regards,

Remco Dekkinga

UserImage.jpg
Mário Amorim

Remco Dekkinga wrote:

I've tried it with the following locations:

origins=55.93,-3.118

destinations=50.087,14.421

Somewhere in the UK and in the Czech Republic.

Can you share the locations that are failing?

Kind regards,

Remco Dekkinga

When i put numbers as you did

origins=55.93,-3.118

destinations=50.087,14.421

it works, but if i try

origins="GetLocation.Location.Latitude,GetLocation.Location.Longitude"

destinations=50.087,14.421

it gives not found


2023-12-07 07-51-40
Remco Dekkinga
 
MVP

Hi Mario,

I'm not sure what you are trying to use for the origins, but the origins should be a geolocation in the form of "x,y".

In your case, when you have an action called GetLocation, which returns the Location(Latitude, Longitude) build the origins variable in the following way:

Origins = GetLocation.Location.Latitude + "," + GetLocation.Location.Longitude

If this doesn't work, please share your flow. I can check it with you.

Kind regards,

Remco Dekkinga

UserImage.jpg
Mário Amorim

Thanks a lot

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.