mapview icon indicating copy to clipboard operation
mapview copied to clipboard

Possibility of leaflet.extras search options?

Open smach opened this issue 2 years ago • 8 comments

I realize this may be out of scope for mapview's purpose of exploratory visualization, but I was wondering if you've considered implementing the addSearchOSM function from the leaflet.extras package to allow search by address? (It's useful for mapping political district changes and to check if an address has been moved into another district. For now I still need the leaflet package for my redistricting maps to get the address search.) Thanks for the great package!

smach avatar Dec 11 '21 20:12 smach

Yeah, I see the neatness (if that's a word) of a feature like that. But as you guessed I don't think it fits the scope of mapview particularly well. It's intended to be data centric. It would much better fit the scope of mapedit fwiw. Also, leaflet.extras is a package I'd like to avoid at this stage because of its stale dev state (see their note on GitHub). That said I am not adverse to implementing an argument like search = TRUE if we could find a actively maintained home for addSearchOSM. leaflet.extras2 seems like an obvious candidate, but I am not sure how @trafficonese likes the idea of migrating it?

tim-salabim avatar Dec 12 '21 16:12 tim-salabim

Thank you. Yes, that all makes sense, I understand it's out of scope. I can continue using leaflet for these things. But I really like the mapview syntax so figured it was worth asking about :-) I didn't see that about leaflet.extras package status (I wish that notice was also on the package website too) It is a very useful public service feature if @trafficonese agrees, though, even just for leaflet. You can see an example here on my little local neighborhood blog, helping residents see their new precinct and district.

smach avatar Dec 12 '21 16:12 smach

Let me see if I can get it to work with something like this:

mapview(x, "addSearchOSM")

i.e. pass additional leaflet* features via the magic dots. It may be that this is easy to implement, so I'm inclined to try.

Would that help?

tim-salabim avatar Dec 12 '21 18:12 tim-salabim

Yes definitely!!!

smach avatar Dec 12 '21 19:12 smach

Hey, I'm actually very interested in this functionality as well. But for some time now I've been toying with the idea of taking over the maintenance of 'leaflet.extras' more than transferring existing functions to 'leaflet.extras2'. I think that would generally be more helpful and the cleaner solution.

trafficonese avatar Dec 13 '21 08:12 trafficonese

@trafficonese that surely sounds like the best option! I am sure Bhaskar will be delighted to hear this. FWIW, I do have admin rights on the repo I think, but we should go via Bhaskar if you decide to take over.

tim-salabim avatar Dec 13 '21 09:12 tim-salabim

@smach FWIW, you can already do:

library(mapview)
leafem::garnishMap(mapview(franconia), leaflet.extras::addSearchOSM)

tim-salabim avatar Dec 14 '21 09:12 tim-salabim

Thanks! I didn’t know about leafem::garnishMap()

smach avatar Dec 14 '21 12:12 smach