When you insert a Toolset map, you can filter markers or order them by distance. You can also calculate the distance between two given points.
When displaying multiple markers on a map, you can add front-end controls that allow visitors to filter the markers by distance. They enter the location and a distance radius within which to display markers. If your site is using HTTPS protocol, visitors can also use their own location as the center of the search. For example, on a real estate site, they could use this filter to display only property listings that are in a 50-kilometer radius from New York.
The best thing about the Distance filter is that it can be combined with any other Toolset filter. For example, you can allow visitors to display only properties that can be rented (and are not for sale) and are in a 50-kilometer radius from New York. Scroll to the Filter Editor section, click on the New filter button and in the dialog that appears, click the Distance button. A dialog with all the options for your distance filter appears. It allows you to customize the default radius, change labels for displayed controls and more.
One of the important options for a Distance filter is the Comparison field. The filter uses a custom field selected under this option to get the location of each marker. Currently, this custom field needs to be of the Address type. In other words, the posts you are displaying must feature a custom Address field. You can also choose between displaying results that are Inside of radius or Outside of radius. In order to use option, Distance center is set from user location your website must use HTTPS. If this option is selected user’s current location will be used as a center point for filter radius. If you are using Distance filter as part of a custom search you can use it to allow users to search posts using map distance. If you are combining this filter with other filters be sure to set Should distance center input be required value to No.
If you want to calculate the distance between two given points, insert the Fields and Text block. Next, click the Fields and Views button and then the Distance value button. In the dialog enter the desired values in corresponding fields.
Create custom lists of posts
- Installing Toolset Maps and Adding Address Fields
- Displaying a Simple Map
- Displaying a Map on A Single Post Template
- Displaying a List of Posts on A Map
- Using custom styles for maps
- Show all related topics...
- Creating an API Key for Using Google and Azure Maps
- How to Use Google Maps API from China
- Data Caching For Maps Addresses