GithubHelp home page GithubHelp logo

mpy-agps's Introduction

micropython-agps

For use with micropython on GPRS module A9/A9G.

Examples

Location over internet connection:

# Enable data connection
import cellular
cellular.gprs("apn", "user", "pass")

# Get location
import agps
agps.get_location_opencellid(cellular.agps_station_data(), "api-token") # Please visit https://opencellid.org for getting your API token
(78.86739615869062, 3.484547378491735)

Location using local database:

Create a binary database of GSM cells:

~ ./bs-dl.py --mcc 234 --mnc 10 --circle=51.509865,-0.118092,3 -v --token api-token # Please visit https://opencellid.org for getting your API token
Target: 234-10.bin
Downloading https://opencellid.org/ocid/downloads?token=[token]&type=mcc&file=234.csv.gz ...
Unzipping ...
Parsing ...
Filtering ...
 - mcc: 322671 -> 322671
 - mnc: 322671 -> 99367
 - circle: 99367 -> 2749
Sorting ...
Items total: 2749
Preparing tables ...
Saving ...
Total size: 33010 bytes
Done

Filtering is done through entries mcc - mobile country code, mnc - mobile network code and circle - location and radius of a circle with cells. All entries are optional, however, the full worldwide database is as large as 1Gb. Providing mcc and mnc will reduce the databse size down to few Mb. Providing a circle will further filter data towards the circular area specified: 3 km of urban area results in around 10Kb of data.

Note that the token is optional: without a proper token, the script will fall back to a git mirror which may contain outdated data.

Then, upload the database to the module (note the file name):

ampy --port /dev/ttyUSB0 put 234-10.bin

Finally, determine the location (no data connection needed):

# Get location
import agps
import cellular
agps.get_location_local(cellular.agps_station_data(), "234-10.bin")
(51.54547378491735, -0.11739615869062)

Raw data

Please find here.

mpy-agps's People

Contributors

pulkin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.