--
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.
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.
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.
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 ]
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)
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.
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.
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.