Skip Navigation

[Closed] Losing Posts when using Toolset Maps Distance Filter

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Christian Cox 4 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1595901

Tell us what you are trying to do?
I am having an issue where posts are not being rendered to the page when the distance filter is applied to a view.

Is there any documentation that you are following?
I am not seeing any documentation that is very relevant.

Is there a similar example that we can see?
I have setup /find-provider/ which has the distance filter enabled.
I have also set up /find-provider-no-filter/ which has the distance filter disabled.
You should see that there are 250+ posts that do not appear while the distance filter is active.

What is the link to your site?
hidden link

#1596135

Hello, do the missing posts have values in the address field? If not, then the distance filter will skip those items. Similarly, if you filter or order by any custom field and a post does not have a value in that custom field, it will not be found in the results.

#1597609

The address field will not work for us in this situation.
We can't import any data directly into the address field as it is not supported in the Toolset importer. And we will be relying on imports to get data into the site.

What we have been doing is importing the address in chunks, below I have included the address we are giving the markers.

address="[wpv-post-field name='acf_fac_name'],[wpv-post-field name='acf_fac_address'],[wpv-post-field name='acf_fac_city'],[wpv-post-field name='acf_fac_zip']"

This works the majority of the time which can be seen by the 2000+ posts that make it through the filter, but I need to know what is causing the other 250 posts to not pass through the filter. Based on the distance I have set in the filter, 250 miles, the filter should include the missing posts.

#1598017

Okay I see, thanks for the additional information. I'm not quite clear how you have the distance Query Filter configured if there is no single address field, so I have some additional questions:
- Edit this View and open up the Query Filter panels. Take a screenshot or screenshots so I can see how these are configured. Is there any custom code adjusting these filters with PHP? If so, please include that here for me to review.
- Go to Toolset > Settings > Maps tab and click "Check API". Let me know the final response. Are you using 2 separate keys, or only 1?
- Check the Google Developers console for any "over the limit" API messages or something similar for this API Key(s).
- Copy + paste in your next reply the individual address component custom field values of one of the posts that is missing from the filter. I was unable to hit the /find-provider-no-filter URL to try to figure this out this myself.
- In Toolset > Settings > Maps, click "Load stored data." Are any addresses cached? If so, is the address of the missing post cached?

#1598157

Alright, I have attached the screenshot of the distance filter below.

My API key is not reporting any issues when I click Check API.

I am not familiar with the Google Developer Console. How would I access this?

My apologizes for the faulty url. I have corrected the url /find-provider-no-filter/ should work now.

I can see the address of the post I am using as a base line.

#1598159
Distance Filter.png

Sorry , had an issue with the page and my screenshot was no longer attached to the previous post. I have attached it to this one.

#1598179

Alright, I have attached the screenshot of the distance filter below.
Okay so there is an address field. How is value being set? You mentioned that the address components are used to display the map marker, but I'm not clear how or even if the address field "Facility Address" is set in these posts. The distance filter will make its calculations based on this field value and its cached geocoded location, not whatever address you put in the shortcode to display a map marker. Maybe it would be helpful for me to log in and see how everything is configured in wp-admin?

My API key is not reporting any issues when I click Check API.
Ok great, thank you.

I am not familiar with the Google Developer Console. How would I access this?
I'm referring to the API console here: @https://console.cloud.google.com/
You can select your project up at the top, then maybe Billing > Overview or Billing > Reports? If you're experiencing data limit restrictions, it will probably be obvious on the main project dashboard, but I'm not 100% sure. I think if you got all clear when you clicked "Check API", you're probably okay.

I can see the address of the post I am using as a base line.
You mean in the maps cache, right? So the missing post address is cached, but it does not appear in the results of the View, correct?

I think it would be faster for me to log in to your wp-admin area and take a closer look, if that's okay with you. Please provide login credentials in the private reply fields here.

#1601849

Okay so facility_address, the field you are using as the basis for the distance query filter, is not a Types address field. It is currently being managed by Types, but from what I can tell it is not created in Types and is not part of a Types field group. That's the main problem here. You must use an address field created in Types as the basis for a distance filter calculation in Views. Address field data from an address field created by Types has been validated by the Google Maps API and has been geocoded for distance calculations. Importing external data into an address field is inherently risky since it has not been validated by the Google Maps API and cannot be guaranteed as a mappable address. Some people try to get around this by importing their address information directly into the database using update_post_meta or something similar when importing address information from an external source. Then they plot that imported address information as a marker on a map View without using any distance filter. This triggers a geocoding event for those new addresses, which will hit the Google Maps API, attempt to geocode that address, and if successful, cache any new address's geocoded data for future distance calculations. If the address information was perfect, this workaround will allow them to use these imported addresses successfully in distance calculations. However, since the addresses being imported have not been validated by the Maps API, they are not guaranteed to be perfect and cannot be guaranteed to be mappable. Some addresses may fail, and cannot be mapped. Those will never be included in a distance filter search.

The topic ‘[Closed] Losing Posts when using Toolset Maps Distance Filter’ is closed to new replies.