android icon indicating copy to clipboard operation
android copied to clipboard

Added an address field to the returned location packet.

Open wir3z opened this issue 1 month ago • 20 comments

Contains the geocoded address, if available, or the lat/lon if not.

wir3z avatar Nov 04 '25 01:11 wir3z

I realize that there are situations where the phone geocode will not resolve the address, but this reduces the expense of having to do that same work server side now that Google has reduced the free geocode tokens per month..

wir3z avatar Nov 04 '25 01:11 wir3z

I think this approach was discussed and rejected a while ago: owntracks/iOS#769

ckrey avatar Nov 04 '25 07:11 ckrey

How rate limited is iOS? Android will also rate limit, but you need to be sending a lot of geocodes in succession.

Issue I'm trying to address is Google has reduced their free credit tier for geocodes. If you have 4-users on OwnTracks, and I configured the recorder to use Google as a geocode service, I'd end up with a $100 Google bill every month for this. Others have seen much worse depending on update frequency.

I was coupling this into a different server side app, using the phone addresses when available (which is most of the time) and then back filling with server side geocode to address the over charge issue.

wir3z avatar Nov 04 '25 13:11 wir3z

The recorder cashes Geo look ups so if those four users are frequently together, and the geohash width isn't too high then caching should reduce the look up frequency.

As an aside: have you compared limits to those in Opencage's free tier?

jpmens avatar Nov 04 '25 14:11 jpmens

What I was seeing is all users are semi-independent, which was resulting in a bill from Google for exceeding the free credits on geocoding.

Opencage changed their tiers when Google restricted theirs. Opencage gives 2500/day, but it you are caught using it more than short term testing, you will be get blocked.

wir3z avatar Nov 05 '25 02:11 wir3z

~~I seem to remember there's a ToS constraints on both the Google and opencage geocoders that their returned results are for display only and not transmission/storage.

Might be hallucinations, will have a look tomorrow~~.

Edit I'm wrong about opencage.

I'm not against this in principle, but I think it should be a user preference (default off).

(On my phone, not done a review yet, so you may have already added this in).

We'd also presumably need a tweak to the recorder to detect the incoming address on the wire and add that to the db, rather than doing a lookup on the recorder side @jpmens ?

growse avatar Nov 05 '25 22:11 growse

Let me know if it is something you'd accept, and I can rework with a user preference.

wir3z avatar Nov 05 '25 23:11 wir3z

OpenCage explicitly permits storage.

jpmens avatar Nov 06 '25 08:11 jpmens

Our primary data source is OpenStreetMap, which means you can store data as long as you like, display it on any map, use it publicly or privately, for any usecase, on the web, in print, or behind a firewall.

https://opencagedata.com/guides/how-to-compare-and-test-geocoding-services

jpmens avatar Nov 06 '25 08:11 jpmens

~~I seem to remember there's a ToS constraints on both the Google and opencage geocoders that their returned results are for display only and not transmission/storage.

Might be hallucinations, will have a look tomorrow~~.

Edit I'm wrong about opencage.

I'm not against this in principle, but I think it should be a user preference (default off).

(On my phone, not done a review yet, so you may have already added this in).

We'd also presumably need a tweak to the recorder to detect the incoming address on the wire and add that to the db, rather than doing a lookup on the recorder side @jpmens ?

Are you thinking a new slider in the "Preferences -> Reporting" section, similar to "Extended Data"? Or just couple this with the "Extended Data"?

wir3z avatar Nov 17 '25 15:11 wir3z

(TIL github notifications don't trigger when added during an edit.)

tweak to the recorder to detect the incoming address on the wire and add that to the db,

doable if we know which JSON element to detect on

jpmens avatar Nov 17 '25 15:11 jpmens

~~I seem to remember there's a ToS constraints on both the Google and opencage geocoders that their returned results are for display only and not transmission/storage.

Might be hallucinations, will have a look tomorrow~~.

Edit I'm wrong about opencage.

I'm not against this in principle, but I think it should be a user preference (default off).

(On my phone, not done a review yet, so you may have already added this in).

We'd also presumably need a tweak to the recorder to detect the incoming address on the wire and add that to the db, rather than doing a lookup on the recorder side @jpmens ?

Are you thinking a new slider in the "Preferences -> Reporting" section, similar to "Extended Data"? Or just couple this with the "Extended Data"?

This feels "extended data" to me. I think we put stuff in there that's platform-specific, and we're not (I think) going to be doing this on iOS any time soon?

Good place to start and see how it fits.

growse avatar Nov 17 '25 23:11 growse

The recorder includes address data from its geohash database as follows including country, locality, tzname and local time.

      ...
      "ghash": "9q9hrj4",
      "cc": "US",
      "addr": "West Homestead Rd, Cupertino, CA 94087, USA",
      "locality": "Cupertino",
      "tzname": "America/Los_Angeles",
      "isolocal": "2025-04-01T01:27:28-0700"
      ...

When sending any of these value to the recorder, we may want to use different key e.g. add a prefix:

        "client_cc":
        "client_addr":
        "client_locality":
        "client_tzname":
        "client_isolocal":

We will have to decide whether recorder will update its Geohash database from the client provided data and how to deal with situations where database address and client provided address data are both available

ckrey avatar Nov 18 '25 08:11 ckrey

~~I seem to remember there's a ToS constraints on both the Google and opencage geocoders that their returned results are for display only and not transmission/storage. Might be hallucinations, will have a look tomorrow~~. Edit I'm wrong about opencage. I'm not against this in principle, but I think it should be a user preference (default off). (On my phone, not done a review yet, so you may have already added this in). We'd also presumably need a tweak to the recorder to detect the incoming address on the wire and add that to the db, rather than doing a lookup on the recorder side @jpmens ?

Are you thinking a new slider in the "Preferences -> Reporting" section, similar to "Extended Data"? Or just couple this with the "Extended Data"?

This feels "extended data" to me. I think we put stuff in there that's platform-specific, and we're not (I think) going to be doing this on iOS any time soon?

Good place to start and see how it fits.

I pushed a patch moving it to the extended data field.

wir3z avatar Nov 18 '25 14:11 wir3z

Another question, is there a way to trigger the jobs on the patch push? It seems the last didn't trigger anything.

wir3z avatar Nov 18 '25 14:11 wir3z

/run-tests

growse avatar Dec 03 '25 22:12 growse

Build & Test complete. :sparkles: View workflow run

github-actions[bot] avatar Dec 03 '25 22:12 github-actions[bot]

/run-tests

wir3z avatar Dec 04 '25 23:12 wir3z

/run-tests

wir3z avatar Dec 06 '25 02:12 wir3z

/run-tests

The above doesn't seem to work for me. Github isn't picking up the action?

wir3z avatar Dec 10 '25 13:12 wir3z