Help getting GeoLocation Address into variable?

smithbill

New member
I'd like to be able to use an HTTP GET to a website which returns the 'street address' of my current GPS location.

There are websites such as these two:

that allow you to press a button & obtain the 'street address' for your current location, but I don't know how to use these (or similar service) in an HTTP GET to obtain the address - can anyone advise?

If I use these websites & return the results to a global variable, the variable contains a whole bunch of JavaScript which I'm assuming is the entire HTML page code?

I know GoogleMaps has an API, but I think you need an API_KEY to use it & that's becoming overly complex for my purposes.

Is there a simple way to use a webservice to return my current street address?
 

smithbill

New member
Okay, I've found this website:


which lets me pass a Lat & Long and providing I sign up & create myself an API_KEY and a project, then it will return a data structure which includes my 'street' name.

So when I call this from MacroDroid with my last known Lat/Lon and stuff the results into a global text variable, I get a big long string with loads of location address & other details. I think it's in JSON format (?)

How can I parse & extract just the street name from this long string in JSON format?
 

smithbill

New member
Hi, thanks for the 'JSON Parse' clue - I should've looked harder 😁

However, I've now tried TextManipulation with RegEx

"street":"(.+)","suburb"

to extract the street name I'm after.
 

smithbill

New member
Try to look at this, it might help you a bit
Oh, now that would've been very useful - thank you for finding it.

It's got quite a lot of extra stuff in the macro I don't need, but the crucial bit of using the geocode website would've saved me having to sign up for a free account on geoapify.

UPDATE: I tried modifying my macro to use the geocode.farm website used in the example macro, but it seems a little unreliable and returns a failure structure every few requests. So I've stuck to using the geoapify website.
 
Last edited:

smithbill

New member
You can try using my action block. It uses openstreet map nominatim api and should be reliable in most cases.

FrameXX, you young sir, are a very clever lad - that ActionBlock of yours is just what I was after and would've saved me several days of Googling & head scratching.

I've never used a custom ActionBlock before, so that's new to me too. Life's an adventure 😁
 

smithbill

New member
Can I ask a related question with regard to my streetname macro:

I'm now trying to use a MacroDroid HTTP GET to call the VoiceMonkey service passing it my established streetname as a string to be used as an Alexa announcement on my EchoDot at home (so basically the EchoDot at home says whatever street I'm walking along when the macro runs).

However, when I execute the macro action (an HTTP GET) in this format:

https://api.voicemonkey.io/trigger?access_token=<MY_ACCESS_TOKEN>&secret_token=<MY_SECRET_TOKEN>&monkey=report-street&announcement={lv=streetname}

then my EchoDot kind of 'stutters' on the announcement text as if she starts speaking, gets cut-off and then starts the announcement again.

If I execute the same VoiceMonkey command by just pasting it into Chrome, my EchoDot says it flawlessly.

I've tried MacroDroid HTTP PUT but that does nothing. Only HTTP GET works but causes this 'stutter' effect from my EchoDot.

Any ideas how to correctly call the VoiceMonkey service from MacroDroid without causing the EchoDot to 'stutter' ?

UPDATE: I've sorted it - it seems to be something to do with the MacroDroid HTTP GET action being the last command in the macro. So I've just moved it further up the macro & now my EchoDot doesn't seem to 'stutter'
 
Last edited:

FrameXX

Well-known member
Can I ask a related question with regard to my streetname macro:

I'm now trying to use a MacroDroid HTTP GET to call the VoiceMonkey service passing it my established streetname as a string to be used as an Alexa announcement on my EchoDot at home (so basically the EchoDot at home says whatever street I'm walking along when the macro runs).

However, when I execute the macro action (an HTTP GET) in this format:

https://api.voicemonkey.io/trigger?access_token=<MY_ACCESS_TOKEN>&secret_token=<MY_SECRET_TOKEN>&monkey=report-street&announcement={lv=streetname}

then my EchoDot kind of 'stutters' on the announcement text as if she starts speaking, gets cut-off and then starts the announcement again.

If I execute the same VoiceMonkey command by just pasting it into Chrome, my EchoDot says it flawlessly.

I've tried MacroDroid HTTP PUT but that does nothing. Only HTTP GET works but causes this 'stutter' effect from my EchoDot.

Any ideas how to correctly call the VoiceMonkey service from MacroDroid without causing the EchoDot to 'stutter' ?

UPDATE: I've sorted it - it seems to be something to do with the MacroDroid HTTP GET action being the last command in the macro. So I've just moved it further up the macro & now my EchoDot doesn't seem to 'stutter'

The only thing that comes to mind is that you really had placed the HTTP GET action in the wrong position in macro and it got repeated several times => URL was fetched several times => sound stuttered.
 
Top