Skip to content
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

Coordinates (LAT and LON) marker #1333

Closed
juancalvof opened this issue May 19, 2020 · 9 comments
Closed

Coordinates (LAT and LON) marker #1333

juancalvof opened this issue May 19, 2020 · 9 comments

Comments

@juancalvof
Copy link

Describe the solution you'd like
I need a search bar so users can input a location, by Latitude and Longitude, and the map will automatically put a temporary marker or take to that location.

Additional context
I have done some research and I understand, if nothing has been done till the date, it feels it will be some kind of mixture between MousePosition() and Search() plugins. I also found this link that I think is related: http://zyzo.github.io/gsoc/fossasia/2015/05/03/gsoc-map-picker-task.html Any help or comments a very welcome! :)

Thanks for this amazing work. I hope that in the near future, when I get a little more fluent with big python projects, I can contribute to this fantastic project.

@Conengmo
Copy link
Member

Hi @JuanCalvoFerrandiz, good to hear you like this library! Coincidently we have a PR pending that implements the feature you describe: #1323 If you can install folium from that git branch you can test it out. I'm curious to hear if it works for you.

@juancalvof
Copy link
Author

Sounds great.

I having problems using de plugin. I have done the installation of the branch, and I see in my new plugins folder, the control_geocoder.py, but I'm not able to call the class. The constructor I can call is LocateGeocoder(), but when I run it, as it is describe here: #1321 (comment), I have this error:
Traceback (most recent call last): File "C:\Users\juanc\Anaconda3\envs\project_jalvos\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-653d0a053cb7>", line 2, in <module> import folium.plugins File "C:\Program Files\JetBrains\PyCharm 2020.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Users\juanc\Anaconda3\envs\project_jalvos\lib\site-packages\folium\plugins\__init__.py", line 24, in <module> from folium.plugins.locate_geocoder import LocateGeocoder File "C:\Program Files\JetBrains\PyCharm 2020.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) ModuleNotFoundError: No module named 'folium.plugins.locate_geocoder'

on the other hand, I'm not sure what I'm expecting to achieve and how to use this class for my purpose of finding any LAT/LON position. :) Thanks! Any help is welcome.

@juancalvof
Copy link
Author

Actually the error happens just with:
import folium.plugins

This is the branch I installed:
Capture 666JPG

Please, let me know how I can help with more testing.

@Conengmo
Copy link
Member

I renamed the class, please import it as follows:

from folium.plugins import Geocoder
Geocoder().add_to(m)

or

import folium.plugins
folium.plugins.Geocoder().add_to(m)

@juancalvof
Copy link
Author

juancalvof commented May 21, 2020

Hi,
I just made a new installation: >pip install git+https://github.com/WBP20/folium.git, and same error with just first line: import folium.plugins. I'm doing something wrong? Thanks!

`import folium.plugins

Traceback (most recent call last):
  File "C:\Users\juanc\Anaconda3\envs\project_2004\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-3545e1d94389>", line 1, in <module>
    import folium.plugins
  File "C:\Program Files\JetBrains\PyCharm 2020.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\juanc\Anaconda3\envs\project_jalvos\lib\site-packages\folium\plugins\__init__.py", line 24, in <module>
    from folium.plugins.locate_geocoder import LocateGeocoder
  File "C:\Program Files\JetBrains\PyCharm 2020.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'folium.plugins.locate_geocoder'
import folium.plugins
Traceback (most recent call last):
  File "C:\Users\juanc\Anaconda3\envs\project_jalvos\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-5-3545e1d94389>", line 1, in <module>
    import folium.plugins
  File "C:\Program Files\JetBrains\PyCharm 2020.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\juanc\Anaconda3\envs\project_jalvos\lib\site-packages\folium\plugins\__init__.py", line 24, in <module>
    from folium.plugins.locate_geocoder import LocateGeocoder
  File "C:\Program Files\JetBrains\PyCharm 2020.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'folium.plugins.locate_geocoder'
`

@Conengmo
Copy link
Member

Conengmo commented May 23, 2020

You're almost there, you're not specifying the branch to install from so it will take the master branch by default. The new functionality is in a branch called WBP20-patch-1:

pip install git+https://github.com/WBP20/folium.git@WBP20-patch-1 (outdated)

@Conengmo Conengmo added the work in progress Work is in progress on a PR, check the PR to see its status label May 23, 2020
@juancalvof
Copy link
Author

Fantastic! It works like a charm! Great job mates.

@Conengmo
Copy link
Member

Good to hear! The PR has been merged, so if you install folium from the master branch the functionality is there. It will also be in the next release (date still unknown).

pip install git+https://github.com/python-visualization/folium.git

@Conengmo Conengmo removed the work in progress Work is in progress on a PR, check the PR to see its status label May 30, 2020
@seghier
Copy link

seghier commented Oct 27, 2021

I renamed the class, please import it as follows:

from folium.plugins import Geocoder
Geocoder().add_to(m)

or

import folium.plugins
folium.plugins.Geocoder().add_to(m)

Hi @Conengmo
Thanks for this plugin, how we can get lat/lon coordinates of the found location?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants