There are a number of situations where the length of a pipe must be determined by means other than just measuring it with a ruler or tape measure. One is when the pipe is buried or submerged for much of its length, or otherwise inaccessible. Another might be that the pipe is too long for classic measurement means. It is possible to calculate pipe length by using other related measurements in either of these two scenarios.
Things You'll Need
 Calculator
 Physical data for pipe type
Internal volume method

Define the pipe line in question. In this example, a buttwelded 1inch Schedule 40 steel water pipeline of unknown length is run throughout an industrial facility. If it takes 9.24gallons of water to completely fill the pipeline from empty, you can calculate pipe length.

Calculate the volume of one foot of 1inch Schedule 40 steel pipe. Published data shows that the internal diameter is 1.05inches. Using the volume formula for cylinders, V= (diameter/2)^2 X pi X length X 7.48 gallons/cubic foot. Substituting terms V = (1.05/2) ^squared X 3.1416 X 12 = 0.0449788gallons/foot of pipe.

Calculate the length of the pipe by dividing its 9.24gallon internal volume by 0.0449788gallons/foot of pipe to yield 205.43feet. Since the pipe is buttwelded from the outside, there are no fittings or intrusions to affect this volume, and the pipe can be considered uniformly smooth on the inside, and the 205.43foot length accurate.
Flow HeadLoss Method

Define the pipe line in question. Using the same case as Section 1, a buttwelded 1inch Schedule 40 steel water pipeline of unknown length is run throughout an industrial facility. When a precise 10gallonperminute (gpm) flow is metered through the pipe, the 60poundpersquareinch (psi) entry flow drops by 5.91psi. You can calculate pipe length from this information.

Look up the pressureloss data for 1inch Schedule 40 steel pipe. The chart shows that at 9.5gpm, water loses 2.6psi per 100feet of pipe.

Adjust the published data for your measured example. Since the flow increases as a function of the square root of pressure difference, then (10 gpm/9.5gpm)^2 (squared) = 1.108, or the proportionally greater pressure loss your length of pipe will see as a result of the greater flow. Multiplying 2.6psi by 1.108 = 2.881 is the calculated loss for 100feet of your pipe at 10 gpm.

Calculate your actual pipe length by dividing your measured 5.91psi pressure drop by 2.881psi/100 feet of pipe = 205.14feet of pipe, based on pressure drop. This compares reasonably with the 205.43foot calculated length of Section 1.
Tips & Warnings
 Pipe physical data and flow loss data are invaluable for all engineering calculations regarding pipes.
 Pressure ratings of piping systems should always be considered before using a pipe line for a highly pressurized system.
References
 Photo Credit steel image by Oleg Guryanov from Fotolia.com lloyds of london image by Fyerne from Fotolia.com Steam Pipes image by Andrei Merkulov from Fotolia.com