Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Mappable module and clusterer

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 681 Views
  • wmk
    Avatar
    Community Member
    45 Posts

    Mappable module and clusterer Link to this post

    Hi,

    i just played around with uncle cheese's Mappable module - it's a great time saver. But trying to activate the clusterer i get a javascript error:

    marker.getLatLng is not a function

    I downloaded the code for markercluster.js and activated it via

    $gmap->setClusterer(true, 100, 9, '/mysite/javascript/markerclusterer.js');

    Any hints?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Mappable module and clusterer Link to this post

    I might try removing the leading slash for one.. not sure if that will path right. Second, you might not be using the right clustered script. The one that I'm using is here: [REMOVED]

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

  • cumquat
    Avatar
    Community Member
    198 Posts

    Re: Mappable module and clusterer Link to this post

    Hi there guys,

    can i ask how you are implementing the cluster function please.

    It's something i would like to do, just not sure how to go about it. I got the mappable module working with help form UC and this will be my next step as i have quite a few clusters of markers in various towns and villages.

    Regards

    Mick

  • UncleCheese
    Avatar
    4085 Posts

    Re: Mappable module and clusterer Link to this post

    You need to download the script in this thread and place it in your javascript dir, then just run the function you see above in cumquat's post..

    $map = $yourDataObjectSet->GoogleMap($width, $height);
    $map->setClusterer(true, 100, 9, 'path/to/clusterer.js');

    I forget what all those arguments are.. you can look in the API to see what those are. I think the 9 is the zoom..

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

  • cumquat
    Avatar
    Community Member
    198 Posts

    Re: Mappable module and clusterer Link to this post

    Hi ya,

    Cheers for that, dumb question time,

    Currently i run it with a very simple function that just brings back all the hospitals and police stations in a table with the code below,

    public function Hospitals() {
          
          return DataObject::get("HospitalEx");
          
    }

    and then on my template page i just have

       $Hospitals.GoogleMap

    and that works great, but i'm just not sure where to slip in the

    $map->setClusterer(true, 100, 9, 'path/to/clusterer.js');


    i've set the default size of the map in _config file with

    GoogleMapUtil::set_map_size(980, 500);

    Sorry if this is obvious to everyone else.

    cheers

    mick

  • cumquat
    Avatar
    Community Member
    198 Posts

    Re: Mappable module and clusterer Link to this post

    Ok I'm further forward but i'm getting the same error as WMK

    Error: a.getLatLng is not a function
    Source File: http://awebsiteaddress/mysite/javascript/markerclusterer_packed.js
    Line: 1


    I'm using the file that UC linked to.

    WMK did you get it working?

    my current function is,

    public function Hosp() {
       $HospitalEx = DataObject::get("HospitalEx");
       $map = $HospitalEx->GoogleMap(980, 600);
       $map->setClusterer(true, 100, 9, 'mysite/javascript/markerclusterer_packed.js');
       return $map;
       }

    Mick

  • UncleCheese
    Avatar
    4085 Posts

    Re: Mappable module and clusterer Link to this post

    Hi, guys,

    I've fixed this in the latest commit. The clusterer.js is now included with the module, and that bug has been fixed. Just use $map->setClusterer(true);

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

  • cumquat
    Avatar
    Community Member
    198 Posts

    Re: Mappable module and clusterer Link to this post

    Bloody marvellous,

    cheers for that it all works and everything :o)

    Mick.

    681 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.