I have a table with X, Y, and Z coordinates and trying to make a LINESTRING

• Question

• But how do I make a LINESTRING with them?

Now this works below but notice it has just and X and Y coordinate.

INSERT INTO Wells.[Shapes](UWI,CompletionDate,GeomShape)
VALUES(05123050300000,'2016/05/05',geometry::STGeomFromText('LINESTRING (100 100, 20 180, 180 180)', 0))

The first table I have has many points that relate to one well id. The table has all three, x,y, and z. I can read all the points for that one well and then make a LINESTRING but the 'z' coordinate I have no idea where to put.

Is it this way::

INSERT INTO MinOwn.ihs.[297Shapes](UWI,CompletionDate,GeomShape)
VALUES(05123050300000,'2016/05/05',geometry::STGeomFromText('LINESTRING (100 100 99, 20 180 94, 180 180 77)', 0))

Where the extra 99 or 94 or 77 is the 'Z' coordinate?

Thanks!

Friday, May 20, 2016 6:35 PM

• Yes, in the well-known text representation, it's the third coordinate. Like you did after "is it this way".

Also, bear in mind that functionality of the Z coordinate is severely limited, from BOL: "Z-coordinates are not used in any calculations made by the library and is not carried through any library calculations."

• Marked as answer by Friday, May 20, 2016 8:58 PM
Friday, May 20, 2016 7:27 PM

All replies

• Yes, in the well-known text representation, it's the third coordinate. Like you did after "is it this way".

Also, bear in mind that functionality of the Z coordinate is severely limited, from BOL: "Z-coordinates are not used in any calculations made by the library and is not carried through any library calculations."

• Marked as answer by Friday, May 20, 2016 8:58 PM
Friday, May 20, 2016 7:27 PM
• Thanks. That confirmed what I thought. Now I will generate the lines and use ArcGIS to make the lines on the map (I hope!)

Paul

Friday, May 20, 2016 8:58 PM