Create Group of N Points by Distance

539 views
Skip to first unread message

Luis Taborda

unread,
May 8, 2020, 4:29:53 PM5/8/20
to MapInfo-L
Hi,

I have a table with 400 points and would like to create 40 groups of 10 points, grouped based on the distance between the points. Basically create clusters of points.
Do you know of any Mapbasic tool/code or can guide me where to start?

I understand I need to find the nearest distance for each point and do an iterative process but I'm having trouble defining the several steps I need to achieve.

Thank you! 

Jesus Alfonso

unread,
May 9, 2020, 3:25:56 PM5/9/20
to MapInfo-L
Your quesyion is very tricky, for example you want to create 40 groups of 10 points, so the algorithm must have first to select randomly 40 points and start asigning each point a cluster, tgis seems more a machine leatnibg algorithm than a simple tool.

Having mention that, can you specify if you have the list of the 40 starting points, if so then it will be easy, if not then you need to specify based on wich criteria the clusters will be created

Uffe Kousgaard

unread,
May 9, 2020, 4:07:04 PM5/9/20
to mapi...@googlegroups.com
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/09ad3607-1293-4570-a238-60f05eab40ab%40googlegroups.com.

Jesus

unread,
May 9, 2020, 4:46:11 PM5/9/20
to mapi...@googlegroups.com
Ok, so 
First the machine learning algoritm of clustering that you have shown will create clusters  (for example 40 clusters)

You may check this link:

Second
After that you may need to find the centroid of those clusters and select the point wich is nearest the centroid (so you will have 40 points)

Third
Then knowing the 40 points of the cluster you can calculate the distance of all 400 points to the 40 points and select the nearest 10 for each 

I think all that can be done simply by using python.

But if you needed in mapinfo then
as i know since  v17 mapinfo support python so python algorithms can be integrated. I may help you creating this tool as is very easy  but i haven found yet good steps to make a python algorithm work directly from mapinfo, i have searched in the doc but found it shady and it didnt worked, so if someone can help step by step (and please dont just send the same link pointint to de documentation lol) i will be thankfull

Reply all
Reply to author
Forward
0 new messages