Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cluster issue by adding more configuration options. #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions application/libraries/Googlemaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class Googlemaps {
var $center = "37.4419, -122.1419"; // Sets the default center location (lat/long co-ordinate or address) of the map. If defaulting to the users location set to "auto"
var $class = ''; // A class name if wishing to style the map further through CSS. Can also be useful if wanting it to be responsive etc.
var $cluster = FALSE; // Whether to cluster markers
var $clusterGridSize = 60; // The grid size of a cluster in pixels
var $clusterLibrary = ''; // The cluster library to use.
var $clusterImagePath = ''; // Override for cluster image path.
var $clusterGridSize = 60; // The grid size of a cluster in pixels
var $clusterMaxZoom = ''; // The maximum zoom level that a marker can be part of a cluster
var $clusterZoomOnClick = TRUE; // Whether the default behaviour of clicking on a cluster is to zoom into it
var $clusterAverageCenter = FALSE; // Whether the center of each cluster should be the average of all markers in the cluster
Expand Down Expand Up @@ -1139,9 +1141,17 @@ function create_map()
<script type="text/javascript" src="'.$apiLocation.'"></script>';
}

if ($this->cluster) { $this->output_js .= '
<script type="text/javascript" src="' . ( ($this->https) ? 'https' : 'http' ) . '://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer_compiled.js"></script>
'; }
if ($this->cluster) {
if ($this->clusterLibrary) {
$this->output_js .= '
<script type="text/javascript" src="' . $this->clusterLibrary . '"></script>
';
} else {
$this->output_js .= '
<script type="text/javascript" src="' . (($this->https) ? 'https' : 'http') . '://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer_compiled.js"></script>
';
}
}
}
if ($this->jsfile=="") {
$this->output_js .= '
Expand Down Expand Up @@ -1849,6 +1859,8 @@ function create_map()
$this->output_js_contents .= '
var clusterOptions = {
gridSize: '.$this->clusterGridSize;
if ($this->clusterImagePath != "") { $this->output_js_contents .= ',
imagePath: \'' . $this->clusterImagePath . '\''; }
if ($this->clusterMaxZoom!="") { $this->output_js_contents .= ',
maxZoom: '.$this->clusterMaxZoom; }
if (!$this->clusterZoomOnClick) { $this->output_js_contents .= ',
Expand Down