I need to make a SQL statement to retrieve for each "Video" CPT the address field and especially the GEOMETRY POINT related to each address field in the CPT.
I've seen that the wp_toolset_maps_address_cache stored the point and that it has this address_passed as primary key but I do not know where is this PRIMARY key refered in my main related CPT.
Can you help ?
Is there any documentation that you are following?
No
Hello. Thank you for contacting the Toolset support.
I would like to inform you that Toolset stores the Map address field as address string to postmeta table. So, if you want to get an actual address assigned to your video CTP, you need to run a normal WP_Query with post meta argument.
For example:
//later in the request
$args = array(
'post_type' => 'video ', //or a post type of your choosing
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'wpcf-address-field',
'compare' => 'EXISTS'
)
)
);
$query = new WP_Query($args);
Where:
- You need to replace wpcf-address-field with your actual address field slug.
Using above query you will get all posts where the address field value is assigned.
We do not store the GEOMETRY POINT (lat,lon) values to post meta table, so you need to query the table wp_toolset_maps_address_cache and match the address field value from postmeta with column address-passed value of wp_toolset_maps_address_cache which holds the point (lat,lon) values.
However, this may need custom programming which is beyond the scope of our support policy. You may consider hiring a pro professional using the following contractor's list: https://toolset.com/contractors/