Get data(street name) from geocoder google api

Hello, how to get street name from location on crossxplatform? I use google geocode api,

My blocks:

Thankyou

1 Like

Hello,

your code should be something like this (see the blocks attached to Label1.Text).

Do you understand how to adapt it to your case?

1 Like

Hi Thankyou!! I Try it but dont work!, mobile screen on white.

1 Like

A white screen because you are trying to get a non-existent object. Error in the JSON path. If you give me a link to your project, then I will show the correct blocks.

1 Like

Ok I send link. Thanks!

1 Like

Good.

1 Like

Reply wrote to you in a message.

Solucion:


Muchas gracias actech!

2 Likes

Hi! I’m having a problem similar to David’s above. I tried to replicate the blocks but I’ve still got a white screen in CrossPlatform. I have a JSON file in a realtime db on Firebase. I’m trying to retrieve the value of -facilityName.

Here is my file:

Here are my blocks:

Thanks,
Teri

1 Like

Hi Teri,

You did the right thing, using the shown example. But you need to not just copy the blocks, but to indicate the correct field names that differ from the example of David. If you want me to do blocks for you, then give me a link to your project. If you want to learn how to solve such problems, I can explain it.

Alex

1 Like

Thanks! I’d appreciate understanding the problem so please explain.

1 Like

The problem of obtaining the value of a field in a JSON format is finding the right path. If you specify an incorrect path, there will be a white screen. This is similar to how you search for a file in folders:

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

Look at your data in JSON format. They consist of nested into each other of objects that are between the symbols { and }. { … } is one whole object. And some of the objects are between the symbols [ and ], for example:

[
{},
{},
{}
]

This is a list of objects, which is 3 object.

Inside the object, you see a pair “key”:”value”. To get the value you need to specify the key. The key is what is left of the symbol “:”.

What key corresponds to the desired value ADELAIDE CAMPGROUND? Key –facilityName. We write it

–facilityName

See above and do you see a bracket [. This means our object with key –facilityName is in the list of objects. What number? Numbering items in a list starts from 1. So our target is number 1. We write it:

–facilityName → 1

And the list is on what key? result! We write it:

–facilityName → 1 → result

As an object with a key result is what object? resultset! We write it:

–facilityName → 1 → result → resultset

resultset is on what key? Any which is the root key, and above it nothing. So the path to the desired value like this:

–facilityName → 1 → result → resultset

Now it needs to be turned into blocks. Get this:

Label1.Text < –facilityName < 1 < result < resultset < get object from JSON < value

You understand how to construct the path? You can not skip steps in the path, but you can look at the values ​​after each step to check if you are going to the correct object or not.

Imagine that you need to give the letter to a person with the name ADELAIDE CAMPGROUND. What room is she in? You enter the building “resultset”, then come to the elevator with title “result”, press the first floor, go down the hall and knock on the door “–facilityName”.

2 Likes

Thanks, Alex. That makes complete sense to me. I had all of those blocks in place except the resultset one. I thought I might not need that one because I was using resultset as my key in the get call to the database. However, even plugging that resultset block in I’m still getting a white screen. Is it perhaps a problem with that call to the database? I’ll send you a link to my project.

Hm, actually I don’t see how to send you a link. It says I can’t send that user (you) a private message.

1 Like

1 Like

Thank you so much, actech!

Here are the two possible solutions that he gave me:

Further on in this project, I’m having trouble looping through my JSON and populating a list with the values. Here’s a snippet of my JSON:

For instance, these blocks will retrieve the facilityName Antelope Valley RV Park and display it:

However, when I try to loop through the entire JSON and return back all the appropriate facilityNames, I get nothing:

I’d appreciate any advice you can give me!
Teri

1 Like

This problem is well described and solved by Mark. You need to adapt the solution shown for your case.

If you don’t want to deal with asynchronous blocks, you can use this solution:

  1. Keep all the required amount of data in the list
  2. Create a loop on the list to perform the desired action.
1 Like

Thanks. I found a solution before I saw your reply. It seems like it was the nested calls to the database that was causing the problem. Once I figured out how to get ALL the information that I wanted in one call, the loop worked fine.

1 Like

estou tendo a mesma dificuldade… preciso so da distancia


mais nao to conseguindo… meus blocos abaixo

se puderem me ajudar… a explicaçao do actech eu entedi mais o meu nao acontece nada…

1 Like