I have a large amount of locations that need to be inserted to a PostGIS database. However, I'd like to aggregate these points so that if there's already a location, say nearer than a kilometer, then to discard that point. I'd like a pointer or two on the appropriate query (or, if it can't be done in a reasonable way, then flame me...:)
I reckon it has to be done a bit like:
INSERT INTO locations VALUES (ST_GeographyFromText('POINT(54.55 26.33)'))
IF ST_Distance(ST_GeographyFromText('POINT(54.55 26.33)'), <all other points in "locations" should be evaluated here>) > 1000;
As most of the audience has probably understood by now, I'm not that bright when it comes to databases so don't be too harsh on me...
