If you know for sure that the points that should be connected, you could connect every point to all the other points, and afterwards delete the records that not are 1 km long.
 
Like this:
1. Add an ID and a JOIN column to your table. Both Integer
2. Update the ID column with ROWID
3. Update the JOIN column with 1
4. Make a copy of your table and open this copy as well.
5. Create a join of the two tables:
    Select ID, CentroidX(TABLE1.OBJ) "X1", CentroidY(TABLE1.OBJ) "Y1", CentroidX(TABLE2.OBJ) "X2", CentroidY(TABLE2.OBJ) "Y2"
    From TABLE1, TABLE2
    Where TABLE1.JOIN = TABLE2.JOIN
    And TABLE1.ID <> TABLE2.ID
    And Distance(CentroidX(TABLE1.OBJ), CentroidY(TABLE1.OBJ), CentroidX(TABLE2.OBJ), CentroidY(TABLE2.OBJ), "k") between 900 and 1100
6. Save the result as a base table and open it
7. Update the OBJ of the result with CreateLine(X1, Y1, X2, Y2)
 
Note that I have said the distance between the points should be between 900 and 100 meters. You can of course make this smaller, like 990 and 1010
You could do most of it using the MapBasic window. wite these lines and hit Enter at the end of each, except the SQL where you need to write all lines, mark them and hit Enter
 
Alter Table TABLE1 (Add ID Integer, Join Integer)
Update TABLE1 Set ID = ROWID, JOIN = 1
'Manualle make a copy and open it
Select ID, CentroidX(TABLE1.OBJ) "X1", CentroidY(TABLE1.OBJ) "Y1", CentroidX(TABLE2.OBJ) "X2", CentroidY(TABLE2.OBJ) "Y2"
    From TABLE1, TABLE2
    Where TABLE1.JOIN = TABLE2.JOIN
    And TABLE1.ID <> TABLE2.ID
    And Distance(CentroidX(TABLE1.OBJ), CentroidY(TABLE1.OBJ), CentroidX(TABLE2.OBJ), CentroidY(TABLE2.OBJ), "k") between 900 and 1100
    Into RESULT NoSelect
'Manualle save the table RESULT to disk and open it
Update RESULT Set OBJ = CreateLine(X1, Y1, X2, Y2)
 
HTH,

Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Uffe Kousgaard
Sent: Thursday, June 22, 2006 7:40 AM
To: Mapinfo-L
Subject: Re: [MI-L] Creating a line from a series of points

Hi Alan,
 
If your points are completely unordered and you don't know the order, it sounds as if you need to apply a travelling salesman algorithm to determine the best order.
 
Kind regards
 
Uffe Kousgaard
www.routeware.dk
----- Original Message -----
Sent: Wednesday, June 21, 2006 5:30 PM
Subject: [MI-L] Creating a line from a series of points

Dear All,

 

Does anybody know how to automatically create a line from a series of points, i.e. rather than drawing a line from point to point, I want to be able to make a line that automatically joins up the points. The problem is, is that the next point to join up with the line may not be the next record in the table?! The points are however all 1km apart.

 

Does anyone have any ideas?

 

Regards,

Alan

 

Alan Silvester

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to