connection in fire main. the limitations (length of pipe) on where i can use flanges, threaded or welded connection. and distance of the flanges to the wall.
Flanges can generally be used anywhere. As far as distances to walls, you need to know the size of the flange, then give enough distance for an installer to be able to use tools to install.
For example, a 6" flange has an 11" outside diameter. You could push it as close as 6" centerline to a wall. However, your installer may want to beat you with it as it will be difficult, to near impossible to install.