Get address from Lat/Long

304 views
Skip to first unread message

Matt L

unread,
Jul 31, 2019, 5:30:52 AM7/31/19
to Tasker
I have a site 
that converts GPS coords to addresses... question is, I am not well versed with JavaScript so I don't know how to harness it..

Help?

Manis

unread,
Jul 31, 2019, 6:05:47 AM7/31/19
to Tasker

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/b807e2ed-23d0-480a-96e0-84f541c2370c%40googlegroups.com.

Matt L

unread,
Aug 1, 2019, 5:09:36 AM8/1/19
to Tasker
Afraid I don't understand... Where would Tasker insert lat long and how difficult would http response be to parse out st# street, and optionally nearby stuff?

Simon

unread,
Aug 1, 2019, 5:18:51 AM8/1/19
to Tasker
You can try this task.

https://taskernet.com/shares/?user=AS35m8nRNm5oKC95b4yIIS3v8setw1hGNEwUB3ka%2F5gXfn85MvgrPXA9hBy9RfXpRMd1JOYDmSPKhg%3D%3D&id=Task%3AWhere+Are+You

It uses a java function to get the address of your current location.

You can modify the code so that it can convert any location based on latitude and longitude.

Not sure who deserves the credit for it as I found this code on reddit a while back.

Hope this helps.

Matt L

unread,
Aug 1, 2019, 6:37:16 PM8/1/19
to Tasker
THANKS! This saves me sooooo much work. Don't have to learn Google place search API..
may still, but thanks again
Message has been deleted

Steve L

