fjorgemota / ol-supercluster

OpenLayers's Cluster Source that uses SuperCluster to calculate clusters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

question: How should I use it?

snailgis opened this issue · comments

How should I use this package?

Hey!

Sorry for the lack of documentation, I need to work at it sometime but I'm not having time right now.

The idea around this package is to have something near the API of the ol/source/Cluster, whose documentation you can read here. The API isn't exact, tho, because we need some data that ol/source/Cluster doesn't need, and a few parameters are renamed to follow supercluster pattern.

IIRC, this is the basic list of changes:

  • The constructor needs a view option passing the same option you pass to the view option of the ol/Map;
  • The option distance is removed;
  • There's a new option, called radius, that defines the cluster radius in pixels;
  • The option geometryFunction is removed;
  • There's a new option in it's place called geoJsonFunction, which given a ol/Feature returns a GeoJSON Feature whose geometry is a Point, like this.

The rest of the options are basically the same.

If you want, you can look at a demo made by @konscia with a comparison between ol/source/Cluster and ol-supercluster usage, available here. The differences for the normal app are minimal, as you can see by comparing the code for the ol/source/Cluster example and for the ol-supercluster example.

I hope this helps you. Feel free to ask more questions, I'll answer them ASAP. =)

Any new questions @snailgis? If not, I think we can close the issue. :)

thank you very much! I git it

Ok. I'll close the issue for now. Feel free to ask more questions anytime by reopening the issue.