Hello,
I think the title says it all: we'd like to use toolset as a replacement to Geo My WP (Toolset Maps), however, the issue is that we saw that the toolset maps plugin does not store lat and long fields in the database. Is this possible somehow? We have a custom developed API which would use these field to display the products on our custom developed map.
Hello and thank you for contacting the Toolset support.
Toolset Maps does not store the latitude and longitude in the postmeta table. The latitude and longitude are stored in a Toolset cache table to leverage distance search using MySQL geo features.
Unfortunately, we do not offer a proper API to let you reuse the coordinates. You will need to perform another request to the MAPs API(Google or Azure) and store the latitude-longitude in a custom field.
hidden link
I hope this answers your question. Let me know if you have any questions.
Hello.
Thank you for the quick reply. Could you please assist us in this issue a bit further? Is this possible to do without custom development (does Toolset offer such custom fields)?
Another question is - is it possible to integrate this plugin with Geo My WP, for example? The address field could fill out GMWP's address field as well, and that stores the lat/long in the database.
Also, just to be clear: Toolset makes the request only when the Address is set for the post type, and not every time a user uses the map, right? Just asking, because we have more than 50k users and it would be really expensive if it did that.
Indeed, Toolset queries Google or Azure Maps, only one time. Then it stores the coordinates in the cache table. This ensures that the website does not exceed the rate limit for the Maps API. In fact, Toolset will not perform more than 10 requests per minute.
I am sure, Toolset Maps can be integrated with GMWP. But it will require custom code. There is no integration out of the box.
Toolset stores the clear address as a string in the Address custom field. The coordinates are always stores in the cache table.
You will need to add custom code, hooked to the post's save action, and check if the post has already the coordinates or query the Maps API for it and store it in a custom field.
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
- https://developer.wordpress.org/reference/hooks/save_post/
Please note that custom code is out of the scope of the Toolset support. If you are not familiar with programming, consider hiring a developer. Check the list of our partners here https://toolset.com/contractors/
Hello Jamal,
Thank you for your answer, we figured out what we'll do 🙂
Kind regards,
Botond
Hello,
I just found out another solution that would not need any calls to MAPS API and I would like to share it here, for you and for other users. My apologies for missing it in the first time.
Well, it will still need custom code. However, this time you won't need to call the Maps APIs because the data is already stored on the Toolset database. You can use the format argument in the types_render_field function or the types shortcode. Read more about it here https://toolset.com/documentation/customizing-sites-using-php/functions/#address
All the best,
Jamal