Toolset Maps is a WordPress plugin that allows you to add address fields to any content type or users and display any content on Google Maps.
Toolset Maps User Guides include detailed documentation for creating these special address fields, adding pointers to them and displaying them on maps.
When you ask for help or report issues, make sure to tell us the versions of the Toolset plugins that you have installed and activated.
The customer was trying to create a search functionality on their website that displayed locations based on a user's input. They had built a view that showed locations within 50 miles of the user and created a nested view to display results within 350 miles if no results were found within the initial range. However, the nested view did not trigger correctly based on the user’s input, leading to issues in displaying the appropriate results.
Solution:
We confirmed the customer's setup and created a working example to demonstrate how to achieve the desired functionality. We provided guidance on setting up the main view and the nested view using the URL parameter toolset_maps_distance_center for filtering. We also suggested moving the map markers from the block directly into the content template to ensure that the markers would rebuild when the nested view was called.
Although the customer inquired about displaying the distance from each result to the user's location, we noted that this feature was under consideration for future versions of Toolset. However, a straightforward solution was not readily available.
After implementing the changes we suggested, the customer confirmed that the nested view was functioning as expected, effectively displaying the relevant markers on the map.
The customer reported that markers on their map view were not showing up. Clusters appeared, but clicking on them did not display individual markers. The issue occurred without any recent changes made by the customer. Console errors were present on the production site.
Solution:
The customer created a staging site where the markers displayed correctly, and the console errors were resolved. After further investigation, the customer discovered that a plugin compressing and converting images was causing the custom marker images not to display properly.
Problem:
The customer wants to add shapes to a map rendered by Toolset. They have geoCoordinates and wish to use the Google Maps addJSON feature but encounter difficulties because the map is already rendered by the time they can access it with JavaScript.
Solution:
I recommended using the js_event_wpv_addon_maps_init_map_completed event listener to run scripts when the map is rendered. An example was provided to adapt for adding a background color to a map area after rendering.
Upon trying the provided code, the customer encountered errors in the JS console and the shapes did not render as expected. Further investigation and temporary site access were requested to diagnose and resolve the issue. However, the customer was able to move forward with the original reference and resolved their issue.
Problem:
Resize PNG and SVG markers for a better quality. On mobile view, the PNG marker is displayed pixelated. Solution:
I checked it and the SVG markers are always resized to 32x32
There's a workaround to avoid it. You'll find the code line that controls this at line #565, in the file: "/toolset-maps/resources/js/wpv_addon_maps.js":
var scaledSize = new google.maps.Size(32, 32);
You could change the size value in the actual plugin file if needed, but since this part of code is not filterable, it is not possible to change it with a hook for example, you'd have to edit the file itself. ( please note that you'll need to keep track of this edit, as future plugin updates will overwrite any changes )
I also checked that PNG files are shown in the map with the same size they've been uploaded, it is necessary to work with the image and upload the final version to use it.
Problem:
Can Latitude/ Longitude be used dynamically for maps Solution:
Is this data coming from a specific CPT, you can try these steps:
1. Use a known address at first, and save it for your post. For example, "Paris France".
2. Edit the post, and scroll down to the address field. Click Show Coordinates, and update these fields with your desired coordinates. You may have to delete the content before pasting your own in, it's a bit tricky but it should work. Click the map to refresh it and confirm your coordinates, then save.
3. Now your address field will display as the Lat and Lng coordinates, and the map marker will use these new coordinates.
4. If you need to use the written address in a View, you'll need to include that as a separate custom field, or as the title of the post, etc. If it's a separate custom field, then you can use conditional logic easily to determine when to show the address field, and when to show the lat/long override field.
If you still have issues after this procedure, please open a ticket so we can analyze it.