Not
February 23, 2023, 9:09am
1
So I'm trying to create an app to calculate the distance (km) between two points and in order to calculate the inputed location, I use Geocode to get the coordinates and then apply the haversine formula. the problem here is the result which is a json file that can't seem to collect the key or value somehow.. I don't understand the problem.
this is correct right?
this is my url I tried opening it and it should work... soI don't get why the dictionary can't get the latitude and longtitude...
TIMAI2
February 23, 2023, 10:14am
2
show the raw content of your responseContent
Many developers often get stuck when trying to handle the response content from an online server after making a GET request using the web component. Those trying to help often ask to see the raw responseContent being returned. When using companion this can be copied and pasted to the community for those trying to help to use with debugging. This is how you might return that information / data to a label.
BLOCKS
[image]
DATA
Do It Result:
""Name","Date of Birth","Age"
"Adah","06/04/1999","2…
Not
February 23, 2023, 10:55am
3
sure here it is:
{
"results" : [
{
"address_components" : [
{
"long_name" : "Bryan",
"short_name" : "Bryan",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Brazos County",
"short_name" : "Brazos County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Texas",
"short_name" : "TX",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Bryan, TX, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 30.730455,
"lng" : -96.245722
},
"southwest" : {
"lat" : 30.590893,
"lng" : -96.46075900000001
}
},
"location" : {
"lat" : 30.6743643,
"lng" : -96.3699632
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 30.730455,
"lng" : -96.245722
},
"southwest" : {
"lat" : 30.590893,
"lng" : -96.46075900000001
}
}
},
"place_id" : "ChIJmVMC17yBRoYRcUziFqi05ZU",
"types" : [ "locality", "political" ]
}
],
"status" : "OK"
}
this is an example
TIMAI2
February 23, 2023, 12:11pm
4
Which lat/lon did you want to return, there are five sets ?
TIMAI2
February 23, 2023, 12:35pm
5
Try with this:
In AI2, list indexes start at 1, not 0.
Not
February 23, 2023, 12:41pm
7
the lat/lon is the one from the "location" key
Not
February 23, 2023, 12:42pm
8
it still says invalid URL
TIMAI2
February 23, 2023, 12:43pm
9
but you just provided the responseContent? (or was that from running a GET in your browser?)
Not
February 23, 2023, 12:48pm
10
I'm sorry what do you mean?
Not
February 23, 2023, 12:53pm
11
oh uh the response content was yes a GET from my browser from the API link:
the API key is already correct I checked
TIMAI2
February 23, 2023, 12:55pm
12
You may need to uriEncode the content in Textbox1.Text. There is a block for this in the web component. Make sure you use the uriEncode (and not the uriDecode ) block.
I don't have a geocode project setup, so can't really test further, and just keep guessing, unless you share the API key (you can do this via private message)
Not
February 23, 2023, 12:58pm
13
how do I send a private message?
Not
February 23, 2023, 1:03pm
14
also do you mean like this?
Not
February 23, 2023, 1:10pm
15
WAIT NO WAY NO WAY NO WAY TYSM SO TURNS OUT MY PROBELM WAS (tysm you helped me find it)
was this- it's supposed to be Web2
Taifun
February 23, 2023, 1:22pm
16
To set an url in web1 and then call web2.get can't be a correct solution....
Why are there 2 web components?
Taifun
Not
February 23, 2023, 2:24pm
17
eh- I mean like the set Web1 should've been Web2 ( i need two because I'm calculating two locations