Re: [GRASS-user] vectors: how to find the gravitation centre of point data ?
[...] is there an easy way to derive the centre of a cloud of points ? I am aware that the set of vector points (cloud of points) could be used to stake out a polygon/boundary and use v.centroid etc etc to derive in turn its' centroid, but I am hoping for an easier solution .. ? This issue stems from working with v.to.db: currently it is not possible to upload xy coordinates for multiploygons into a database, i.e: Within a vector layer, there might be several boundaries which all share the same category value. If the gravitational centre/ super-centroid for these boundaries could be (conveniently) calculated, the v.to.db issue could be taken care of. Why not use v.dissolve on these polygons and then get the centroids of the result ? This option fails if the polygons don't have common borders. An example for this would be multiple polygons describing spatial exclaves of a territory/county/soil type, etc. Another (very wild) guess: what about the mean of the coordinates of the individual polygons' centroids ? That would be great if it could be automated. Peter Moritz -- Dr. Peter Löwe [EMAIL PROTECTED] Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] vectors: how to find the gravitation centre of point data ?
On 05/12/08 12:27, Peter Löwe wrote: [...] is there an easy way to derive the centre of a cloud of points ? I am aware that the set of vector points (cloud of points) could be used to stake out a polygon/boundary and use v.centroid etc etc to derive in turn its' centroid, but I am hoping for an easier solution .. ? This issue stems from working with v.to.db: currently it is not possible to upload xy coordinates for multiploygons into a database, i.e: Within a vector layer, there might be several boundaries which all share the same category value. If the gravitational centre/ super-centroid for these boundaries could be (conveniently) calculated, the v.to.db issue could be taken care of. Why not use v.dissolve on these polygons and then get the centroids of the result ? This option fails if the polygons don't have common borders. An example for this would be multiple polygons describing spatial exclaves of a territory/county/soil type, etc. Another (very wild) guess: what about the mean of the coordinates of the individual polygons' centroids ? That would be great if it could be automated. Using a real DB-backend, it should be as easy as (assuming that when you say boundaries, you mean areas, each of which has a centroid): - v.to.db type=centroid option=coor - SELECT cat, avg(X), avg(Y) from TABLE group by cat If you have boundaries with categories, but no centroids, I imagine that v.centroids + v.distance with upload=cat should do the trick to transfer boundary cats to their centroids. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] vectors: how to find the gravitation centre of point data ?
Original-Nachricht Datum: Fri, 05 Dec 2008 13:40:08 +0100 Von: Moritz Lennert [EMAIL PROTECTED] An: Peter Löwe [EMAIL PROTECTED] CC: grass-user@lists.osgeo.org Betreff: Re: [GRASS-user] vectors: how to find the gravitation centre of point data ? On 05/12/08 12:27, Peter Löwe wrote: [...] is there an easy way to derive the centre of a cloud of points ? I am aware that the set of vector points (cloud of points) could be used to stake out a polygon/boundary and use v.centroid etc etc to derive in turn its' centroid, but I am hoping for an easier solution .. ? This issue stems from working with v.to.db: currently it is not possible to upload xy coordinates for multiploygons into a database, i.e: Within a vector layer, there might be several boundaries which all share the same category value. If the gravitational centre/ super-centroid for these boundaries could be (conveniently) calculated, the v.to.db issue could be taken care of. Why not use v.dissolve on these polygons and then get the centroids of the result ? This option fails if the polygons don't have common borders. An example for this would be multiple polygons describing spatial exclaves of a territory/county/soil type, etc. Another (very wild) guess: what about the mean of the coordinates of the individual polygons' centroids ? That would be great if it could be automated. Using a real DB-backend, it should be as easy as (assuming that when you say boundaries, you mean areas, each of which has a centroid): - v.to.db type=centroid option=coor - SELECT cat, avg(X), avg(Y) from TABLE group by cat Very good point. If this is combined with a previous step to create individual CATs for the exclave areas while preserving the original CAT in another column, we can successfully apply v.to.db even while several areas share the same ID (having the centroids xy-coordinates for all exclave-area) _plus_ having the coordinates for the super-centroid of all exclaves. Northern winter might be the perfect time to write GRASS scripts for this kind of stuff.. Thanks, Peter If you have boundaries with categories, but no centroids, I imagine that v.centroids + v.distance with upload=cat should do the trick to transfer boundary cats to their centroids. Moritz -- Dr. Peter Löwe [EMAIL PROTECTED] Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] vectors: how to find the gravitation centre of point data ?
Moritz wrote: Another (very wild) guess: what about the mean of the coordinates of the individual polygons' centroids ? Peter Löwe wrote: That would be great if it could be automated. #spearfish g.copy vect=archsites,tmp_arch v.db.addcol tmp_arch column='x double, y double' v.to.db tmp_arch option=coor columns=x,y eval `v.univar -g tmp_arch column=x type=point | grep -w mean` X_MEAN=$mean eval `v.univar -g tmp_arch column=y type=point | grep -w mean` Y_MEAN=$mean echo Center of point cloud: $X_MEAN, $Y_MEAN one thing there- v.univar output for y coord results in 4.92146e+06. see trac bug #335 (improve variable output precision) http://trac.osgeo.org/grass/ticket/335 Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] vectors: how to find the gravitation centre of point data ?
If this is combined with a previous step to create individual CATs for the exclave areas while preserving the original CAT in another column, we can successfully apply v.to.db even while several areas share the same ID (having the centroids xy-coordinates for all exclave-area) _plus_ having the coordinates for the super-centroid of all exclaves. beware the C shape area where the center of gravity is outside of the area; centroids should always do a point-in-polygon test. Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] vectors: how to find the gravitation centre of point data ?
Hi list, is there an easy way to derive the centre of a cloud of points ? I am aware that the set of vector points (cloud of points) could be used to stake out a polygon/boundary and use v.centroid etc etc to derive in turn its' centroid, but I am hoping for an easier solution .. ? This issue stems from working with v.to.db: currently it is not possible to upload xy coordinates for multiploygons into a database, i.e: Within a vector layer, there might be several boundaries which all share the same category value. If the gravitational centre/ super-centroid for these boundaries could be (conveniently) calculated, the v.to.db issue could be taken care of. Peter -- Dr. Peter Löwe [EMAIL PROTECTED] Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] vectors: how to find the gravitation centre of point data ?
On 04/12/08 11:02, [EMAIL PROTECTED] wrote: Hi list, is there an easy way to derive the centre of a cloud of points ? I am aware that the set of vector points (cloud of points) could be used to stake out a polygon/boundary and use v.centroid etc etc to derive in turn its' centroid, but I am hoping for an easier solution .. ? This issue stems from working with v.to.db: currently it is not possible to upload xy coordinates for multiploygons into a database, i.e: Within a vector layer, there might be several boundaries which all share the same category value. If the gravitational centre/ super-centroid for these boundaries could be (conveniently) calculated, the v.to.db issue could be taken care of. Why not use v.dissolve on these polygons and then get the centroids of the result ? Another (very wild) guess: what about the mean of the coordinates of the individual polygons' centroids ? Moritz ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user