ThinkGeo.com    |     Blog    |     Wiki    |     Support

PointStyle cluter issue

Hi,
I am plotting points on the lines but they are very close to each, so they are overlapping at lower zoom level.
Textstyle having OverlappingRule property, same way is there any property set point style as clear render even in lower zoom level.

How can we over come this, Please give me solution for this.

Thanks,
Riyaz

Hi Riyaz,

We don’t have a property for that.

I think you have some ways for your requirement:

  1. Reduce point size
  2. Hide all points in this level, because it looks that’s not helpful in this level to shows so many points
  3. Write custom style, implement your logic to control how to render points
  4. Loop all features, calculate the distance between them, add valid points into a layer for example inmemory featurelayer and render it.

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,
Thanks for your reply.
I tried with ‘ClusterPointStyle’, it’s working fine. But same ClusterPointStyle not working with ValueStyle.

Please refer sample code and fix this issue.
Sample.zip (2.7 KB)

Finally I need to use ValueStyle with ClusterPointStyle.

Thanks,
Riyaz

Hi Riyaz,

By default the ValueStyle cannot works with ClusterPointStyle, because the ClusterPointStyle is a special style.

The ValueStyle will loop the feature, check target value, then render the single feature by it’s style.

But the ClusterPointStyle also require a group of features, because it need to ignore some of them and render the other features.

If you want to make it works, I think you need to write your custom ValueStyle, when loop the features, you don’t directly draw the feature, but only group them and draw them by the style you set in ValueItem.

Regards,

Ethan

Hi Ethan,
I tried with ‘CustomClusterPointStye’, but exactly Cluster with Value style not coming.

Please refer it and fix it.
Cluster.zip (4.0 KB)

Note : In DrawCore, i am not getting all features, that why i took as a property of all features.

Thanks,
Riyaz

Hi Riyaz,

You should want to inherit your CustomClusterPointStyle from ValueStyle or Style, and add your custom style into ZoomLevel01.CustomStyles, you inherit it from PointStyle, so the drawcore of it will be hit for each point, because the foreach logic had been run in the ValueStyle, the logic just like I mentioned in the last reply.

And I hadn’t found the logic about cluster in your style, I think if the features problem get solved, you should want to complete the logic, your new style should put the Value split and Cluster group in the same function logic.

Regards,

Ethan

Hi Ethan,

              Thanks for your suggestion.

It’s work out.

Thanks,
Riyaz

Hi Ethan,
I observed one more thing, while redraw with draw core it’s taking some time and drawing it. where as directly apply point style it’s rendering fast.
I am not getting where exactly issue happening can you please suggest me about it.

Thanks,
Riyaz

Hi Riyaz,

I don’t think your new logic should be slow because it looks it’s only loop 18 cells and loop 11 features in it, the loop time should be 18 x 11 = 198 times, you shouldn’t feel the difference because it still be very fast.

If you found it’s really slow, please use the System.Diagnostics.Stopwatch class to get the detail run time in your new DrawCore, and you can simple override the default point style, get it’s actual time. Compare the result to see which step cause the performance problem.

And we can see how to improve the speed based on your test result.

Regards,

Ethan

Hi Ethan,
In my main project, I have lots of points. I used CustomClusterValueStyle draw core method for rendering all points. it’s some time to render it.

I just made one sample application, pls check it.
Sample.zip (3.0 KB)

CustomClusterValueStyle.zip (1.5 KB)

Can we possible to overcome rendering speed, If possible please suggest me some ideas for achieve it.

Thanks
Riyaz

Hi Riyaz,

Thanks for your code, I think the logic of your class CustomClusterValueStyle have some problem, I have a question about the order of your cluster and value filter, and make sure that is important for optimize your code. Please view this image and let us know what’s the purpose of your CustomClusterValueStyle, I hadn’t make sure that from your sample code:

In your currently logic, if you have 100 points in one cell, the valueItem.DefaultPointStyle.Draw will be called 100 times, and I think that’s incorrect.

After solve this problem, we can discuss other part of the code to improve the performance.

Regards,

Ethan

Hi Ethan,
“In your currently logic, if you have 100 points in one cell, the valueItem.DefaultPointStyle.Draw will be called 100 times, and I think that’s incorrect.”

I crossed checked about your point, it’s correct. it’s always redrawing all points.
Can you please suggest me some ideas to resolve it.

Thanks,
Riyaz

Hi Riyaz,

Could you please let me know which image is your target? I cannot know it from your logic.

I will give you some suggestion after make sure it.

Regards,

Ethan