Set location to Suburb, City, or Country if outside of predefined Zone(s)

Hey guys,

I’m using OwnTracks for GPS locations for my phone. For times when I’m outside a predefined Zone, I’d like to set the state to something like a Suburb, City, or Country depending on if I’m in my home city, home country or overseas.

Is there any way this is possible?

It might be possible. Have you tried creating a zone centralized on your city and making it a really large radius? There has to be a hierarchy of zones that it chooses if they over lap. I’m sure you could abuse that system to get what you want. The problem is that you’d have to figure out how the system works.

Hmmm I see what you’re saying but then I’d need to create a whole bunch of zones. What I’m trying to achieve is basically using the GPS coordinates that are returned from OwnTracks which will work anywhere without extra configuration.

I don’t think anything like that exists. Just doing a quick google search and it looks like you could use Google Geocoding API via the RESTful component. But be warned, if you ping too much, it could cost you money.

I found this info here:

I was using this with great success for quite a while.

I haven’t added billing yet so it’s down for me now (life’s gotten in the way) but other users report that it’s easy to stay under the free limit.

I use owntracks and several zones, some that overlap. When I am in home-zone, it shows home. When I am outside of home-zone but still within the larger zone I established of my home town, it shows in town. When I am in a zone that does not overlap it shows that zone. When I am in none, it just shows away.
It appears to be rather boolean.

1 Like

This is perfect… exactly what I wanted. Implemented it in just 10 minutes.

1 Like

Yeah, that repo is using the Google Geocoding API I posted above. Be warned, it will cost money if it pings too much.

That’s true. You get $200 USD of credit each month equating to 40,000 API calls. You can also set a daily request limit (which I’ve set to 1000) to ensure I don’t go over.

1 Like