RE: [MI-L] Creating a line from a series of points
I think we need to know a little more about the table, such as: Are there columns specifying X and Y, or formulas, or a point object you can derive X and Y Coordinates from? Is there a column specifying the order that a point appears in the polyline? Is there more than one polyline? If so, is there a column specifying which polyline a row belongs to? If so, then it’s possible to write a MapBasic application to chain the points together. Some of the other listers may have even written such applications. Sort by (select statement with order by clause) polyline specifier and order specifier Iterate through the result table. For each record: if the line specifier changed, finish the current polyline (insert) and start a new one with the coordinates from current rec (Create Pline). If not, add the coordinates from the current rec to the end of the current line. (Alter Object Add Node) At the end, finish the current polyline. Hope this helps Spencer From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Silvester Sent: Wednesday, June 21, 2006 11:30 AM To: mapinfo-l@lists.directionsmag.com 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 GIS Manager GroundSure Limited Unit E, Level 7 New England House Brighton BN1 4GH Tel: +44 (0)1273 819500 (Switchboard) +44 (0)1273 647811 (Direct dial) Email: [EMAIL PROTECTED] This e-mail is private and confidential. Access by or disclosure to anyone other than the intended recipient for any reason other than the business purpose for which the message is intended, is unauthorised. If you are not the intended recipient, you must not act or omit to take any action based on this message. This e-mail and any views or opinions contained in it are subject to any terms and conditions agreed between GroundSure Limited and the recipient. All reasonable precautions have been taken to ensure no viruses are present in this e-mail. As GroundSure Limited cannot accept responsibility for loss or damage arising from the use of this e-mail or attachments we recommend that you subject these to your virus checking procedures prior to use. Copyright in documents created by or on behalf of this company remains vested in the company and we assert our moral rights, unless terms provide otherwise. ___ MapInfo-L mailing list MapInfo-L@lists.directionsmag.com http://www.directionsmag.com/mailman/listinfo/mapinfo-l
RE: [MI-L] Creating a line from a series of points
Title: RE: [MI-L] Creating a line from a series of points Hi all, I have mapped a points layer. I would like to select those records where there is more than 10 points within a radius of .5km. I'm having trouble even starting on this one! Can anyone provide some guidance/thoughts? Thanks Christine -Original Message- From: [EMAIL PROTECTED] on behalf of Spencer Simpson Sent: Wed 6/21/2006 11:34 AM To: 'Alan Silvester'; mapinfo-l@lists.directionsmag.com Subject: RE: [MI-L] Creating a line from a series of points I think we need to know a little more about the table, such as: 1. Are there columns specifying X and Y, or formulas, or a point object you can derive X and Y Coordinates from? 2. Is there a column specifying the order that a point appears in the polyline? 3. Is there more than one polyline? If so, is there a column specifying which polyline a row belongs to? If so, then it's possible to write a MapBasic application to chain the points together. Some of the other listers may have even written such applications. A. Sort by (select statement with order by clause) polyline specifier and order specifier B. Iterate through the result table. For each record: if the line specifier changed, finish the current polyline (insert) and start a new one with the coordinates from current rec (Create Pline). If not, add the coordinates from the current rec to the end of the current line. (Alter Object Add Node) C. At the end, finish the current polyline. Hope this helps Spencer _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Alan Silvester Sent: Wednesday, June 21, 2006 11:30 AM To: mapinfo-l@lists.directionsmag.com 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 GIS Manager GroundSure Limited Unit E, Level 7 New England House Brighton BN1 4GH Tel: +44 (0)1273 819500 (Switchboard) +44 (0)1273 647811 (Direct dial) Email: [EMAIL PROTECTED] This e-mail is private and confidential. Access by or disclosure to anyone other than the intended recipient for any reason other than the business purpose for which the message is intended, is unauthorised. If you are not the intended recipient, you must not act or omit to take any action based on this message. This e-mail and any views or opinions contained in it are subject to any terms and conditions agreed between GroundSure Limited and the recipient. All reasonable precautions have been taken to ensure no viruses are present in this e-mail. As GroundSure Limited cannot accept responsibility for loss or damage arising from the use of this e-mail or attachments we recommend that you subject these to your virus checking procedures prior to use. Copyright in documents created by or on behalf of this company remains vested in the company and we assert our moral rights, unless terms provide otherwise. ___ MapInfo-L mailing list MapInfo-L@lists.directionsmag.com http://www.directionsmag.com/mailman/listinfo/mapinfo-l
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 Kousgaardwww.routeware.dk - Original Message - From: Alan Silvester To: mapinfo-l@lists.directionsmag.com 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 MapInfo-L@lists.directionsmag.com http://www.directionsmag.com/mailman/listinfo/mapinfo-l
RE: [MI-L] Creating a line from a series of points
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 KousgaardSent: Thursday, June 22, 2006 7:40 AMTo: Mapinfo-LSubject: 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 Kousgaardwww.routeware.dk - Original Message - From: Alan Silvester To: mapinfo-l@lists.directionsmag.com 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 MapInfo-L@lists.directionsmag.com http://www.directionsmag.com/mailman/listinfo/mapinfo-l