I am creating an application that retrieves lat / long values ββfrom a database and displays them on a Google map. There can be thousands of data points, so I "cluster" the points close to each other so that the user is not overloaded with icons. I am currently doing this clustering in an application using a simple algorithm:
- Get an array of all points
- Place the first point with an array
- Compare the first point with all the other points in the array that are looking for those that fall into the distance x
- Create a cluster with source and close points.
- Remove cramped dots from an array
- Repeat
Now I release that this is inefficient and is the reason that I studied GIS systems. I installed PostGIS and I have lat and longs stored in a POINT geometry object.
Can someone get me started or point out some resources on a simple implementation of this clustering algorithm in PostGIS?
php postgresql geolocation gis postgis
Mike
source share