Method to equally divide geopoints into regions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Method to equally divide geopoints into regions

Stephen More
Is there already a method/tool that can take X geopoints and equally put them into Y regions ? i.e. 17 geopoints into 6 regions { 5 regions would contain 3 points, 6th region contain 2 }. There is no constraint to the area of the region.

If not I plan to write my own method:
1. Find weighted center of all geopoints
2. Create a circle that encompasses all geopoints
3. Create a pie shape from that circle, increase/decrease the size until it contains desired amount of points.
4. Continue creating pie shapes until there are no more datapoints left.

Would there be any road blockers to implementing this method ? Is there any sample code I can utilize to bootstrap this project ?

Thanks for any advice.






------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Reply | Threaded
Open this post in threaded view
|

Re: Method to equally divide geopoints into regions

Jim Hughes
Hi Stephen,

It sounds like you want something a little different, but I'd suggest reading about clustering techniques like k-means or computational geometry approaches like Voronoi diagrams.

You may find that one of those fits your needs.  If not, your approach seems plausible.  As a note about it, for each point, you could find the angle of a vector from the center to the point.  If you sort the list of points by that angle, you'd be able to find your pie wedges that capture your groupings.

Cheers,

Jim

https://en.wikipedia.org/wiki/K-means_clustering
https://en.wikipedia.org/wiki/Voronoi_diagram

On 05/10/2017 08:09 AM, Stephen More wrote:
Is there already a method/tool that can take X geopoints and equally put them into Y regions ? i.e. 17 geopoints into 6 regions { 5 regions would contain 3 points, 6th region contain 2 }. There is no constraint to the area of the region.

If not I plan to write my own method:
1. Find weighted center of all geopoints
2. Create a circle that encompasses all geopoints
3. Create a pie shape from that circle, increase/decrease the size until it contains desired amount of points.
4. Continue creating pie shapes until there are no more datapoints left.

Would there be any road blockers to implementing this method ? Is there any sample code I can utilize to bootstrap this project ?

Thanks for any advice.







------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Reply | Threaded
Open this post in threaded view
|

Re: Method to equally divide geopoints into regions

Stephen More
It has been a few years since I have worked with geotools, it is taking a while to absorb all the api changes.

I am trying to output my work using the StreamingRenderer but all I seem to output is a blank image.

Here is a link to my code:  https://github.com/mores/maven-examples/blob/master/gis/src/test/java/org/test/AppTest.java
What am I missing ? Why aren't my points getting rendered ?

-Thanks




On Wed, May 10, 2017 at 9:28 AM, Jim Hughes <[hidden email]> wrote:
Hi Stephen,

It sounds like you want something a little different, but I'd suggest reading about clustering techniques like k-means or computational geometry approaches like Voronoi diagrams.

You may find that one of those fits your needs.  If not, your approach seems plausible.  As a note about it, for each point, you could find the angle of a vector from the center to the point.  If you sort the list of points by that angle, you'd be able to find your pie wedges that capture your groupings.

Cheers,

Jim

https://en.wikipedia.org/wiki/K-means_clustering
https://en.wikipedia.org/wiki/Voronoi_diagram


On 05/10/2017 08:09 AM, Stephen More wrote:
Is there already a method/tool that can take X geopoints and equally put them into Y regions ? i.e. 17 geopoints into 6 regions { 5 regions would contain 3 points, 6th region contain 2 }. There is no constraint to the area of the region.

If not I plan to write my own method:
1. Find weighted center of all geopoints
2. Create a circle that encompasses all geopoints
3. Create a pie shape from that circle, increase/decrease the size until it contains desired amount of points.
4. Continue creating pie shapes until there are no more datapoints left.

Would there be any road blockers to implementing this method ? Is there any sample code I can utilize to bootstrap this project ?

Thanks for any advice.







------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users