[OpenLayers-Users] Cluster strategy but on the server
Nils Weinander
nils.weinander at curalia.se
Mon Apr 6 05:37:06 EDT 2009
users-request at openlayers.org wrote:
Didrik:
>
>> I don't know if this is interesting for you but this postgis thread was
>> related to the subject of your mail :
>>
>> http://postgis.refractions.net/pipermail/postgis-users/2005-July/008642.html
Interesting, but as one of the replies said, the clustering
algorithm is iterative in nature, which is hard to do in a
SQL query.
Yves:
>
> That series of posts is about statistical data clustering as in k-means
> and the like. Give a k-means like algorithm a number of seeds N, it
> will minimize some sum of squares of distances between those seed points
> and the data points and your N clusters will be produced.
>
> That's not how the clustering strategy in OL is implemented AFAIK. Come
> to think of it a pregenerated set of clusters could be done on distance
> to seed points (e.g. know site locations ?), but that would need to be
> done for every zoom level and even every "tile" in a given zoom level.
Yes, definitely. For my needs I have come up with this:
* A separate table for the cluster features, with columns
for the geometry (a point), a feature count and the scale
(i.e. I store the cluster points for all scales in one
table)
* A view for each scale
"create view cluster_1M as select * from clusters where scale = 1000000"
etc.
* A stored procedure which runs the same clustering algorithm
as OpenLayers.Strategy.Cluster on the original spatial table
and adds the clusters in the cluster table.
* Then I'll set up the layers and scale limits so that the
cluster layer for each scale is dispalyed for that scale
only.
* I'll probably add a trigger on the original spatial table
and add each single new point to the clusters rather than
have to regenerate the whole thing.
The backend is Oracle Spatial (10.2).
--
Nils Weinander | Systems Designer
Phone +46 (0)8 4100 6456
Mobile +46 (0)709 78 28 37
--
Curalia AB | www.curalia.se
Hudiksvallsgatan 4, 113 30 Stockholm, Sweden
--
More information about the Users
mailing list