Android Question Accessing What3words with B4A in Offline Mode to Send an SOS message when Off-Grid

ashchopra

Member
Licensed User
Longtime User
Please correct me; as I understand the What3words API needs to be used with internet access. Am I correct? Is there any way for a B4A program to access the API 'offline', i.e to generate the three words from Lat/Long using the API? If yes, how may this be done? Any code snippet will help me get to grips with this. (The Plan for implementation is an emergency tracking/transmission system which at pre-set regular intervals transmits your position in three words on a radio using VOX). (As opposed to transmitting a long Lat/Long position, which needs to be noted down. 3 words can be remembered when heard and recalled more easily. (VOX is a voice-activated transmission, the Radio listens on its mic for input directly and it does not need the PTT to be pressed)

The workflow I envisage would be like this, (the use case is that you need to transmit your location blindly on your radio when you are off the grid /offline and need help):

1. Get Lat/Long from Phone Gps using B4A Gps Library
2. Access What3Words (in offline mode, assuming you are off the grid) (How?, what API / interface to use, any code snippet to understand this) (REST API etc works online, as I understand)
3. Use the Text to Speech Library to speak out the three words out through the phone speaker, whose output goes to the radio (which is in VOX mode and hence transmits the three words)
4. Someone who receives the message hears something like this : " This is XYX, I am injured and need help, my location is "ABCD.KLMN.WXYZ". Request Assistance. The transmission string can be from a set of prepared strings and the location what3words generated as mentioned above.

Any ideas on how this may be achieved in B4A

Thanks in Advance.
 

agraham

Expert
Licensed User
Longtime User
Have you explored the Developer section of the What3words web site? They appear to have an Enterprise Suite that provides an offline SDk for Android but it will cost you. You won't get offline functionality elsewhere as What3words algorithms are proprietary.

As well as their own free What3words app there are several other apps that can give you the three words from a GNSS location when you are offline - I assume they have licensed the offline SDK. However they are probably of no use for your project.

 
Upvote 0

ashchopra

Member
Licensed User
Longtime User
Thanks for your inputs, unfortunately I cannot get the enterprise SDK. This is a non-commercial project (and no resources for funding) to help resolve an issue of sending an SOS when off gird , in countries, where satellite communication equipment like Garmin Inreach etc are banned. I am now searching for alternative algorithms like https://wherewords.id/ , https://wcodes.org/ etc. But converting JS etc for me is a tough task. There is another possibility, and that is to restrict usage (i.e when using the Free API key, 1000 request limit), in which case any help on how to use there 'Android Wrapper' will help. I am a old Visual Basic Programmer and with little knowledge on how to use such a wrapper.
 
Upvote 0

ashchopra

Member
Licensed User
Longtime User
India, for one. Satellite communication devices are banned for the public. Fears of misuse by terrorists etc. 'Technically' the Govt permits usage if you can get an NOC and License for use of INMARSAT by the state telecom services, but that really does not work for individuals etc. Thuraya and Iridium devices are specifically banned. So genuine users like mountaineers, paragliding pilots etc who are off-grid most of the time are without any way of communicating a SOS situation. So I was hoping to build something to address this issue (As described above)
 
Upvote 0

ashchopra

Member
Licensed User
Longtime User
GPS devices are permitted, i.e Standalone GPS devices, GPS Navigation Devices etc including those in Android/IPhones etc are permitted . Satellite communication devices like Satellite Phones / Satellite Messengers etc are banned. (read as two way comms) So, you can know your position from the GPS, but cannot tell anyone of it by transmitting it via a satellite phone/messenger. So as a solution, I hope to make a small app to convert the Lat/Long from the phones GPS to a easy to understand short 3 word sequence which can be transmitted via a radio (either blindly at pre-set intervals or get initiated) with the hope that some other person on the same channel (Team or Rescuers etc) can locate you.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Aha. So in this chain, step three would not be allowed to do, is that correct?

1. A paragliding pilot is injured and needs help
2. Pilot calls help using their satellite phone
3. Pilot tells help their GPS position from their smartphone


And you want to have this step three instead:

3. Pilot tells help their position via something that is not GPS coordinates
 
Upvote 0

ashchopra

Member
Licensed User
Longtime User
I have stumbled upon something that is good enough I guess, but its mix of HTML/CSS and JS. The HTML/CSS gets the lat/long from an OpenStreetMap. The JS does the coding to the words. The code is available on Github.

Please see its implementation : -> https://pballett.github.io/whatfreewords/

The Source code of the file index.html on the page :-> https://github.com/pballett/whatfreewords is what runs.

The JS code running on the page could do the task, but I donot know how to convert the JS code to a VB module / library. Anyway of doing that with some convertor?? Or does it has to be done manually??
 
Upvote 0

ashchopra

Member
Licensed User
Longtime User
Aha. So in this chain, step three would not be allowed to do, is that correct?

1. A paragliding pilot is injured and needs help
2. Pilot calls help using their satellite phone
3. Pilot tells help their GPS position from their smartphone


And you want to have this step three instead:

3. Pilot tells help their position via something that is not GPS coordinates
Yes kind of.

In this case:
1. Paragliding Pilot is injured.
2. His Phone is connected to the Radio.
3. He initiates a SOS using the app. The App generates a 3 Word address of his location, which is called out on the Radio.

The need for the words, as opposed to the calling out of a series of numbers representing the Latitude / Longitude, is to aid the potential rescue party remember it easily rather have have to write it down etc, which may not be practical (Incase the recuse party is also flying etc or has not paper/pen etc
 
Upvote 0

ashchopra

Member
Licensed User
Longtime User
Lol the more I look, the less I like. It looks like the word lists are trade secrets. But I did rather like the look of:

https://googlemapsmania.blogspot.com/2016/07/what-3-fcks.html

which is offline but still partially-available at archive.org; apparently I grew up in the area of trash.gangbang.f*ckhead 不不不
Word List are available, I found some. Some interestingly / intelligently collect words to remove ambiguity and improve clarity etc. one example as a.tsv file. attached.
 

Attachments

  • wordlist.txt
    13.9 KB · Views: 59
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Yes kind of.
Thanks for clarification.

You might also want to take a look at this page, which contains 40 alternatives to what3words:

It's possible to filter to get open source solutions only, such as this one for instance:

...which would give the four words "crevice navy snooper taco" for a randomly picked place in India:
collie perennial sectional unsteady
 
Upvote 0

ashchopra

Member
Licensed User
Longtime User
Thanks Sandman, Looks Like I have a fighting chance with FixPhrase. Its 4 words and not 3, but, the coding is easy to understand and I should be able to do something with it.

Thanks Again. Time to refresh my coding skills !!
 
Upvote 0

emexes

Expert
Licensed User
Word List are available, I found some. Some interestingly / intelligently collect words to remove ambiguity and improve clarity etc. one example as a.tsv file. attached.

We're needing the What3Words curated list of 40000 words.

For the purpose of this thread, common words lists like SOWPODS and ENABLE are close, but no cigar.
 
Upvote 0

emexes

Expert
Licensed User
We're needing the What3Words curated list of 40000 words.

Woops... no, I might let go of this challenge for the time being, given this at https://wiki.openstreetmap.org/wiki/What3words#A_closed_system :

A closed system​

what3words is not an open system for location reference/addressing. This is legally and technically enforced in several ways:

  • The algorithm is patented in several countries, preventing anyone from implementing a compatible algorithm or developing anything like it as a competing standard. Notably the patent is not restricted to schemes which use three words, so a hypothetical "what4words" would potentially also violate the patent.
  • Hand-in-hand with this patent, the wordlist necessary for encoding/decoding what3words locations is copyrighted, and is stored in an encrypted form in the what3words mobile apps (so decrypting the wordlist would likely trigger "anti-circumvention" laws such as DMCA 禮1201).

I'm not even going to admit that I might have already have gotten xx% of the way there. :rolleyes:
 
Upvote 0
Top