Tag Info

Hot answers tagged

42

Here is the kmeans-postgresql solution. Installation: You need to have PostgreSQL 8.4 or greater on a POSIX host system (I wouldn't know where to start for MS Windows). If you have this installed from packages, make sure you also have the development packages (e.g., postgresql-devel for CentOS). Download and extract: wget ...


17

If you want a clusterer like redfin then check out my Leaflet.markercluster: http://danzel.github.com/Leaflet.markercluster/example/marker-clustering-realworld.388.html https://github.com/danzel/Leaflet.markercluster It is fully animated etc etc :)


17

I see MerseyViking has recommended a quadtree. I was going to suggest the same thing and in order to explain it, here's the code and an example. The code is written in R but ought to port easily to, say, Python. The idea is remarkably simple: split the points approximately in half in the x-direction, then recursively split the two halves along the ...


15

I've written function that calculates clusters of features based on distance between them and build convex hull over this features: CREATE OR REPLACE FUNCTION get_domains_n(lname varchar, geom varchar, gid varchar, radius numeric) RETURNS SETOF record AS $$ DECLARE lid_new integer; dmn_number integer := 1; outr record; innr ...


12

Here is a good tutorial for doing exactly that using MapBox and TileMill: A heatmap for all your runs in RunKeeper


10

In traditional cartography, marker clustering is called aggregation or sometimes amalgamation. It is part of model generalization: When zooming out, some detailed concepts (e.g. the tree) disappear to be replaced by less detailed aggregated forms (e.g. the forest). Many good examples can be found in good cartography books. Here are two examples from this ...


10

you can check out k-means clustering algorithm here. In data mining, k-means clustering is a method of cluster analysis which aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean. This results into a partitioning of the data space into Voronoi cells. kmeans-postgresql ...


10

I've done a bit of work on this in GeoTools/GeoServer by extending the Heatmap Rendering Transformation to support geometries other than points. It's not finished yet, but you can get the feature branch from my repository on GitHub. The screenshot is of GPS tracks from when I worked as a pizza delivery driver.


9

Thanks to everyone who responded! I've combined bits from several suggestions and added a bit of my own and found a solution which works well for me - and all from within QGis! I first ran a PostGis SELECT to find the points which have the right common attributes and lie within x km of each other: SELECT DISTINCT s1.postcode,s1.the_geom, s1.gid ...


8

It sounds like you need a clustering algorithm (eg. K-means clustering) first, followed by a hull (convex hull, but a concave hull may have a smaller area but more difficult to implement).


8

you have to use the union function like this SELECT att1, st_centroid(st_union(geom)) as geom FROM schema.table GROUP BY att1; so you can obtain centroid of point that have same attribute.


7

Although not QGIS solution I'd personally opt for some exploratory analysis using SaTScan. It's fast, well documented and widely applied, so you shouldn't have troubles with starting up. 45k points might require some RAM though. I'm not sure if it can read directly from Postgres but easily imports from dbf and text files. The output of analysis can be then ...


7

There's a lot of options and in fact I struggled through the same question a while back on some of my applications. And for our different products we ended up with different solutions. So you have to ask yourself Are all of the singleton icons on the map of the same "kind" - same shape and color? If they're not, do they all live on 1 layer, or multiple ...


7

This may not be the most elegant solution, but, with some fine-tuning of the timeout durations and customization of the cluster icons, I think you can get the effect you are looking for. See this example. The trick is to first create a marker and set the map attribute in the marker options object. This adds the marker to the map with the nice drop ...


7

You can use Vector > Analysis Tools > Distance Matrix, and a join to achieve what you ask. I will use qgis sample data airport's layer to exemplify. This is a small dataset so I'm not sure how it will go with a 275000 points shapefile. 1. Create a distance matrix using your layer as both destination and target. Don't forget to tick "Use only the nearest ...


6

Try using the Buffer tool to buffer the points to a tolerance, dissolve to create single polygons for each cluster, and then use a join to count the number of points in the cluster. Then use the ratio between the area of the cluster and the number of points to apply your parameters.


6

None of the out-of-the-box tools in ArcGIS (or any other GIS, AFAIK) will do the job correctly. In a problem like this you need to quantify what you mean by "clustering" and then you need to posit a probability model to assess whether the measured degree of clustering could have been produced by accidental chances. As an example of how to proceed, you ...


6

So far, the most promising I found is this extension for K-means clustering as a window function: http://pgxn.org/dist/kmeans/ However I haven't been able to install it successfully yet. Otherwise, for basic grid clustering, you could use SnapToGrid. SELECT array_agg(id) AS ids, COUNT( position ) AS count, ST_AsText( ST_Centroid(ST_Collect( ...


6

See if this algorithm gives enough anonymity for your data sample: start with a regular grid if polygon has less than threshold, merge with neighbor alternating (E, S, W, N) spiraling clockwise. if polygon has less than threshold, go to 2, else go to next polygon For example, if the minimum threshold is 3:


6

You do not have a uniform random field, so attempting to analyze all of your data at once will violate the assumptions of any statistic you choose to throw at the problem. It is unclear from your post if your data is a marked point process (i.e, diameter or height associated with each tree location). If this data is not representing a marked point process I ...


6

One quick and dirty way uses a recursive spherical subdivision. Beginning with a triangulation of the earth's surface, recursively split each triangle from a vertex across to the middle of its longest side. (Ideally you will split the triangle into two equal-diameter parts or equal-area parts, but because those involve some fiddly calculation, I just split ...


5

A fairly simple way is to snap the events to a grid. It's fast enough that potentially you can do it dynamically. You can snap the points by means of a few simple computations before creating the events. Decide on the grid's origin and mesh size, using the same coordinate system as the (X, Y) values you have. Let the origin have coordinates (Ox, Oy) and ...


5

Follow-up with some other non-commercial web apps people have been developing: Florida is rolling their own MyDistrictBuilder web ap: http://www.floridaredistricting.org/ (app may be at http://floridaredistricting.cloudapp.net/MyDistrictBuilder.aspx, website claims they'll have public testing in March) Profs. Altman and McDonald are developing the ...


5

From the point of view of population density, an "urban area" ought generally to satisfy just a few axiomatic criteria: Its boundary should not include any points of (relatively) high density compared to the maximum density within its interior. It should be simply connected (no "holes"). Its average population density should exceed some prespecified ...


5

You might obtain some inspiration from sunflower plots. This method, which has been in use for decades to represent clusters of points on scatterplots, capitalizes on research in visual cognition to produce markers that are rapidly and correctly discriminated as well as clearly related to the sizes of the clusters they represent. Here's an example done in ...


5

Raster solution The first approach works well provided you use an efficient algorithm. The most efficient is to compute the Fast Fourier Transform of a grid representing the data (cells are either zeros or contain the total insured values of all properties within occupied cells), multiply by the FFT of a "simple" kernel representing an average over a 300 m ...


5

There are functions for computing true distances on a spherical earth in R, so maybe you can use those and call the clustering functions with a distance matrix instead of coordinates. I can never remember the names or relevant packages though. See the R-spatial Task View for clues. The other option is to transform your points to a reference system so that ...


5

Thanks to @whuber for setting me on the right track here. Looks as if there will be no additional answers forthcoming, so will settle this question by posting my own observations that may be useful for others learning about distances, clustering, and projections. The following R code, using the geosphere, rgdal, and sp packages demonstrates that careful ...


5

Similarly to Paulo's interesting solution, how about using a quad tree subdivision algorithm? Set the depth you would like the quadtree to go to. You could also have a minimum or maximum number of points per cell so some nodes would be deeper/smaller than others. Subdivide your world, discarding empty nodes. Rinse and repeat until the criteria are met.


5

Have you checked the dev examples ? http://openlayers.org/dev/examples/strategy-cluster.html http://openlayers.org/dev/examples/strategy-cluster-threshold.html http://openlayers.org/dev/examples/strategy-cluster-extended.html I'm pretty sure you could 'group' them by an attribute. The last example has good info.



Only top voted, non community-wiki answers of a minimum length are eligible