-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added dcc.Geolocation component #2349
Conversation
f5072f9
to
4e4c10d
Compare
this.props.setProps({ | ||
update_now: false, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to put this at the very beginning of updatePosition
, so it's cleared even if geolocation
is unsupported? Also maybe wrap it in if (this.props.update_now) { ... }
so we don't call setProps
unnecessarily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 Looks great, nice work @AnnMarieW! Other than my one nonblocking comment, please add a changelog entry and this will be good to go!
super(props); | ||
this.success = this.success.bind(this); | ||
this.error = this.error.bind(this); | ||
this.updatePosition = this.updatePosition.bind(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updatePosition
doesn't require a bind, it's not used as pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 Looks good
components/dash-core-components/src/components/Geolocation.react.js
Outdated
Show resolved
Hide resolved
…ct.js Co-authored-by: Alex Johnson <alex@plot.ly>
Add dcc.Geolocation
Recreated PR from old dash-core-components repo # 962
CHANGELOG.md
The Geolocation component uses the Geolocation API. This will cause the user's browser to ask for permission to access location data. If they accept, then the browser will use the best available functionality on the device to access this information (for example, GPS).
Component Properties
lat
latitude in degreeslon
longitude in degreesaccuracy
of the lat/lon in metersWhen available:
alt
altitude in metersalt_accuracy
in metersheading
in degreesspeed
in meters per secTrue
in a callback, the browser will update the position data and resetupdate_now
back to False. This can, for example, be used to update the position with a button click or an interval timer.Quickstart
Demo app
This app demos showing user's location on a map, getting the address based on the lat long position, live updates, and more!
(requires dash-bootstrap-components>=1.0.0 and geopy for displaying the address)