Home 
General /
All posts  Create perpendicular lines with specific midpoint

Attached is a project containing a drawing: "Lines Points". It contains a line and points at regular intervals along the line. What I need is a script and/or query that will: Create line objects of 10 metre length with midpoint being each of the points, and perpendicular to the direction of the existing line object at each point. Any ideas? Attachments: create_perp_lines_midpoint.map
"The blessing in life is finding the torture you are comfortable with."  Jerry Seinfeld, 6/26/2013 

I did something like this once but cant find it now. There are probably better ways, but as I remember, what I did was: 1. Create a linepart whose center would be the line point and make it 10m long. 3. Rotate this around the line point taking the bearing from the line.
Landsystems Ltd ... Know your land  www.landsystems.co.nz 
qwasdo133 post(s) 
Attached is the project with a spatial Query to select and build perpendicular lines. The quick and dirty way: 1. Normalize Topology on the "Lines Points" Drawing to get line segments. Each of this segments has now a Bearing (I). 2. Create new Column for an spatial index to build a relation between Points and the Line. In this example we have the Points show the end nodes of the Line Segments. For an accurate Bearing (I) transformation from lines to points, the points should reside on the center of the line. Anyway in this case I deleted the curved line segment. 3. Create a new Drawing for each geometry type. 4. Build a realation in the Points table on the Line table using the spatial index. Choose at least Bearing (I). 5. Run the Query and link it as a new Drawing. Attachments: create_perp_lines_midpoint.map


Thanks for the responses! Qwasdo, your query works great. However, I do need to incorporate the curves into it. I was going to create a tiny buffer (10 cm) around each point, then clip the lines with those buffers, and use the tiny lines inside the buffers for the bearing from which I would calculate the perpendicular. I think I can take what you've written and build on it to do that. danb, I'd like to see your linepart method, if you can find it or recreate it. Thanks!
"The blessing in life is finding the torture you are comfortable with."  Jerry Seinfeld, 6/26/2013 

firsttube, I should have time to have a better look today.
Landsystems Ltd ... Know your land  www.landsystems.co.nz 

this is what I was thinking of though unfortunately, it isn't going to help you much in its current form: OPTIONS COORDSYS("Lines Points" AS COMPONENT); SELECT RotateAbout([GEOM], [LPGEOM], 90)[GEOM] FROM (SELECT LinePart([ID], (([Length (I)]/2)5), (([Length (I)]/2)+5))[GEOM], LinePoint([Geom (I)], [Length (I)]/2)[LPGEOM] FROM [Lines Points]);
Landsystems Ltd ... Know your land  www.landsystems.co.nz 
qwasdo133 post(s) 
Dan, RotadeAbout is a nice slq function I never thought about before. But LinePart(geom, f, t[, unit]): Returns that part of a line between specified distance limits on given line. Both distances are measured from the start of the line and continue between branches. If the line part is bent, you don't get a straight perpendicular line to the first one, even using a rotation angel of 90°.


My purpose was quite different from firsttube's and I thought what I had might be of use, but perhaps not.
Landsystems Ltd ... Know your land  www.landsystems.co.nz 
qwasdo133 post(s) 
Firsttube, I didn't want to rip off your curves, therefore a new map file just with rounded lines. I don't know how Mfd calculates the Bearing (I) of single branched curves, but I guess the average bearing of all segments of the line is taken. Assuming this I picked up your buffer idea to generate perpendicular lines. I seperated line and point geometries from the start and used a helper drawing to figure out the min. buffer width so buffers won't overlap (this step could be improoven). The points drawing intersects on the line, eigther on node points or on segments. Just refresh the linked drawings and enjoy. Attachments: create_perp_lines_midpoint_withBuffer.map
