ThinkGeo.com    |     Documentation    |     Premium Support

ClusterPointStyle doesn't

I’m trying to make use of the ClusterPointStyle, but its clustering logic doesn’t make a lot of sense to me. The initial image is how my map first displays. Then I zoom in one level to get picture two, then zoom in again to get picture three. I had expected to seem some clustering in picture two, but do not.

Sure enough, if I dump out the bounding boxes of the tiles in the second case, none of them contain any of the features, which doesn’t make sense to me. Shouldn’t the bounding boxes of the +1 zoomed tiles cover the same area?



HI Jay,

Please try setting clusterPointStyle.TextStyle.DuplicateRule and clusterPointStyle.MinimumFeaturesPerCellToCluster = 1.

Hope it’s helped.

Thanks,
Peter

I set clusterPointStyle.MinimumFeaturesPerCellToCluster = 1 and clusterPointStyle.TextStyle.DuplicateRule to each of OneDuplicateLabelPerQuadrant, NoDuplicateLabels and UnlimitedDuplicateLabels, and I get the same results each time, that is, same as above.

Hi Jay,

I guess I’ve misunderstood your requirements. Please make a confirmation below.

Do you mean the position of cluster point is not the same as any point’s, which the cluster point contains?

The cluster point’s position is the center point of the features in it. And there are two properties can effect the result.

CellSize: The properties indicates how the screen will be divided.
MinimumFeaturesPerCellToCluster: The number of features in a cell to suppress drawing the style, the features won’t display as a clustered if the count less than the value.

Any misunderstood here please let me know. Maybe a sample to illustrate this issue would be better.

Thanks,
Peter

I guess I’m just wondering in general about the clustering. For example, in the middle picture with no clustering, I’m wondering why there isn’t any. The two yellow pins are clustered in the third picture, but in the second with almost identical positioning, they are not. That just seems odd to me.

Hi Jay,

Thanks for further information. Please try setting CellSize property to a larger value and have a try again.

Also, do you use the shape file as the marker’s feature source? If yes, please try the following options to avoid overlapping issue.

  1. Set the ProgressiveDrawingRecordsCount property like below:

    shapefile.ProgressiveDrawingRecordsCount = int.MaxValue;

  2. Use an InMemoryFeatureLayer instead of ShapeFileFeatureLayer.

Following is the screenshot on my side.

Here is a sample about ClusterPointStyle.
http://wiki.thinkgeo.com/wiki/source_code_wpfdesktopeditionsample_clusterpoint_cs_160627.zip

If it doesn’t work for you, could you please append your test data and code snippets here.

Thanks,
Peter

Hi Peter. Setting the CellSize to a larger value didn’t help, but setting it smaller did enable those pins to be clustered when zoomed in one level.

I’m creating an InMemoryFeatureLayer and adding the features to it. Basically, doing just like
http://wiki.thinkgeo.com/wiki/source_code_serviceseditionsample_clusterpointstyle_cs_090918.zip
but using the ClusterPointStyle from the core, rather than that in the zip.

But since I’m not getting quite the behavior I want from the Core version, I’m trying to tweak that sample for my own clustering logic.

Hi Jay,

Thanks for the updates and glad to hear it works for you.

Actually, the ClusterPointStyle in core has better performance than the sample’s.

Thanks,
Peter

Is there any method I can override from PointStyle that has all the features? I’m currently overriding

protected override void DrawCore(IEnumerable<Feature> features, GeoCanvas canvas, Collection<SimpleCandidate> labelsInThisLayer, Collection<SimpleCandidate> labelsInAllLayers)

but it seems to be called multiple times with different set of features, so when I implement my clustering logic, it misses features from other calls that could conceivably be grouped together.

Hi Jay,

  1. Set tile mode equal single tile, then you can get all the features in the DrawCore.

  2. You can implement your custom featureLayer and featureSource instead of custom style, which can get all the features.

Wish that’s helpful.

Regards,

Don