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

Leaflet.extras addSearchFeatures not rendering #143

Closed
AMoss22 opened this issue May 24, 2018 · 17 comments
Closed

Leaflet.extras addSearchFeatures not rendering #143

AMoss22 opened this issue May 24, 2018 · 17 comments

Comments

@AMoss22
Copy link

AMoss22 commented May 24, 2018

No description provided.

@AMoss22 AMoss22 changed the title Hi I used one of your examples to add search feature code below. This runs and produces the map with the search box butwhen I typy in New York (or any of the other city names) it location is not found. Do you have any ideas why this might be. Many thnaks Hi I used one of your examples to add search feature code below. This runs and produces the map with the search box but when I type in New York (or any of the other city names) it location is not found. Do you have any ideas why this might be. Many thanks cities <- read.csv(textConnection("City,Lat,Long,Pop May 24, 2018
@AMoss22 AMoss22 changed the title Hi I used one of your examples to add search feature code below. This runs and produces the map with the search box but when I type in New York (or any of the other city names) it location is not found. Do you have any ideas why this might be. Many thanks cities <- read.csv(textConnection("City,Lat,Long,Pop Leaflet.extras addSearchFeatures not rendering May 24, 2018
@AMoss22
Copy link
Author

AMoss22 commented May 24, 2018

Hi I used one of your examples to add search feature code below. This runs and produces the map with the search box but when I type in New York (or any of the other city names) it location is not found. Do you have any ideas why this might be. Many thanks
This is the example I tried

cities <- read.csv(textConnection("City,Lat,Long,Pop
Boston,42.3601,-71.0589,645966
Hartford,41.7627,-72.6743,125017
New York City,40.7127,-74.0059,8406000
Philadelphia,39.9500,-75.1667,1553000
Pittsburgh,40.4397,-79.9764,305841
Providence,41.8236,-71.4222,177994"))

leaflet(cities) %>% addProviderTiles(providers$OpenStreetMap) %>%
addCircleMarkers(lng = ~Long, lat = ~Lat, weight = 1, fillOpacity=0.5,
radius = ~sqrt(Pop)/50 , popup = ~City, label=~City, group ='cities') %>%
addResetMapButton() %>%
addSearchFeatures(
targetGroups = 'cities',
options = searchFeaturesOptions(
zoom=12, openPopup = TRUE, firstTipSubmit = TRUE,
autoCollapse = TRUE, hideMarkerOnCollapse = TRUE )) %>%
addControl("

Hint! Search for ...

  • New York
  • Boston
  • Hartford
  • Philadelphia
  • Pittsburgh
  • Providence

",
position='bottomright')

@ramnathv
Copy link

ramnathv commented Jun 8, 2018

I believe this is related to stefanocudini/leaflet-search#196. @schloerke I see that leaflet.extras is still using v 2.3.7 of leaflet-search, while the current version is 2.9.0. Any reasons not to switch to the latest version?

@schloerke
Copy link
Collaborator

The circle marker issue looks to be fixed without testing.

stefanocudini/leaflet-search#196 is not fixed as Path has not removed.

Once Path is removed, I'll make a PR.

@ramnathv
Copy link

ramnathv commented Jun 8, 2018

Thanks for the update @schloerke!

@tim-salabim
Copy link

For what it's worth, @ramnathv I can confirm @schloerke 's comment. About two weeks ago I updated a local clone of leaflet.extras to the latest version of leaflet-search and still had to remove the Path bit to get it working properly.

@AMoss22
Copy link
Author

AMoss22 commented Jul 24, 2018

Thank you all for your comments, I'm a bit confused what I have to do to get this function to work. It clearly works in the Rpubs example. I am using R studio version 1.1.183, R version 3.4.2, leaflet version 2.0.1 and leaflet.extras version 1.0.0. I have tried to compare the html but it is very different.
Any help would be appreciated

@erstearns
Copy link

I am also having the same issue with all three addSearch options. addSearchUSCensusBureau and addSearchOSM result in the search icon being present on the leaflet map, however addSearchGoogle does not. Also puzzled by the fact that it is working great in the Rpubs example. I am running RStudio version: 1.1.456, R version: 3.4.4, leaflet version 2.0.1.9 and leaflet.extras version 1.0.0. Not sure what could be driving the issue, but wanted to contribute information on my system to help diagnose the problem.

@mhaditama26
Copy link

The feature you added has to have a label..
thus you can search it

addMarkers(yourfeature$Longitude, yourfeature$Latitude, **label=**yourfeature$name,popup = yourfeature$name, group = "yourfeature")%>%

@yzjiangyang
Copy link

@tim-salabim, how to remove the Path bit to get it working properly? leaflet extra Search Button does not work for me either.

@ryanscharf
Copy link

This still appears to be a problem with leaflet 2.0.2 and leaflet.extras 1.0.0. It seems to be recognized that CircleMarkers don't work, but I haven't been able to get the RPubs addSearchFeatures() example to work with addCircles() either.

@bhaskarvk
Copy link
Contributor

I'll be resuming development of leaflet.extras in Dec and will tackle this in that round. Thanks!

@yzjiangyang
Copy link

@bhaskarvk
How Can we remove the path to make CircleMarkers search button work properly?
Thanks

@yzjiangyang
Copy link

I'll be resuming development of leaflet.extras in Dec and will tackle this in that round. Thanks!

@bhaskarvk Hi, Will you work on the leaflet search button in Dec? Thank you

@TacticalFate
Copy link

TacticalFate commented Dec 29, 2018

I figured out how to make the search work with the CircleMarkers (removing the path check), you have to go into your R library path
#R Library path#\leaflet.extras\htmlwidgets\build\lfx-search\

Open lfx-search-prod.js and search for "e instanceof t.Path ||" , and then delete it and save the file. Your CircleMarker search should work now

@ryanscharf
Copy link

@TacticalFate Are you editing the package files? Those directories don't exist for me.

@Vicellken
Copy link

I figured out how to make the search work with the CircleMarkers (removing the path check), you have to go into your R library path
#R Library path#\leaflet.extras\htmlwidgets\build\lfx-search\

Open lfx-search-prod.js and search for "e instanceof t.Path ||" , and then delete it and save the file. Your CircleMarker search should work now

Thank you! Your solution works for me!

@trafficonese
Copy link
Owner

I updated leaflet-search to v4.0.0 and addSearchFeatures should be working again.

wyuill added a commit to wyuill/leaflet.extras that referenced this issue May 29, 2024
allow searching of circle markers as per trafficonese#143
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