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

Add HTML clusters + aggregated properties example #8019

Merged
merged 4 commits into from
Mar 12, 2019

Conversation

mourner
Copy link
Member

@mourner mourner commented Mar 11, 2019

Closes #4491. An official example for using custom HTML (or SVG) elements for clusters, along with the new customProperties API. It's an advanced example with quite a bit going on, but I think it's still worth adding.

Most of the complexity is in the donut chart generation logic, which is not important for the key features covered, but makes for a pretty and useful example.

image

Copy link
Contributor

@asheemmamoowala asheemmamoowala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@@ -0,0 +1,10 @@
/*---
title: Display HTML clusters with custom properties
description: An advanced example of using Mapbox GL JS clustering with HTML markers and custom property expressions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outlining the general strategy that the example takes would be very useful here to set context for the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate? Even the general strategy would need description that seems too long for the purpose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it can be added in the code section then?

Strategy would Outline that this example is using clustered GeoJSON with filtered layers and continuously updating Markers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right — I've extended the description.

@mourner mourner force-pushed the add-cluster-html-example branch from df1c10b to 5d9d17a Compare March 11, 2019 20:09
@@ -0,0 +1,10 @@
/*---
title: Display HTML clusters with custom properties
description: An advanced example of using Mapbox GL JS clustering with HTML markers and custom property expressions. To be able to use HTML or SVG for clusters in place of a Mapbox GL layer, we have to manually synchronize the clustered source with a pool of marker objects that we update continuously while the map view changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions that (hopefully) simplify the language without making anything untrue:

This advanced example uses Mapbox GL JS clustering with HTML markers and custom property expressions. To use HTML or SVG for clusters in place of a Mapbox GL layer, you have to manually synchronize the clustered source with a pool of marker objects that updates continuously while the map view changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colleenmcginnis thanks, updated!

@mourner mourner merged commit 0792078 into publisher-production Mar 12, 2019
@mourner mourner deleted the add-cluster-html-example branch March 12, 2019 19:02
mourner added a commit that referenced this pull request Mar 21, 2019
* publisher-production: (41 commits)
  bump publisher after timeout (#8058)
  cosmetic update to draggable Marker/point examples to prevent coordinates overlapping Mapbox logo (#8057)
  update mapbox style and tileset version numbers to most recent (#8056)
  update docs page shell (#8039)
  mapbox-gl-geocoder@3.1.6
  Add create-image script to generate example thumbnails (#8029)
  Add HTML clusters + aggregated properties example (#8019)
  add 3D model with three.js example (#7977)
  update mapbox-gl-geocoder to @3.1.4 in examples (#7978)
  V0.53.1 (#7961)
  rename example for accepting coordinates in the geocoder (#7859)
  [docs] use appropriate-images for examples to increase page speed (#7900)
  [docs] dr-ui 0.6.0 (#7909)
  version bump gl-geocoder to v3.1.2 (#7924)
  Fix docs for Camera methods
  Docs page shell update 02-14-19 (#7907)
  fixes regression with css on examples pages (#7891)
  updates sentry project for docs subdomain (#7890)
  v0.53.0 (#7884)
  [docs] update dr-ui 0.5.0 (#7880)
  ...
mourner added a commit that referenced this pull request Mar 21, 2019
* publisher-production: (41 commits)
  bump publisher after timeout (#8058)
  cosmetic update to draggable Marker/point examples to prevent coordinates overlapping Mapbox logo (#8057)
  update mapbox style and tileset version numbers to most recent (#8056)
  update docs page shell (#8039)
  mapbox-gl-geocoder@3.1.6
  Add create-image script to generate example thumbnails (#8029)
  Add HTML clusters + aggregated properties example (#8019)
  add 3D model with three.js example (#7977)
  update mapbox-gl-geocoder to @3.1.4 in examples (#7978)
  V0.53.1 (#7961)
  rename example for accepting coordinates in the geocoder (#7859)
  [docs] use appropriate-images for examples to increase page speed (#7900)
  [docs] dr-ui 0.6.0 (#7909)
  version bump gl-geocoder to v3.1.2 (#7924)
  Fix docs for Camera methods
  Docs page shell update 02-14-19 (#7907)
  fixes regression with css on examples pages (#7891)
  updates sentry project for docs subdomain (#7890)
  v0.53.0 (#7884)
  [docs] update dr-ui 0.5.0 (#7880)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants