Select to view content in your preferred language

Advanced clustering in JS API v4.x

722
0
09-20-2020 01:32 AM
KarthikKumar
New Contributor

Hi All,

I am trying to create a clustering layer with GeoJson layer (flexible with this choice) with the following requirements:

  1. Clustering of Points
  2. There can be three "types" of points. Example: School, Home, Store.
  3. Requirement 1: While clustering, based on the types of Point we need to show different Icons. For Example: If all three types of point are there  we need to show "Icon A", if only two types are there "Icon B1", "Icon B2" and "Icon B3". If only one type is present then corresponding "Icon C1" or "Icon C2" or "Icon C3"
  4. Requirement 2: Each point can have a value, for example: Home: 40, School: 30 and Store: 20.  In the clustered icon, we need to show the Cluster count, and the Sum of these values, 

    ΣHome, ΣSchool, ΣStore

  5. Based on the above description, the following is a example cluster
    - There are five points(inclusive of 3 types) below this cluster
    - Sum of House values is 72
    - Sum of School values is 110
    - Sum of Store values is 70

 
Code pen for the progress made so far (requirement #2 has been achieved): https://codepen.io/karthikkumar1996/pen/wvGYZrW 

Also clustering has an issue, at a higher zoomed out level, there are six markers (one individual and 5 clustered) shown while the input is only 5 points.

Kindly help/guide me to achieve the switching of different icons based on the clustered values.

0 Kudos
0 Replies