Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jesusr/data-layer-clusterer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Connum/data-layer-clusterer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Sep 28, 2016

  1. Copy the full SHA
    bf760ee View commit details
  2. fix errors being thrown due to the new .extend() notation for the opt…

    …ions introduced with commit 7e86e3a by jesusr (will have to look into this later...)
    Constantin Groß committed Sep 28, 2016
    Copy the full SHA
    4118eb5 View commit details
  3. features of type LineString are now working

    Constantin Groß committed Sep 28, 2016
    Copy the full SHA
    f52d049 View commit details
  4. Update bower.json

    Changed project homepage, description text and keywords
    Connum authored Sep 28, 2016
    Copy the full SHA
    3e0d6f1 View commit details
  5. added cluster marker images and newly created svg versions

    Constantin Groß committed Sep 28, 2016
    Copy the full SHA
    137363b View commit details
  6. minified marker svg versions

    Constantin Groß committed Sep 28, 2016
    Copy the full SHA
    ba80d93 View commit details
  7. new marker image path using rawgit CDN, uses SVG depending on feature…

    … detection
    Constantin Groß committed Sep 28, 2016
    Copy the full SHA
    6f4b39d View commit details
  8. new marker image path using rawgit CDN, uses SVG depending on feature…

    … detection
    Constantin Groß committed Sep 28, 2016
    Copy the full SHA
    400a073 View commit details
  9. removed TODO

    Constantin Groß committed Sep 28, 2016
    Copy the full SHA
    6fb3272 View commit details
  10. override addListener() inherited by google.maps.OverlayView

    Constantin Groß committed Sep 28, 2016
    Copy the full SHA
    3519994 View commit details

Commits on Sep 29, 2016

  1. style

    Constantin Groß committed Sep 29, 2016
    Copy the full SHA
    3381c49 View commit details
  2. clustering working for polygons as well

    Constantin Groß committed Sep 29, 2016
    Copy the full SHA
    5868b96 View commit details
  3. Copy the full SHA
    86fa57b View commit details
  4. Update README.md

    Added a description about the reasons for this fork and what has been changed so far.
    Connum authored Sep 29, 2016
    Copy the full SHA
    17f2e60 View commit details
  5. Update README.md

    added blog post URL
    Connum authored Sep 29, 2016
    Copy the full SHA
    1713add View commit details
  6. new option 'setProperty':

    Instead of changing the StyleOption attribute 'visible' of the features directly, a property 'in_cluster' is set on the features, which can then be used to toggle visibility, taking into account other properties (useful for additonal filtering, for example)
    Constantin Groß committed Sep 29, 2016
    Copy the full SHA
    b50b4e2 View commit details
  7. Update README.md

    added setProperty option description
    Connum authored Sep 29, 2016
    Copy the full SHA
    4f70884 View commit details
  8. make the property name 'in_cluster' configurable with the constant Da…

    …taLayerClusterer.CLUSTER_PROPERTY_NAME
    Constantin Groß committed Sep 29, 2016
    Copy the full SHA
    c1737ba View commit details
  9. Update README.md

    Connum authored Sep 29, 2016
    Copy the full SHA
    8fe39a5 View commit details

Commits on Sep 30, 2016

  1. fix: it was not possible to set setReady(false)

    Constantin Groß committed Sep 30, 2016
    Copy the full SHA
    4c16f58 View commit details
  2. Copy the full SHA
    1d8591f View commit details
  3. fix: if setProperty is true, ignore all markers that are hidden even …

    …if not in a cluster
    Constantin Groß committed Sep 30, 2016
    Copy the full SHA
    8aa83bf View commit details
  4. Copy the full SHA
    3b7d604 View commit details
  5. updated version to version in the jsdocs section (1.0.0) to make it d…

    …ifferent from the original repo
    Constantin Groß committed Sep 30, 2016
    Copy the full SHA
    6844fe3 View commit details
  6. new recolorSvg option

    Constantin Groß committed Sep 30, 2016
    Copy the full SHA
    1cdb097 View commit details
  7. fixed handling of recolorSVG option (could only be turned off by an e…

    …mpty string value before)
    Constantin Groß committed Sep 30, 2016
    Copy the full SHA
    a9af715 View commit details
  8. fixed case in recolorSVG option in the jsdocs

    Constantin Groß committed Sep 30, 2016
    Copy the full SHA
    dd75189 View commit details
  9. restructured initialization in order to prevent js erros when recolor…

    …SVG was used but the marker svg had not been loaded by the time the clusters were created
    Constantin Groß committed Sep 30, 2016
    Copy the full SHA
    2ef00e0 View commit details

Commits on Oct 1, 2016

  1. Update README.md

    Connum authored Oct 1, 2016
    Copy the full SHA
    b4c31fd View commit details
  2. Update README.md

    Connum authored Oct 1, 2016
    Copy the full SHA
    2590a17 View commit details

Commits on Oct 10, 2016

  1. new option minimumPolySize, updated package.json, increased version n…

    …umber to 1.0.1
    Constantin Groß committed Oct 10, 2016
    Copy the full SHA
    d826cf9 View commit details
  2. Update README.md

    Connum authored Oct 10, 2016
    Copy the full SHA
    0c6c03a View commit details
  3. Update README.md

    Connum authored Oct 10, 2016
    Copy the full SHA
    b5ef48c View commit details

Commits on Dec 27, 2016

  1. FeatureCluster.addFeature - Avoid doing twice the work

    Miguel Sainz Jr committed Dec 27, 2016
    Copy the full SHA
    7da81f6 View commit details
  2. Remove setStyle within init which did not allow our own setStyle

    Looks to have no negative effects...
    Miguel Sainz Jr committed Dec 27, 2016
    Copy the full SHA
    10da8be View commit details

