Metadata-Version: 2.1
Name: streamlit-geolocation
Version: 0.0.10
Summary: A custom Streamlit component to get the users location via js navigator.geolocation.
Home-page: https://github.com/steffanic/streamlit-geolocation
Author: Patrick Steffanic
Author-email: steffaniccodes@gmail.com
Keywords: Python,Streamlit,JavaScript
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: streamlit (>=1.0.0)

# 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.

![sample](sample.gif)
