Feature request: Map Looper

Now that Loopers are back in the focus, I thought I could mention another common requirement, when it comes to location listing websites.

We already have a great Map element. It displays a single location and it works great. With some extra code, we can split lat and lng from the ACF Map field, and use it as a source for the map element. It would be great if we could have native custom meta fields for lat and lng, separately extracted from the ACF map field, but that is not the topic now. :slight_smile:

The true power would be if we could feed a post type to the Map element. It could read either a single comma-separated lat, long custom field, or it could use the ACF Google Map field as a data source. Or it could read two separate fields for latitude and longitude.

Here’s how the FacetWP Map facet is working. That’s exactly how the Map looper could work.

When a single comma-separated field is used, or when ACF Google Map field is used, then there is no need for the Longitude field. If, however the user wants to provide two separated fields for lat and lng, then the optional longitude data source can be entered.

image

The result would be a map displaying all the locations from the looped post type. We could then filter them further based on listing categories, etc. Of course, we could also utilize fully customizable Map markers containing dynamic data. It would be great if Markers could accept Pro elements and if the marker icons could be changed.

In essence, Pro would then be fully equipped to build listing websites, without the need for external listing plugins.

2 Likes

Amazing, would be a fantastic enhancement.

1 Like

Would love to start here by just adding in looper support for the maps themselves, as that’s pretty quick. Something I just never got around to in 6.3. We will see this in 6.4

When I hear comma-separated it makes me think our 6.4.0 CSV looper could handle some of this. Although I will have to check how the actual longitude fields work. There’s a number of ACF fields that just don’t have CS support so would love to work on those. Then from there we could add some Presets or Templates to help integrate an ACF Google Map. Thanks for the thoughts!

2 Likes

Something I would love to see is support for other providers than google maps with the ability to add pins.
For example using Open Street Maps (OSM) or some self hosted ones would allow the map view without any access key, Perhaps the best way to implement this would be to allow custom control to add attribution and raster tileURL. (eg Provider: Google / Custom)

Also, support for polygons, eg: the Geojson standard for geometry in looper plotting would really help build apps that take apps that depend on maps. Geojson geometry can be either coordinates, polygon, multipolygon, linestring etc. and they are drawn together.

3 Likes

Popping in here because Miro linked this from FB , and maybe there’s a better place for the idea, but one thing that would be helpful here and in many other places is to allow DC tags to specify specific values in a referenced array.

In the case of an ACF map field, the return is an array of which lat and lng are included. If there was some way to tell the map marker fields to pull those values out that might address this.

It would also make working with ACF repeaters and other fields that return arrays very flexible.

I don’t have enough knowledge of the inner functions of the looper code to know if it’s even possible but it would simplify a few other corner cases I’ve run into as well.

Just a thought.

1 Like

Thanks for the input. I actually thought you could grab from any objects key, but I was wrong. I’m going to change this eventually so you can and it would look similar to the below. Using type="object" and then the key to grab a key in the ACF return. Which includes things like address, lat and lng.

{{dc:acf:post_field field="map" type="object" key="address"}}