Skip to main content

Assisted location services for MicroPython

Project description

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
(3.484547378491735, 78.86739615869062)

Location using local database:

Create a binary database of GSM cells:

./bs-dl.py --mcc 234 --mnc 3 --circle=-0.118092,51.509865,3 -v --token api-token # Please visit https://opencellid.org for getting your API token

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-3.bin

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

# Get location
import agps
import cellular
agps.get_location_local(cellular.agps_station_data(), "234-3.bin")
(3.484547378491735, 78.86739615869062)

Raw data

Please find here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micropython-agps-0.1.1.tar.gz (2.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page