A custom Streamlit component to get the users location via js navigator.geolocation.
Project description
streamlit-geolocation
A geolocation button for streamlit
Installation
pip install streamlit-geolocation
Usage
from streamlit_geolocation import streamlit_geolocation
location = streamlit_geolocation()
st.write(location)
outputs: {'latitude': 35.9700706, 'longitude': -83.9184362, 'altitude': None, 'accuracy': 12.684, 'altitudeAccuracy': None, 'heading': None, 'speed': None}
Of course, at first it will output "No Location Info" until you press the button.
This uses the javascript method navigator.geolocation.getCurrentPosition to get the user's location. The response is a GeolocationCoordinates object.
This is heavily inspired by this repository: https://github.com/aghasemi/streamlit_js_eval I am simplifying the scope to just getting the user's location and not evaluating arbitrary javascript, but I owe a lot to the original author.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_geolocation-0.0.10.tar.gz.
File metadata
- Download URL: streamlit_geolocation-0.0.10.tar.gz
- Upload date:
- Size: 796.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.66.1 urllib3/1.26.5 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0617a39aa26a6019f9b6989e31a310742fe5fe1728321474cf8b5f03a7146d4c
|
|
| MD5 |
bdfb19ab4a5e4552dc91392849805847
|
|
| BLAKE2b-256 |
86e2f3d7da8d0e9892a5f20e53603b08a71cdb98a813193213b2cbcc3bb0e5f3
|
File details
Details for the file streamlit_geolocation-0.0.10-py3-none-any.whl.
File metadata
- Download URL: streamlit_geolocation-0.0.10-py3-none-any.whl
- Upload date:
- Size: 802.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.66.1 urllib3/1.26.5 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9d9eb61238db468076ef374027a1691fa6696f44d4e4472b0123df03dc0d9ea
|
|
| MD5 |
f52612594afce165f712d55e6870476a
|
|
| BLAKE2b-256 |
2b64619d0332c50ecb65a5c03c63e78c06855325c8f605459168aa96a06ce042
|