{"id":13801675,"url":"https://github.com/pulkin/mpy-agps","last_synced_at":"2025-05-05T21:35:18.324Z","repository":{"id":57441471,"uuid":"230330988","full_name":"pulkin/mpy-agps","owner":"pulkin","description":"Micropython implementation of assisted location services (AGPS)","archived":false,"fork":false,"pushed_at":"2020-04-22T22:29:55.000Z","size":26,"stargazers_count":13,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-16T22:10:17.329Z","etag":null,"topics":["a9g","agps","database","gps","lbs","micropython","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pulkin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-26T21:35:03.000Z","updated_at":"2025-01-14T00:07:42.000Z","dependencies_parsed_at":"2022-09-06T02:40:17.593Z","dependency_job_id":null,"html_url":"https://github.com/pulkin/mpy-agps","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulkin%2Fmpy-agps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulkin%2Fmpy-agps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulkin%2Fmpy-agps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulkin%2Fmpy-agps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pulkin","download_url":"https://codeload.github.com/pulkin/mpy-agps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252580532,"owners_count":21771352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a9g","agps","database","gps","lbs","micropython","python"],"created_at":"2024-08-04T00:01:25.727Z","updated_at":"2025-05-05T21:35:18.307Z","avatar_url":"https://github.com/pulkin.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Communications"],"readme":"micropython-agps\n----------------\n\nFor use with [micropython on GPRS module A9/A9G](https://github.com/pulkin/micropython/tree/master/ports/gprs_a9).\n\nExamples\n--------\n\n### Location over internet connection:\n\n```python\n# Enable data connection\nimport cellular\ncellular.gprs(\"apn\", \"user\", \"pass\")\n\n# Get location\nimport agps\nagps.get_location_opencellid(cellular.agps_station_data(), \"api-token\") # Please visit https://opencellid.org for getting your API token\n(78.86739615869062, 3.484547378491735)\n```\n\n### Location using local database:\n\nCreate a binary database of GSM cells:\n\n```bash\n~ ./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\nTarget: 234-10.bin\nDownloading https://opencellid.org/ocid/downloads?token=[token]\u0026type=mcc\u0026file=234.csv.gz ...\nUnzipping ...\nParsing ...\nFiltering ...\n - mcc: 322671 -\u003e 322671\n - mnc: 322671 -\u003e 99367\n - circle: 99367 -\u003e 2749\nSorting ...\nItems total: 2749\nPreparing tables ...\nSaving ...\nTotal size: 33010 bytes\nDone\n```\n\nFiltering is done through entries `mcc` - mobile country code, `mnc` - mobile network code and `circle` - location and radius of a circle with cells.\nAll entries are optional, however, the full worldwide database is as large as 1Gb.\nProviding `mcc` and `mnc` will reduce the databse size down to few Mb.\nProviding a `circle` will further filter data towards the circular area specified: 3 km of urban area results in around 10Kb of data.\n\nNote that the token is optional: without a proper token, the script will fall back to a git mirror which may contain outdated data.\n\nThen, upload the database to the module (note the file name):\n\n```bash\nampy --port /dev/ttyUSB0 put 234-10.bin\n```\n\nFinally, determine the location (no data connection needed):\n\n```python\n# Get location\nimport agps\nimport cellular\nagps.get_location_local(cellular.agps_station_data(), \"234-10.bin\")\n(51.54547378491735, -0.11739615869062)\n```\n\nRaw data\n--------\n\nPlease find [here](https://github.com/pulkin/agps-data).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulkin%2Fmpy-agps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpulkin%2Fmpy-agps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulkin%2Fmpy-agps/lists"}