Any replacement plan for Mozilla location service?

you can try https://openrepos.net/content/neochapay/geoclue-providers-yandex

5 Likes

@coderus, I know I’m asking too much, but can you (or anyone else) make a step-by-step instruction on how to do that?

3 Likes

How much that speeds up the initial location?
And how reliable?

@filip.k: the best is to test yourself. I am not aware of anyone doing such tests so far. If you do, please report back.

2 Likes

I tried it - works perfectly. Here is a step by step guide:

9 Likes

Ahoy!

In fact Mozilla Location Service is not disabled. Mozilla requires a strong reason to request an API key to directly use their services. However, Mozilla Location Services data can still be used in “offline” mode and not by accessing directly the data and here how you can do it:

  1. Download the full cell data from https://location.services.mozilla.com/downloads
  2. Extract the CSV
  3. Use “mlsdbtool” from https://github.com/mer-hybris/geoclue-providers-mlsdb against the csv file.
    You can use it as:
    geoclue-mlsdb-tool -c <country> <CSV_Filename.csv>
    It will create 9 folders containing each of them a mlsdb.data file
  4. Upload the folders to /usr/share/geoclue-provider-mlsdb/
  5. Now you will have the location calculated based on the triangulation against the cell towers in your area while you have the data link off. You still need GSM connection so that the Cell ID could be acquired.

I haven’t tested yet the Yandex provider and I cannot tell you if Yandex data is more granular than the data Mozilla provides.

P.S. If you want to convert the “world data” for MLS, you could also alter the code of mlsdbtool and use the following limits in the code so that the whole data in the CSV will be converted:

BoundingBox world_bb;
world_bb.latShift = 0.0;
world_bb.lonShift = 0.0;
world_bb.lowerLeft.lat = -85.0;
world_bb.lowerLeft.lon = -180.0;
world_bb.upperRight.lat = 85.0;
world_bb.upperRight.lon = 180.0;
retn.insert(QLatin1String("World"), world_bb);

I hope it helps.

26 Likes

So if I read that, it would be not that much of a task to build up a “Sailfish Location Service” with the Mozilla Source (https://github.com/mozilla/ichnaea) and files (https://location.services.mozilla.com/downloads)?
So this could be done by Jolla or the community, couldn’t it?

Some possible Models:

  1. Jolla builds it up and it is “paid” by the Sailfish X license. (Probably Jolla has no time for that)
  2. Community builds it up and runs it by donations.
  3. Community builds it as a charged service to cover the server costs.

At least we would need a UI-Component to enter the individual API key and URI to use this service then.

5 Likes

It helped. Thank you. I got a fix after about a minute being offline with mlsdb location enabled in settings. I wanted to note that the geoclue-mlsdb-tool is included in the package, geoclue-provider-mlsdb-tool, so no need for the github step.

1 Like

In case geoclue-mlsdb-tool doesn’t contain your country, look up the MCC code of your country and edit function parseLineAndTest() in mlsdbtool/main.cpp like this

    if (cellId > 0 && mcc==555) { // CHANGE 1
        // build the cell location.
        result.uniqueCellId = MlsdbUniqueCellId(cellType, cellId, locationCode, mcc, mnc);
        result.loc.lat = QString::fromLatin1(fields[7]).toDouble();
        result.loc.lon = QString::fromLatin1(fields[6]).toDouble();
        result.withinBBox = true;  // CHANGE 2, line added
        return result; // CHANGE 3, line added

then run with any country specified.

2 Likes

Thanks for the links! I will try to get this deployed in the next days.

2 Likes

What is the correct command? I copied the .csv file in the directory /home/nemo and I tried as follow without success.

[nemo@Sailfish ~] geoclue-mlsdb-tool -c Italy MLS-full-cell-export-2021-01-09T000000.csv -bash: geoclue-mlsdb-tool: command not found [nemo@Sailfish ~] geoclue-mlsdb-tool -c Italy CSV_MLS-full-cell-export-2021-01-09T000000.csv
-bash: geoclue-mlsdb-tool: command not found

You must install geoclue-provider-mlsdb-tool:
devel-su pkcon install geoclue-provider-mlsdb-tool

3 Likes

This step by step works great even from Spain. Thank you very much for sharing!

It also works fine for me in France.
Thanks a lot!

Thank you for this workaround. Today I was in need of the GPS, and even after 40 min I couldn’t get a lock (GPSInfo reported 18 satellites in view). So this is a very needed solution.

To confirm: to either add a new country, or extract for the whole world, we have to change the source code and recompile? Is it possible to compile directly in the phone or is an SDK needed? I couldn’t find instructions in the linked github repo.

Thank you

This is my issue, (United States), but I’m not clear on your directions - I don’t have this file anywhere… is it in the source? So you would have to build it yourself, and not use the mlsdbtool from pkcon?

Yes, the modified and compiled source code from github.
If you want I’ll create the files for you tomorrow. Do you need Guam and Virgin Islands cell data?

1 Like

I would also appreciate those files. In my case, continental US would suffice. Thank you

No thanks - mainland us would be great. Thanks

$ ./geoclue-mlsdb-tool_mcc310316 -c Spain MLS-full-cell-export-2021-01-17T000000.csv 
Reading data from file and caching cell locations which are within the bounding boxes...
Progress: 11440000 lines read, 2371172 cell locations inserted
Finished reading data: 11447488 lines read, 2371172 cell locations inserted
Writing data (596603 entries) to mlsdb.data file: ./1/mlsdb.data
Writing data (569987 entries) to mlsdb.data file: ./2/mlsdb.data
Writing data (497477 entries) to mlsdb.data file: ./3/mlsdb.data
Writing data (358144 entries) to mlsdb.data file: ./4/mlsdb.data
Writing data (155940 entries) to mlsdb.data file: ./5/mlsdb.data
Writing data (67372 entries) to mlsdb.data file: ./6/mlsdb.data
Writing data (43605 entries) to mlsdb.data file: ./7/mlsdb.data
Writing data (38372 entries) to mlsdb.data file: ./8/mlsdb.data
Writing data (43672 entries) to mlsdb.data file: ./9/mlsdb.data
Done!

According to https://en.wikipedia.org/wiki/Mobile_country_code US MCCs are 310-316 (excluding Guam and V.I.).
US cell data as of 2021-01-17: https://gofile.io/d/lkmFp4

PS You might need to devel-su chown root.root -R /usr/share/geoclue-provider-mlsdb/ afterwards.

2 Likes