perliedman / leaflet-control-geocoder

A simple geocoder form to locate places. Easily extended to multiple data providers.
http://www.liedman.net/leaflet-control-geocoder/
BSD 2-Clause "Simplified" License
560 stars 219 forks source link

Return address in Bing geocoding results and reverse geocoding. #220

Open rnbwspctrm opened 5 years ago

rnbwspctrm commented 5 years ago

I am trying to get the address of the geocoding results returned using the Bing geocoder. Do you have plans to add this to the results returned? I imagine this is a very useful property for many reasons and am not sure why it would not be included by default.

Currently, I have modified the geocode method and it was very simple to add the address property to the results. However, the reverse method has been a little more difficult as it relies more heavily on the context of the geocoder file and methods in your library.

Also, when searching by coordinates, reverse geocoding is not triggered. Is there a way through the UI to specify that you need reverse geocoding? Results with the coordinates you searched on does not seem very helpful.

Thank you for all your work on this, for opening your readme with the informative and direct Diversity in Tech section, and for the awesome comment in your demo. As a woman in this industry, I greatly appreciate it.

perliedman commented 5 years ago

Hi! Thanks for taking the time to report an issue thoroughly!

Let me first start with saying that unfortunately I do no longer use this project in my own work. More specifically, I do not think I have ever used the Bing geocoder for anything other than demos, which might explain why it might be lacking some critical functionality.

Just guessing here, but it might very well be that the address property was not available in Bing when I wrote it, it was quite a while ago. I would be happy to accept a pull request with this feature. I think it should be equally easy to add this to the reverse geocoding, by adding a line for this here: https://github.com/perliedman/leaflet-control-geocoder/blob/master/src/geocoders/bing.js#L49, but maybe I am missing some detail that makes this tricky?

It is an interesting observation that we could make a reverese query if we detect that a coordinate is typed into the search field, this ideas has never crossed my mind, the `reverse' method is never called internally by the control as it is now, I only intended it to be called by the app using the geocoder. Your idea makes a lot of sense though, but we would have to figure out a way to detect coordinate input, and the do reverse geocoding. As far as I know there are a couple of different formats for doing coordinate input.