Open Street Maps OSM Isn't Autopopulating Fields
Support › MB Geolocation › Open Street Maps OSM Isn't Autopopulating Fields
- This topic has 11 replies, 3 voices, and was last updated 1 year, 10 months ago by
pluginoven.
-
AuthorPosts
-
April 10, 2023 at 1:17 AM #41401
digisavvy
ParticipantHey there,
I'm trying to use MB Geolocation to add location data to a custom post type.MB Geolocation when used with Open Streetmaps does not work. The address field works and will autopopulate just fine. However my other fields for city, state, etc., do not populate their information.
To test, I tried with Google Maps info and went through the set up and that all works fine. Everything autopopulates in addition to the address field autopopulating.
I'm not using code here, just trying to integrate data into bricks builder.
Video explainer
https://watch.screencastify.com/v/gcnnCDJuzmqJQ41lhVpbApril 10, 2023 at 7:35 PM #41407Peter
ModeratorHello,
Please open the Console tab in Inspect tool of the browser and see if there is any JS error. You can also try to deactivate all plugins except Meta Box, MB extensions and switch to a standard theme of WordPress then check this issue again.
April 11, 2023 at 1:38 AM #41417digisavvy
ParticipantHi there,
I did that and I didn't notice any errors still. https://watch.screencastify.com/v/XjbnyJE5PD8DXxhwvxyx - I did switch to 2023 and deactivated plugins except mb related.
April 11, 2023 at 6:47 PM #41429Peter
ModeratorHello,
Can you please recheck the issue on a clean installation of WordPress and Meta Box? I do not see that issue on my demo site. If it still does not work, please share your site credentials via this contact form https://metabox.io/contact/, I will take a closer look.
April 12, 2023 at 1:45 AM #41443digisavvy
ParticipantI did this and still having the same issue. I submitted a contact form to ask for help.
April 12, 2023 at 10:27 PM #41464Peter
ModeratorHello,
I got the issue. The address field must have the ID
address
or something withaddress
prefix likeaddress_something
oraddress_1234
.Please read more here https://docs.metabox.io/extensions/meta-box-geolocation/#address-field
April 13, 2023 at 4:02 AM #41469digisavvy
ParticipantHmm, I think you might be referreing to Google Maps and Not OSM. I can get Google Maps Geolocation to work just fine. That is not the problem. Open Street Maps does NOT work properly. The documentation you're referring to only applies to Google Maps/Location, what you're directing me to do is for the wrong thing basically.
Address field
The address field is used to retrieve the suggestions from the Geolocation API. To add an address field, add a text field with an ID that starts with address (like address or address_something)...This issue is still open
April 13, 2023 at 4:02 AM #41470digisavvy
ParticipantFor Open Street Maps you must use 'building' not 'address' per your docs.
April 13, 2023 at 4:05 AM #41471digisavvy
ParticipantThe docs for Geolocation are, for me, pretty confusion. I think the docs should be split up in a way that it's clear which part is for Google Config and for OSM config. I'm happy to update that doc once this issue is resolved.
April 16, 2023 at 9:19 PM #41507Peter
ModeratorHello,
The different fields between Google Map and Open Street Map are listed in the section "Other Fields". Both map should use the address field with the ID
address
or something withaddress
prefix likeaddress_something
oraddress_1234
. I've changed the field ID to address and the address fields are populated properly, screenshot https://monosnap.com/file/K7RQ7lMeGQSbWP1ySdj0UighcIQuytJune 9, 2023 at 7:25 PM #42137pluginoven
ParticipantI totally agree with @digisavvy that the documentation is for Geolocation is confusing. Extremely helpful would be a code example of how Google version with binding is structured and a separate code example for the OSM variant with binding.
Of note: the animated demo of this extension shows the Google version, but the OSM version requires that an OSM map be included in the field group.
June 9, 2023 at 7:42 PM #42138pluginoven
ParticipantAh ha! It's only under the 'Multiple addresses' section that some hint is provided:
'address_field' => 'address_id'
So a simplified OSM example would look like this:
$meta_boxes[] = [ 'id' => 'private_details_box', 'title' => 'Private Address', 'type' => 'user', 'geo' => true, // include the geo API 'context' => 'normal', 'priority' => 'high', 'fields' => [ [ 'type' => 'osm', 'name' => 'The Required OSM Map', 'address_field' => 'private_address' // tell the map which field to use ], [ 'type' => 'text', 'name' => 'Private Address', 'id' => 'private_address', // does NOT need to start with address ], [ 'type' => 'text', 'name' => 'Street Address', 'id' => 'private_street_address', 'attributes' => [ 'binding' => 'streetaddress', 'required' => true, ], ], [ 'type' => 'number', 'name' => 'Postal Code', 'id' => 'private_postal_code', 'attributes' => [ 'required' => true, 'binding' => 'postcode' ], ], ] ];
-
AuthorPosts
- You must be logged in to reply to this topic.