A simple API for Apple's gs-loc service
Project description
gsloc: Apple Location Service API for Python
gsloc is a Python library and CLI tool that provides a reverse-engineered interface to Apple's Location Service API. This project is inspired by the work found at GS-LOC on GitHub and aims to simplify querying Apple's location services using MAC addresses of Wi-Fi networks.
What is Apple's GS-LOC Service?
Apple's GS-LOC service is a part of Apple's broader location services, which help in determining the geographical position of a device based on various data sources, including Wi-Fi networks. By providing the MAC addresses of nearby Wi-Fi access points, you can retrieve location data such as latitude, longitude, and accuracy. This service is typically used in devices for enhancing location accuracy especially when GPS data is inadequate or unavailable.
Purpose of the gsloc Tool
The gsloc tool is designed to allow developers and researchers to interact with Apple's Location Service through a Python library or a command-line interface. It is particularly useful for applications and services where location data is critical, such as in geospatial analysis, tracking systems, and in any context where understanding the physical location context is beneficial.
Use Cases
Geospatial Analysis: Analysts and developers can integrate location data into their applications for enhanced spatial analysis. Device Tracking: Useful in scenarios where the geographical tracking of devices is necessary, enhancing capabilities in logistics and fleet management. Augmented Reality and Gaming: Provides backend support for location-based services in AR applications and games, offering a richer user experience by integrating real-world data. Research and Development: Enables researchers to gather and analyze location data for various experimental and developmental purposes. By utilizing gsloc, users can leverage Apple's robust location infrastructure to enhance their applications and services with accurate geospatial data.
Installation
You need Python 3.7 or higher to use this tool.
pip install gsloc
Usage
Using as a Python library:
from gsloc.core import query
results = query(["94:10:3e:a0:b7:bd"])
Using as a command line tool:
gsloc 94:10:3e:a0:b7:bd # you can enter multiple MAC addresses separated by space
Ouput:
❯ gsloc 94:10:3e:a0:b7:bd
[05/15/24 14:21:34] INFO 2024-05-15 14:21:34,320 - gsloc.core - INFO - Querying Apple location service with MAC addresses: ['94:10:3e:a0:b7:bd'] core.py:125
INFO 2024-05-15 14:21:34,735 - gsloc.core - INFO - Received response from Apple location service. core.py:144
[
WifiInfo(mac='94:10:3e:a0:b7:bd', channel=153, latitude=37.70825958, longitude=-122.4556961, accuracy=25, altitude=98, altitude_accuracy=4),
WifiInfo(mac='10:86:8c:45:bc:6e', channel=6, latitude=37.7087059, longitude=-122.45516204, accuracy=27, altitude=96, altitude_accuracy=4),
WifiInfo(mac='1e:16:89:c6:45:58', channel=6, latitude=37.70783996, longitude=-122.45616912, accuracy=20, altitude=105, altitude_accuracy=4),
WifiInfo(mac='1e:9d:72:ca:be:6f', channel=1, latitude=37.70779037, longitude=-122.45628356, accuracy=27, altitude=105, altitude_accuracy=4),
WifiInfo(mac='1e:9d:72:ca:f7:17', channel=6, latitude=37.70855331, longitude=-122.45585632, accuracy=32, altitude=98, altitude_accuracy=4),
WifiInfo(mac='1e:9e:cc:4d:fa:48', channel=6, latitude=37.70830917, longitude=-122.45615386, accuracy=99, altitude=100, altitude_accuracy=10),
WifiInfo(mac='1e:9e:cc:4d:fa:4a', channel=6, latitude=37.7082901, longitude=-122.45614624, accuracy=94, altitude=100, altitude_accuracy=10),
WifiInfo(mac='1e:9e:cc:4d:fa:4d', channel=6, latitude=37.70826721, longitude=-122.45616912, accuracy=87, altitude=107, altitude_accuracy=4),
...
]
Or, you can provide a list of MAC addresses in a file and write the output to a GeoJSON file:
94:10:3e:a0:b7:bd
10:86:8c:45:bc:6e
...
gsloc -i macs.txt -o output.geojson
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gsloc-0.1.2.tar.gz
.
File metadata
- Download URL: gsloc-0.1.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda20e558bd312bf2d707e226800c65211f37afe40cbbde8a227926510dc0720 |
|
MD5 | 7b25644e9c193ae58574f2409c0dc21f |
|
BLAKE2b-256 | 83dd43a6260a6a0f93b114a32afea3608d0a18fd8b5f8e4955769e080c6925eb |
File details
Details for the file gsloc-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: gsloc-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c640e5b5b350d1e4260d50cc386151f45eab9abb29348e7ab850b2ab8f6df22a |
|
MD5 | 2d3d2e569d37da0f6d808ca437b16734 |
|
BLAKE2b-256 | 54074fc2e962115c85170baef2081b1302ef687a09fec1ae5101847270eb32b6 |