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
Add Search Box on Folium map #464
Comments
There is no search box on PRs welcome 😄 |
I have started to work on the leaflet-search plugin, it is awaiting a Pull Request, if you're still interested in this plugin a peer review would be great. |
@ocefpaf |
I have made an example notebook, did you look at that?
…Sent from my iPhone
On 17 Oct 2017, at 06:00, morteza3000 <notifications@github.com<mailto:notifications@github.com>> wrote:
@ocefpaf<https://github.com/ocefpaf>
can you please help more about mentioned plugin, how to install or add to a folium project?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#464 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AWaWQfyAZKB4K9WBUT_EoqJH5Sdwpwcfks5stDR3gaJpZM4JNCFm>.
|
No I didn't, can you please give me the name of that example notebook? |
Plugins-search.ipynb
I think it should be there, I’ll check on my laptop when I get a chance if not.
…Sent from my iPhone
On 17 Oct 2017, at 14:35, morteza3000 <notifications@github.com<mailto:notifications@github.com>> wrote:
No I didn't, can you please give me the name of that example notebook?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#464 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AWaWQWK59yLpUrMDEsiuBqxKRufajPIPks5stK07gaJpZM4JNCFm>.
|
I'll really appreciate if you can share it. |
PR: #747 https://github.com/ghandic/folium/blob/search-features/examples/Plugins-Search.ipynb (all of the data is self contained in the notebook - this will be changed shortly. This search feature is on my feature-seach branch |
I'm away from office with limited connection. I'll check it as soon as I
get back.
…On Oct 17, 2017 4:05 AM, "Andy Challis" ***@***.***> wrote:
I have made an example notebook, did you look at that?
Sent from my iPhone
On 17 Oct 2017, at 06:00, morteza3000 ***@***.***<mailto:
***@***.***>> wrote:
@ocefpaf<https://github.com/ocefpaf>
can you please help more about mentioned plugin, how to install or add to
a folium project?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://github.com/
python-visualization/folium#464#issuecomment-337118188>, or mute
the thread<https://github.com/notifications/unsubscribe-
auth/AWaWQfyAZKB4K9WBUT_EoqJH5Sdwpwcfks5stDR3gaJpZM4JNCFm>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#464 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA6BLy5N7qjJXD8NroHTO055n0ERNirMks5stFGxgaJpZM4JNCFm>
.
|
@ghandic AttributeError Traceback (most recent call last) AttributeError: 'module' object has no attribute 'Search' |
Did you pip install from my search-feature branch? It’s not been accepted into the master branch of Folium yet.
…Sent from my iPhone
On 18 Oct 2017, at 05:54, morteza3000 <notifications@github.com<mailto:notifications@github.com>> wrote:
@ghandic<https://github.com/ghandic>
Thanks a lot but I faced with below error when I wanted to run notebook.
________________________________
AttributeError Traceback (most recent call last)
in ()
9 )
10
---> 11 plugins.Search(states, search_zoom=6, geom_type="Polygon").add_to(m)
12
13 m.save(os.path.join('results', 'Plugins_search_polygon.html'))
AttributeError: 'module' object has no attribute 'Search'
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#464 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AWaWQfVU5m1VVUKMtElcRinPjvmydO2Oks5stYRpgaJpZM4JNCFm>.
|
sorry I'm totally new to folium, I've just install folium by pip and add your search.py file to "C:\ProgramData\Anaconda2\Lib\site-packages\folium\plugins". is it write? |
run this:
You will then have the latest development that has not been merged into master. |
for second command I got below error: C:\Windows\system32>pip install git+https://github.com/ghandic/folium.git@search |
Install git... |
I want to search based on popup labels, is it possible?
|
This is how it was meant to be done: points = { m = folium.Map( plugins.Search(points, search_zoom=20, ).add_to(m) m.save('example.html') |
It needs a layer to search through and you haven't supplied it by just passing coordinates. This will be added in with assertations into the next commit - as well as being able to use GeoJsonCss to add popups and styling rather than the default marker - this would allow you to use a circle marker then |
@morteza3000 I have implemented GeoJsonCss now, so re install folium as you did before if you want to use it Here is your example with popups and a custom Icon: points = { m = folium.Map( plugins.Search(points, search_zoom=20).add_to(m) m.save('example.html') |
I installed new one and it is working perfectly, Thanks. |
@ghandic can you please help me with another issue? I want to have name as plain text instead of icon, is it possible? |
It is, I don’t think it’s integrated within folium yet but you can hack around it by using an image with the text in it, might be better with a png since you can have a transparent background.
…Sent from my iPhone
On 12 Nov 2017, at 06:24, Morteza Hasan Abadi <notifications@github.com<mailto:notifications@github.com>> wrote:
@ghandic<https://github.com/ghandic> can you please help me with another issue? I want to have name as plain text instead of icon, is it possible?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#464 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AWaWQYexUXm3YhFLhVjBCunZoLYiWCZCks5s1o8pgaJpZM4JNCFm>.
|
Hi @ghandic, How can I install git? Can you help me? |
Hi i could not run this pip install git+https://github.com/ghandic/folium.git@search-features can you send an updated link please thxs |
@HSAG-2018 |
still not working not sure if from server side or my laptop... |
Ok try cloning the repo first then run the setup.py
…Sent from my iPhone
On 17 Jan 2018, at 20:19, HSAG-2018 <notifications@github.com<mailto:notifications@github.com>> wrote:
still not working not sure if from server side or my laptop...
C:\UseCase3>pip install git+https://github.com/python-visualization/folium.git
Collecting git+https://github.com/python-visualization/folium.git
Cloning https://github.com/python-visualization/folium.git to c:\users\h\appdata\local\temp\pip-iqccyg6z-build
fatal: unable to access 'https://github.com/python-visualization/folium.git/': SSL certificate problem: unable to get local issuer certificate Command "git clone -q https://github.com/python-visualization/folium.git C:\Users\h\AppData\Local\Temp\pip-iqccyg6z-build" failed with error code 128 in None
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#464 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AWaWQQEvVWnYuptJ3nOiliaOHqOd9Opwks5tLlXggaJpZM4JNCFm>.
|
the cloning does not work so i tried to download the zip save it locally then run setup.py but this has no effect...shld replacing the whole existing folium directory with the new dowloaded one work? thxs |
There will be a new release once I can allocate some time to review and merge the open PRs. |
@ghandic Hello sorry to bother. I also want to add search functionality on a group of markers and display a pop up so I tried running the sample code with GeoJsonCss implemented which you provided above but it doesn't seem to be working. To be more specific, I can't get the pop ups to appear. I've pip installed from the git (pip install git+https://github.com/python-visualization/folium.git) and am running on python 3.6.3. Hope I can get it to work soon :) Thanks! |
Hi @javaUtilScammer can you add your source code? I’ll take a look at this this morning if you can |
Hi @ghandic , didn't expect you to reply so fast but big thank you :) I wanted to implement the search functionality on another map I made using Folium a while back but I can't get the popups to appear on a sample. It's pretty much the code you commented a while back plus imports. Thanks! import folium points = { m = folium.Map( plugins.Search(data=points, search_zoom=20,position="topright").add_to(m) |
@javaUtilScammer the GeoJsonCss part has not been merged into master on this repo, I just had a look at my fork vs this repo. @ocefpaf was there some problems with the GeoJsonCSS? |
My time to finish reviewing it. I do recall some issues when testing against the notebook gallery, but I cannot get back to that this month 😒 |
No problem @ocefpaf I saw some of the modifications you did and it simplifies it a lot, I'm happy to test some of those notebooks out. Meanwhile @javaUtilScammer if you really need this purely as an output and not for long term you could use my forked repo https://github.com/ghandic/folium.git Check back soon and I'm sure we'll be a few steps closer to having this up and running! |
Our testing is a little time consuming, we need to run all the notebooks from example folder and inspect them visually. If you could do that and fix the remaining issues that would be awesome! |
@ocefpaf Just found a great little package which speeds that up, called nbmerge # cd into the project folder
pip install nbmerge
# Merges all of the notebooks into one inside examples/_merged.ipynb
nbmerge --recursive -i -p ".*" -o examples/_merged.ipynb |
@ghandic will do that for now but will definitely come back when the merge is complete! Big thanks goes to you and @ocefpaf for the quick action :) |
I spun up a docker container running jupyter notebook, cloned the repo and installed folium from your last commit hash on the pull request for #762 Then I merged all the notebooks and ran all cells, all of which seems to work perfectly. I haven't done any other testing than that, just checked the outputs and nothing errored Docker-compose.ymlversion: "2"
services:
jupyter-notebook:
build: .
image: challisa/folium-notebook
container_name: folium-notebook
ports:
- "8888:8888"
volumes:
- ~:/home/jovyan/work
entrypoint: start-notebook.sh --NotebookApp.token='' --NotebookApp.iopub_data_rate_limit=1000000000000000
DockerfileFROM jupyter/minimal-notebook
USER root
# libav-tools for matplotlib anim
RUN apt-get update && \
apt-get install -y --no-install-recommends libav-tools && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Cartopy
RUN conda install --yes -c conda-forge cartopy
USER $NB_USER
RUN pip install \
'matplotlib' \
'mplleaflet' \
'geographiclib' \
'gpxpy' \
'altair' \
'vincent' \
'geopandas' \
'pandas' \
'widgetsnbextension' && \
# Activate ipywidgets extension in the environment that runs the notebook server
jupyter nbextension enable --py widgetsnbextension --sys-prefix
USER $NB_USER |
@ghandic Hi Andy, am I right that the popup functionality has not yet been merged with master? |
Hi guys! Can anyone help me with search function? How can I find a marker by typing "one" in searchbar? from folium import plugins, Map, Marker, FeatureGroup, Popup, LayerControl m = Map(location=[43.25, 45.83333 ], zoom_start=10, zoom_control=False) fg = FeatureGroup(name='VTK') g1 = plugins.FeatureGroupSubGroup(fg, 'FTTB') m.add_child(plugins.Search(fg)) |
@ghandic , when I install it with (> pip install folium) below error appears for same examples. AssertionError: Search can only index FeatureGroup, MarkerCluster, GeoJson, and TopoJson layers at this time. |
I believe they have refactored the code since I made my pull request. Maybe check in the example notebooks?
…Sent from my iPhone
On 6 Apr 2019, at 21:46, Morteza Hasan Abadi <notifications@github.com<mailto:notifications@github.com>> wrote:
@HSAG-2018<https://github.com/HSAG-2018>
pip install folium
as it is now in the master branch :)
@ghandic<https://github.com/ghandic> , when I install it with (> pip install folium) below error appears for same examples.
can you please help?
AssertionError: Search can only index FeatureGroup, MarkerCluster, GeoJson, and TopoJson layers at this time.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#464 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AWaWQcqnduWjpewznBwxl6Hcc5Z96r69ks5veHsVgaJpZM4JNCFm>.
|
Yes, your example notebooks also don't work with provided data. |
I haven’t updated the pull request. Someone else made changes, I will have a look if I get chance. Maybe check who made the updates.
…Sent from my iPhone
On 7 Apr 2019, at 16:07, Morteza Hasan Abadi <notifications@github.com<mailto:notifications@github.com>> wrote:
Yes, your example notebooks also don't work with provided data.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#464 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AWaWQaz2neyK2xg7LmMrjp3KFKYMVGilks5veYs9gaJpZM4JNCFm>.
|
@morteza3000 please open a new issue for your problem and include:
|
Check out the example notebooks https://github.com/python-visualization/folium/blob/master/examples/plugin-Search.ipynb |
is there a search plugin that works for FastMarkerCluster? I can't use MarkerCluster because it hinders the load performance because I'm using over 11,000 markers. |
@ghandic , How we can style points in your example? citygeo = folium.GeoJson( how to add style_function to this in order to change points color or use custom icon? |
Hey everyone, as the docs say, the search plugin can index FeatureGroup, MarkerCluster, GeoJson and TopoJson layers. Could you please provide an example for FeatureGroup or MarkerCluster without GeoJson? Thanks in advance ;) |
Looking at the Search plugins python file, search is currently only implemented for GeoJson and TopoJson. I'm not entirely sure as to why the documentation states that it also implements the search for FeatureGroup and MarkerClusters. Maybe there were/are plans down the line for it (?) |
Hi, is there any way to do it by HTML ? |
@ghandic hey, could you help me with using the search plugin for FeatureGroup layers? I've not been able to find a working solution for that anywhere. |
Can anybody point me towards how to add a Search box on Folium?
I know Leaflet has this functionality but couldn't find any documentation on Folium.
Thanks in advance.
The text was updated successfully, but these errors were encountered: