Support Forum
Support › Meta Box Geolocation › Making OSM map invisible? Pin location updates address? Address field behaviour?
Hi there! I read how to make your geolocation extension work using OSM here: https://docs.metabox.io/extensions/meta-box-geolocation/ (I think it's less confusing if you split up the google maps from osm maps documentation :))
I have three questions which I think many users who use the geolocation extension with osm will have.
1) I know the OSM map is necessary to use the autocomplete function but is it possible to not show the map itself? I don't need to show it on either the admin back-end when editing the post type that my custom field group is applied to, and I also don't want it to load on the front-end for user submission forms. I just need the address autocomplete. Can meta box be configured in such a way that the osm map itself is not shown, or made insivible? Thanks.
2) This is especially important since for front-end user submissions, the user interaction is very confusing. The map is there, and the pin can be relocated, but the address will then not update to the new pin location. The only alternative is that changing the pin location does update the address, but it is currently impossible to do according to the documentation. Will this be possible in the future? The extension hasn't had an update in over an half a year, please consider in the next update?
3) Right now I have to enter an address in a text field type with a ID that starts with 'address'. When I start to type an address there, autocomplete suggestions will be given. Nice. However, this single address text field will now contain all of the address components. Is it possible to make this text field behave so that after clicking on a autocomplete suggestion, it keeps only some selected address components? Adding something like
binding = road + " " + house_number
does not change this behaviour: an additional text field type is needed with the special binding, but the text field type with ID 'address' will always be necessary. This is also not so friendly for the front-end user: they will always see the full address, with all of its components and then text field types with some selected bindings, which they can then change... . Is there any chance you will address this issue, too?
Hello John,
Thanks for reaching out.
1. Currently, you have to add the OSM field to the field group to use the Geolocation feature. It is noted in the documentation https://docs.metabox.io/extensions/meta-box-geolocation/
If you don't want to display the map field, you can add a custom class to the field and create some custom CSS code to hide it.
2. This is also noted in the documentation https://docs.metabox.io/extensions/meta-box-geolocation/#two-way-data-binding
when you change the pin on the map, the latitude and longitude will be changed/updated, not the address. I think that is expected because we don't have addresses for every point/pin on a map such as in a forest, sea, desert ...
3. I'm afraid it isn't possible. The address text field is the returned result from OSM/Google API; we just fill it with the returned result. Other address components are extracted from the address field.
Dear Peter,
Firstly thank you for being here on the support forum. Without all the things I learned here from you I would have struggled so much.
Then, in response:
1) Adding a custom class to hide it through CSS sounds like a smart idea. I will try that in the future!
2) You are right - some places don't have addresses. To reduce confusion for users, perhaps you can think about adding a feature in the future to disallow changing the pin? With this option people would be able to only change pin location through entering in an address in the field with the 'address' ID.
3) Thanks for clarifying this. It is good to know I didn't miss anything here.
Thanks so much!
John