unread,
Aug 3, 2019, 4:44:59 AM8/3/19
to Tasker
You can also try Tasker wiki (http://tasker.wikidot.com/profile-index). Under the intermediate section, check the location profile. It has some good tips in there as well.

John W.

unread,
Aug 7, 2019, 1:59:58 PM8/7/19
to Tasker
Robert Ryan and I also worked this out previously.

Are you looking to resolve address from arbitrary coordinates or to resolve an address from your current location?

If it is the latter, using Android's last known location is preferable and I have yet to see it return an old location. I can assure you, though, that our solution turned up an undocumented "passive" lookup option that auto-selects between gps and net.

John W.

unread,
Aug 7, 2019, 2:07:19 PM8/7/19
to Tasker
At it's most basic...

Addr (79)
A1: Array Set [ Variable Array:%gps Values:%LOC Splitter:, ]
A2: Java Function [ Return:geo Class Or Object:Geocoder Function:new
{Geocoder} (Context) Param:CONTEXT Param: Param: Param: Param: Param: Param: Continue Task After Error:On ]
A3: Java Function [ Return:%geo Class Or Object:geo Function:getFromLocation
{List} (double, double, int) Param:%gps(1) Param:%gps(2) Param:1 Param: Param: Param: Param: Continue Task After Error:On ]
A4: Variable Search Replace [ Variable:%geo(1) Search:(?ix) \".*?\" | (?<=\=)(?!(?:null|true|\-?\d+\.\d+)(?:\,|\]|$))[^\,\"]+(?=\,|\]|$) Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In Array:%geo(1) Replace Matches:Off Replace With: ] If [ %geo(1) Set ]
A5: Variable Set [ Name:%geo(12) To:%geo(16) Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:0 ] If [ %geo(12) ~R ^\d+[-\p{L}]*$ ]
A6: Popup [ Title: Text:%geo(11:) Background Image: Layout:Popup Timeout (Seconds):191 Show Over Keyguard:On ]

Marta Hintz

unread,
Aug 8, 2019, 7:18:22 PM8/8/19
to Tasker
wow! great share but difficult to copy with all that regex. Can you taskernet share this? tx!

John W.

unread,
Aug 8, 2019, 11:14:33 PM8/8/19
to Tasker
Sure Marta, and here is a steroid-enriched version to resolve gps, net, arbitrary coordinates, or last known location into address. Relevant notes are displayed in the final popup.

I just now assembled it in light of your enthusiasm so I can't speak to it's practicality but anyone should be able to prune as desired. Or a user can leave as-is and pass arguments. If no argument is passed, it will use android location manager to pull the last-known coordinates and resolve to an address. I owe Robert Ryan loads of credit for helping me come to grips with the java functions. (FTR, I'm fine with OOLs--some more than others--but I really loathe Java and .NET)

https://taskernet.com/shares/?user=AS35m8kLRtkLDw0LI68gF0krz8OuBSsVfbVEk%2BbhWM%2Bw%2BmSbNFfbK7UqGEjetgmwF2JPUwq7WevL0gI%3D&id=Task%3ABroad+Spectrum+Location+Resolver

Simon

unread,
Aug 9, 2019, 2:16:45 AM8/9/19
to Tasker
Hi Marta,

Try this https://taskernet.com/shares/?user=AS35m8nRNm5oKC95b4yIIS3v8setw1hGNEwUB3ka%2F5gXfn85MvgrPXA9hBy9RfXpRMd1JOYDmSPKhg%3D%3D&id=Task%3AWhere+Are+You

This task uses Java Function to convert lat,long to an address and doesn't require any regerx to retrieve the data.

Let me know what you think.

John W.

unread,
Aug 9, 2019, 9:58:37 AM8/9/19
to Tasker
That's a nifty JF! A7: Java Function [ Return:(Address) addrss Class Or Object:addresses Function:get {Object} (int) Param:0 Param: Param: Param: Param: Param: Param: ]

I'm going to tuck it under my hat for a future day. However, the task as written has a few flaws and inefficiencies. At least four lines are unnecessary. It did not seem that Marta was complaining of RegEx, only stating that the RegEx would be cumbersome to type and thus requested to import. Where my method differs is also the concise parsing and arraying of location data (addr, place, state, county city, street, zip code, country). So for example, knowing that you're at AMC Theater (place) might be more meaningful than 123 Hwy 45.

John W.

unread,
Aug 9, 2019, 10:40:30 AM8/9/19
to Tasker
If one chose the "Where Are You" found by Simon, this refined clone drops it from 9 lines to 5, but even then the first line can be deleted if the user passes the coordinates as par1 and par2. https://taskernet.com/shares/?user=AS35m8kLRtkLDw0LI68gF0krz8OuBSsVfbVEk%2BbhWM%2Bw%2BmSbNFfbK7UqGEjetgmwF2JPUwq7WevL0gI%3D&id=Task%3AWhere+Are+You+Clone

On the other hand, the "Where Are You" that Simon found can be steroid cloned to accept *either* passed coordinates *or* current location (and this current location pulls from Android rather than Tasker's LOCN var which can get really stale). This steroid clone is exactly the same number of lines as the original, but WAY more precise.
https://taskernet.com/shares/?user=AS35m8kLRtkLDw0LI68gF0krz8OuBSsVfbVEk%2BbhWM%2Bw%2BmSbNFfbK7UqGEjetgmwF2JPUwq7WevL0gI%3D&id=Task%3AWhere+Are+You+Steroid+Clone

And neither uses intensive RegEx.

Marta Hintz

unread,
Aug 9, 2019, 5:55:33 PM8/9/19
to Tasker
Gotta love those choices! Thanks guys and Tasker  :-)
Marta

Dale Smith

unread,
Aug 10, 2019, 4:33:54 AM8/10/19
to Tasker
On Steroids version doesn't run for me. Dies at the %par1= action.

John W.

unread,
Aug 10, 2019, 8:50:50 AM8/10/19
to Tasker
Possibly an android version issue? What version is your OS? Are all your location options enabled un Android settings? Finally, try changing A2 from "passive" to either "gps" or "network" (must include quotes). The only reason it would die at A3 is a failure to retrieve LKL in A2
Reply all
Reply to author
Forward
0 new messages