Generating multiple maps on multi record page

Looking for a way to create separate maps for a listing page. Each record would have it's own map with clickable marker on it. I have the geocoder plugin, but the example code is for displaying one map on a single page or multiple pins on one map. If anyone has an example, it would be greatly appreciated.

Hi Dave. The plugin allows us to generate one map with multiple pins from a list or records. What I'm trying to load is individual maps for a list of records on a single page. Does that make sense?

By hans - October 28, 2020 - edited: October 28, 2020

Hello there! I will be the one helping you in this issue. Feel free to message if you have any questions afterwards!

The way the method was programmed, only one map was generated by the method. I modified it so that you can add as many maps as you want. 

I have uploaded a replacement of the sample_map_single.php file below. Simply replace the file located at your plugins/geocoder_{version} folder named sample_map_single.php and view it in the Plugins.

jQuery_element_to_append_the_map_to = $("#maps_container");

map = initializeMap({latitude: latitude, longitude: longitude}, jQuery_element_to_append_the_map_to);

You will need jQuery for this.

The parameters are as follows: 

function initializeMap( object properties = {} [, jQuery_element_to_append_to ]){}

under the first parameter properties, there is a required latitude and longitude property, where it contains a latitude, and longitude respectively. It will return a value of the map, and the map's properties.

Hans Marcon
PHP Programmer (In Training)
interactivetools.com
Attachments:

sample_map_single.php 4K

Thanks so much Hans! It worked perfectly. Appreciate the help.

By Codee - October 31, 2020

Hey 28sparks, when you get it done live would you provide a link so we can view it in action?