help needed with geocoder display issue

By Dave - July 22, 2017

Hi WillyDoIt, 

Hmm, that's an interesting problem.  What about something like this: 
https://github.com/jawj/OverlappingMarkerSpiderfier

Demo page: https://jawj.github.io/OverlappingMarkerSpiderfier/demo-1.html

If you think that would work I could see if we could create some demo code.

Dave Edis - Senior Developer
interactivetools.com

By Twocans - July 23, 2017

This looks very very interesting.

Kenny

By willydoit - July 23, 2017 - edited: July 23, 2017

Hi Dave,

This looks as though it would resolve the issue, how would we implement it? i am sure this would help out a lot of geocode users.

My only concern is that on the demo, once you zoom in they dont seem to have pins that have the same postcode which is my issue.  perhaps another solution would be to have a secondary field with an accurate lat and long and have the display code use something like if field "accurate lat" exists use that to display pin else use geocode created lat and long although this would create a lot more admin work.

By Dave - July 28, 2017

Hi willydoit, 

First, upload the attached file ("sample_map_multi_spiderfier.php") to /cmsb/plugins/geocoder/examples/ (or the appropriate path on your server).

Try this, at the top of your geocoder.php plugin, add this line in red: 

$GLOBALS['GEOCODER_EXAMPLES']         = array( // these are in /plugins/geocoder/examples
  'sample_form.php'                 => 'Sample form with automatic geocoding',
  'sample_search.php'               => 'Proximity search with results sorted by distance',
  'sample_map_single.php'           => 'Show map with single address',
  'sample_map_multi.php'            => 'Show map with multiple addresses',
  'sample_map_multi_spiderfier.php' => 'Show map with multiple addresses (and OverlappingMarkerSpiderfier)',
);

Then confirm if it works in the examples section: admin.php?_pluginName=geocoder&_pluginAction=examples

Next, copy the example source and adjust it to load your records.

Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com

By willydoit - July 29, 2017 - edited: July 29, 2017

Hi Dave,

havent a clue what any of the code does that I had to copy and paste but it works a treat, straight out of the box! a great addition to the geocoder plugin.

One thing I would ask is whether there is any way to make the displayed map responsive?

Thanks.

By Dave - August 1, 2017

Hi willydoit, 

Great, glad it's working.  One feature I added after I posted was this option in red: 

  // Overlapping Marker Spiderfier - https://github.com/jawj/OverlappingMarkerSpiderfier
  var oms = new OverlappingMarkerSpiderfier(map, {
    markersWontMove:   true,
    markersWontHide:   true,
    basicFormatEvents: true,
    keepSpiderfied:    true
  });

What it does is keep the "spiderfied" markers open until you click somewhere else on the map so it's easier to click through them.

One thing I would ask is whether there is any way to make the displayed map responsive?

I've never done it but I'm sure it's possible.  What I'd recommend is scanning through some of these google results and see if you can find a relatively simple solution.  It looks like it's possible with some CSS.  If you find something that works well let us know.  https://www.google.ca/search?q=google+maps+responsive

Dave Edis - Senior Developer
interactivetools.com