I have a set of points and need to get the groups of points that are within a distance x. Ie, determining the point clouds that are up to the distance x from each other.

Any help would be appreciated. Thanks.

Additional information:

Example of a table with coordinates (in EPSG:4674)

Table with points EPSG:4674

The extension of the data is variable. Will be implemented in several counties, separately.

I need anything like this:

clustering buffer

And I need make this in SQL from SpatiaLite. I can make this using buffer and union but I get just one polygon because I don´t have a "group by" attribute, and I need polygons separately for each group.

I´ve been trying this:

      SELECT "PK_UID" as "ID_end",
             ST_BUFFER(geom_ce, 0.00025) AS "geom_bu"
        FROM "T_CoordEnd"
       WHERE "situacao" IN (4, 5, 6, 7, 8)


      SELECT ST_UNION(b.geom_bu, a.geom_bu) AS "geom_bu"
        FROM "T_bufEndR" AS "b", "T_bufEndR" AS "a"
       WHERE ST_OVERLAPS(b.geom_bu, a.geom_bu) = 1 AND
             "b"."ROWID" IN (SELECT rowid from SpatialIndex 
                              WHERE f_table_name = "t_bufendr" and
                                    search_frame = "a"."geom_bu")

Is that!

  • Can you show the table schema and a little bit of your data (e.g. SELECT * FROM <table_name> LIMIT 5). Also please tell us the coordinate reference system you are using, and the extent (coverage area) of your data. Those can all affect the answer. – BradHards Apr 26 '14 at 0:33
  • Hi @BradHards, I was edit the question for include information. Thanks! – Sassá Apr 28 '14 at 15:04
  • A question on what you want - do you want to identify sets of points where any of the points are within X distance of each other, or where all of the points are within X distance of each other. So given 4 points (A, B, C and D) evenly spaced on a line, say at distance 2 from each other, what is the expected results if you ask for the cloud of size 3? Also, is it enough to only have the PK_UID in the result? – BradHards Apr 28 '14 at 22:30
  • @BradHards, I inserted more information about the problem. Sorry for my poor english, ok? – Sassá Apr 29 '14 at 13:42
  • You haven't answered the question about expected behaviour, but I guess since you've asked the question and been given suggestions on the spatialite mailing list, you've given up here. – BradHards Apr 29 '14 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.