Commits on Feb 3, 2017

  1. Merge pull request #1 from QueenCityCodeFactory/optimize-add-feature

    FeatureCluster.addFeature - Avoid doing twice the work
    Connum authored Feb 3, 2017
    Copy the full SHA
    de90f4a View commit details
  2. Merge pull request #2 from QueenCityCodeFactory/remove-init-style-ove…

    …rride
    
    Remove setStyle within init which did not allow our own setStyle
    Connum authored Feb 3, 2017
    Copy the full SHA
    9d33d3b View commit details
  3. coding style

    Constantin Groß committed Feb 3, 2017
    Copy the full SHA
    07f331b View commit details

Commits on Feb 24, 2017

  1. Copy the full SHA
    acda46b View commit details
  2. Copy the full SHA
    8884026 View commit details
  3. some minor performance improvement (prevents flickering): do not redr…

    …aw if neither bounding box nor zoom level has changed on idle or zoom_changed (for example, if zooming out beyond a specific zoom level has been disabled on the map)
    Connum committed Feb 24, 2017
    Copy the full SHA
    e792ca6 View commit details
Showing with 392 additions and 189 deletions.
  1. +21 −0 README.md
  2. +4 −3 bower.json
  3. BIN images/m1.png
  4. +1 −0 images/m1.svg
  5. BIN images/m2.png
  6. +1 −0 images/m2.svg
  7. BIN images/m3.png
  8. +1 −0 images/m3.svg
  9. BIN images/m4.png
  10. +1 −0 images/m4.svg
  11. BIN images/m5.png
  12. +1 −0 images/m5.svg
  13. +4 −3 package.json
  14. +358 −183 src/datalayerclusterer.js
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,27 @@ A Google Maps JavaScript API v3 library to create and manage per-zoom-level clus

Based on [Marker Clusterer – A Google Maps JavaScript API utility library](https://github.com/googlemaps/js-marker-clusterer) by Luke Mehe (Google Inc.).

You can find the minified JS file [in the releases tab](https://github.com/Connum/data-layer-clusterer/releases).

## About this fork

While working with the data layer feature was fun because of the simplicity of adding and getting map content via GeoJSON, I soon encountered the problem of too many markers, lines and polygons being displayed when zooming out of the map. I knew about the marker clusterer for normal layers, but it took me browsing through several StackOverflow posts and pages of search results to stumble upon nantunes' approach to data layers.

Seeing that there hadn't been any work done on the project for almost a year, I tried out jesusr's fork, which included some fixes/optimizations, but out-of-the-box it would just throw JS errors in the console. After forking it and getting it to work, I had to find out that just like the version in the initial repo, there was no support for LineStrings or Polygons, which I needed. Also, the URL to the cluster marker icons was no longer valid, so that had to be fixed as well, and so I did.

My current implementation now includes the following changes:
- Fixed cluster marker image URLs
- Added SVG versions of the marker images which will be used by default if supported by the browser and falls back to the PNG versions
- LineStrings and Polygons are being clustered as well, using the center point of their bounding rectangles
- new option 'setProperty': If set to true, instead of changing the StyleOption attribute 'visible' of the features directly, a boolean property 'in_cluster' (or a configurable property name defined in the constant DataLayerClusterer.CLUSTER_PROPERTY_NAME) is set on the features, which can then be used to toggle visibility (for example in order to take into account other properties for additonal filtering)
- new option 'recolorSvg': (string) only takes action if SVG is supported and being used: a selector string for an SVG element in the set imagePath that can be used for re-coloring the cluster marker image. This saves requests and prevents the different marker images popping up after loading.
- new option: 'minimumPolySize': (number) The minimum width or height of the bounding box of a feature (other than type 'Point') in pixels before it is forced into a cluster, even if the cluster ends up containing only this one feature. 0 or false to disable this functionality. Defaults to 50.

To read more and view a working example, see my blog post at www.constantinmedia.com/2016/09/google-maps-javascript-api-v3-handling-large-amounts-of-features-using-clustering-in-data-layers/

## More to come
- When LineStrings and Polygons are becoming too small according to the minimumPolySize option, display a marker instead for better visibility.

## License

Licensed under the Apache License, Version 2.0 (the "License");
7 changes: 4 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "data-layer-clusterer",
"version": "0.7.3",
"homepage": "https://github.com/nantunes/data-layer-clusterer",
"version": "1.0.1",
"homepage": "https://github.com/Connum/data-layer-clusterer",
"authors": [
"Nelson Antunes"
],
"description": "The library creates and manages per-zoom-level clusters large amounts of data layer features. Google API v3.",
"description": "The library creates and manages per-zoom-level clusters for large amounts of data layer features. Google API v3.",
"main": "src/datalayerclusterer.js",
"keywords": [
"google",
"maps",
"data",
"layer",
"features",
"marker",
"cluster",
"clusterer",
Binary file added images/m1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/m1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/m2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/m2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/m3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/m3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/m4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/m4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/m5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/m5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "data-layer-clusterer",
"version": "0.7.3",
"homepage": "https://github.com/nantunes/data-layer-clusterer",
"version": "1.0.1",
"homepage": "https://github.com/Connum/data-layer-clusterer",
"authors": [
"Nelson Antunes"
],
"description": "The library creates and manages per-zoom-level clusters large amounts of data layer features. Google API v3.",
"description": "The library creates and manages per-zoom-level clusters for large amounts of data layer features. Google API v3.",
"main": "src/datalayerclusterer.js",
"keywords": [
"google",
"maps",
"data",
"layer",
"features",
"marker",
"cluster",
"clusterer",
541 changes: 358 additions & 183 deletions src/datalayerclusterer.js

Large diffs are not rendered by default.