Page 1 of 3

Picking a map location within a flow

Posted: 10 Jun 2014 14:30
by skiptannen
I'm trying to figure out how to write a flow that allows me to choose a destination from a map and use that location to fire an alarm when arriving at or leaving the location. I know that I can go into the Location trigger and select a location by tapping on the Pick Location button, but I want to do this as part of a flow. Is that possible or do I need to open Automagic and pick the location before running the flow? I've looked at the Location trigger, the Init Variable Location action, and the various location conditions so far I haven't been able to bring up the map from within a running flow. I'm hoping I'm missing something simple and I just haven't figured it out yet.

Thanks in advance.

Re: Picking a map location within a flow

Posted: 10 Jun 2014 16:59
by Martin
Hi,

There's currently no easy solution to do this. I have it on the todo-list to add an option to select a location in an action Input Dialog at some point. It would also require a new feature to use variables in the location trigger which is also a feature on my todo-list.
I think that the plugin AutoLocation supports a way to add goefences dynamically (but I might be wrong).

Regards,
Martin

Re: Picking a map location within a flow

Posted: 10 Jun 2014 19:03
by skiptannen
Thank you Martin - I've never played around with Tasker plugins, and I may take a look at that, but having location as an input dialog type would be a great option to have. I would think that it would open up a bunch of possibilities.

Thanks again.


skip

Re: Picking a map location within a flow

Posted: 24 Jun 2014 08:24
by manuel
+1

Re: Picking a map location within a flow

Posted: 15 Jul 2014 08:42
by BoBo
[Brainfart]

What about to ...
a) set a pin at a Google map (manually)
b) extract the data from that map (flow)*
c) take the pin coordinates from that data (flow)
d) write a flow which contains that extracted pin coordinates (flow)
e) execute that created flow
*
Simply click the link shortcut on the map to retreive a URL for the map with pins in.
Next add &output=kml to the end of this url and use the link to retrieve a kml file containing all the pin data.

This kml file is actually in xml format so parsing it should be easy, you just need to look for <coordinates> elements which contain the latitude and longitude data you need. The kml format is documented here: http://code.google.com/apis/kml/documen ... rence.html


Source (click)
[/Brainfart]

8-)

Re: Picking a map location within a flow

Posted: 16 Jul 2014 13:48
by skiptannen
Thanks BoBo - this looks like a good idea. I am also thinking of playing with an app named Map Coordinates (https://play.google.com/store/apps/deta ... es.android) - you find your location on the map and then pick the menu option to copy the coordinates to the clipboard.

Re: Picking a map location within a flow

Posted: 16 Jul 2014 18:55
by BoBo
Promising app. So you can create a flow which is checking the clipboard for a valid content (the coordinates) and use those values directly within the flow. Makes sense.

Re: Picking a map location within a flow

Posted: 16 Jul 2014 22:22
by skiptannen
Yup, that's exactly what I would like to do, but since my test flow is using the condition Location, I'm kind of stuck unless Martin is able to create the ability to add a location using an action Input Dialog (see his previous comment).

Re: Picking a map location within a flow

Posted: 17 Jul 2014 19:29
by Martin
You could also use the function distance in an action Script or a condition Expression to calculate the distance in meters between two locations and execute some actions when the distance is below a certain threshold. You can create location objects in a script with function newLocation so a very basic script could look like this:

-action Script:

Code: Select all

loc1 = newLocation(48.858097, 2.294467);
loc2 = newLocation(48.860327, 2.291206);
-condition Expression:

Code: Select all

distance(loc1, loc2)<1000
It's a bit of a hassle to remember the last inside/outside state in boolean variables so that you can detect enter/exit events but other than that it should work.

Sorry, I did not think about this possibility in my earlier post.

Re: Picking a map location within a flow

Posted: 18 Jul 2014 16:05
by skiptannen
No worries Martin - this works and has some interesting possibilities. I wasn't sure what you meant by remembering the inside/outside state in boolean variables, but what I'm playing around with now is having a global list that contains variables with location coordinates and comparing that to the current location with the expression distance(loc1, loc2)<1000. That seems to work. What I'm wondering is if I can use any other data elements from the location coordinates to test for entering/exiting. When I export the location value in the variable, I see "[Location[Script 42.188312,-71.581127 acc=??? t=?!? et=?!?]]". I figure acc= is accuracy and et= is speed, but what it t=? Time? And does it make sense to be going this route or is there a better way?

I wanted to attach the test flow I'm working with, but I'm getting the error "The upload was rejected because the uploaded file was identified as a possible attack vector". Not sure what that's about - I thought I could upload XML files...

Thanks.