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
Address Field: Name Field For Geocoding Missing #4
Comments
@lindseydiloreto Any word on this? We're really hoping to be able to switch from the Google Maps plugin to this Mapbox plugin – we mostly use Mapbox in the frontend anyway, so having a Mapbox-powered address field as well would be great. However, lack of support for location names and autocomplete using place names is a real stopper for us. |
Hey, sorry for the late response! The answer is complicated and I'm currently traveling. The short answer is this... When you select an address from the results, and all other subfields get automatically populated, Google Maps and Mapbox handle this extremely differently. With Google Maps, the API is returning a complex array of data. Then the Craft plugin takes this data and "manually" populate each related subfield. With Mapbox, the API relies heavily on the browser-native There is no I have mixed feelings about this... Using a browser-native solution is obviously preferred, but it's leading to some notable limitations. We may end up ditching the And relatedly, there seem to be multiple overlapping Mapbox APIs for looking up an address. It's possible that we need to adjust which API we are using, and/or how we are using it. I'm certainly open to suggestions on the best path forward! Feel free to hit me up on Discord if you want to get into the weeds about it. |
@lindseydiloreto Thanks for the explanation! As a first step, having a I could be wrong since I haven't used the Autofill API before, but looks like it does include place / feature names: https://docs.mapbox.com/mapbox-search-js/api/core/autofill/#addressautofillsuggestion The JS component that does the autofilling probably provides access to the underlying API result. So I think it should be possible to access that data in a hook and write it to the subfield, the same way you're writing the coordinates? If that is not possible, maybe use the underlying core component so you have full access over the API result? As an alternative, have you considered the Search Box API? Looks like it has similar features, except the automatic autofill based on the |
I agree that, at the very least, the Mapbox plugin should have subfield parity with the Google Maps plugin. We can start by adding all remaining subfields in a neutral, non-automated state. This has the added benefit of making the data more portable between the two plugins. Once Mapbox has all remaining subfields, we can circle back on the API decisions. Switching to the Search Box API may be the correct answer. |
@lindseydiloreto Sounds good, thanks! |
This is done. It took a bit of work, but I've swapped out the Autofill API for the much more flexible Search Box API. Once that was done, it was straightforward to add all remaining subfields for parity with the Google Maps plugin. It also clears a path to more easily handle #7. It may be a few more weeks before these changes are pushed live, but you can grab it now from the "doublesecretagency/craft-mapbox": "dev-v1-dev" Important Note:In order to add the "Name" subfield, you will need to resave each of your existing Address fields. By default, the new subfields will not appear until you add them to the Address configuration. This also gives you the opportunity to select which subfield(s) will trigger the autocomplete results. |
@lindseydiloreto Awesome, thank you 🚀 |
@MoritzLost Ok fantastic, thanks for reporting back! Glad to hear it feels like a huge improvement (I totally agree)! 👏 |
Great news, v1.1 has been officially released with these changes. Thanks for the feature request! 🎉 Address fields now includes the following new subfields...
Fun side note... we also added a mechanism to transfer your Address data from the Google Maps plugin. 😉 |
Great news indeed, thank you @lindseydiloreto! 🙏 |
The Google Maps Plugin has a dedicated
name
field where you can input location names, city names without providing a street name etc.We would like to switch from Google Maps to Mapbox because the API key handling is much more straightforward, especially when working with clients. However, the geocoding autocomplete feature currently only works with street names, not with full addresses and location names – this option is very important for us.
Is there a reason why the Mapbox Plugin comes without the name field or are we missing something?
Thank you!
The text was updated successfully, but these errors were encountered: