Geolocation components?

Hi there!
I’m trying to build a scattermapbox that is centered on the user’s current location (GPS) if available. Is there any way to get this information from the client?

You could try the locate control in Dash Leaflet,

Thanks! I’ll take a look. Dash-leaflet seems super interesting.
I would have to drop the idea of using a scattermapbox, right?

I ended up trying dash-more-components’ geolocation component. It works like a treat on my development PC, but times out when deployed to the webserver (gunicorn+nginx). It also works well when launched directly on the server (without gunicorn). I haven’t been able to work out why… Any clues?

I might still try dash-leaflet if I can’t get this to work!

Yes, you cannot use scattermapbox. You would have to use a dash leaflet equivalent instead (:

Thanks Emil!
I’ll have another shot at using dash-more-components to avoid dropping the scattermapbox component which is working fine.

If anyone can help me out with this it would be great:
Dash-more-components on development machine: no problem.
When using the code on the webserver (gunicorn+nginx), the webpage just seems to wait forever while “Updating…”.
Inspector shows the following:
dash_renderer.min.js:20 Uncaught (in promise) Error: dash_more_components was not found.

GET http://…/_dash-component-suites/dash_more_components/dash_more_components.v0_0_1m1618828862.min.js net::ERR_ABORTED 404 (Not Found)

I’m running gunicorn with the following ExecStart (which has been fine so far):
/…/gunicorn --pythonpath=/…/python3 --bind=unix:/tmp/gunicorn.sock --workers=4 application:server

Am I missing anything in my gunicorn configuration, perhaps?

Hey @Joni

Happy to hear that you found my geolocation component in dash-more-components! However, I would recommend using dash leaflet in production because my library is more experimental and those components have not yet been published.

The good news is that Plotly has expressed an interest in including geolocation and 3 other components in dash-core-components. The PR for the Clipboard component was just merged and will be in the next release. Geolocation is coming soon!


Thank you for the news (and for the component!).
I hope we’ll see dcc.Geolocation soon as it fits my needs perfectly!

In any case, and if anyone knows how to fix this issue please let me know.

That’s awesome to hear. So psyched to see this component make its way into dcc :smiley_cat: I’ve played around with the one in @AnnMarieW ’s library and it’s so great.

1 Like

I’m giving Dash Leaflet a shot now and I’m running into the same problem so there has to be something wrong with my Gunicorn implementation which I hadn’t run into before.
I’ll open a new thread about this, as it is probably not related to these packages, but I’m struggling to get the js files being served locally.

EDIT: If @Emil or @AnnMarieW can publish their packages on (I don’t know how to do this!) I suppose they will be usable when using Gunicorn.

Thanks everyone for helping!

Create separated method which includes Geocoder variable and create a list to put the coordinates from your location, so to be safe you check if the List is exist and if each info we want in that list is exist, then you use (getThoroughfare ==> for Street Address), (getLocality ==> for City / State), (getPostalCode ==> for Zip), (getAdminArea ==> for Complete Address).