As always, you want to cut out any foreground elements that could confuse the 3D Camera Tracker. Duplicate the base footage layer and add a mask over only the city part of the footage. I don't want to include me in the mask so the tracker has a better chance of tracking the static geometry of the scene.
If the aim of the camera changes throughout the shot like it does in the clip I'm using here, animate the mask path so that it follows the city and avoids any moving foreground elements (like me) getting into the area of the mask. You want to do this fairly precisely to ensure your moving foreground elements stay out of the way of the camera tracker.
Now apply the 3D Camera Tracker effect to the new composition. If your shot is rather complex, try to check the 'Detailed Analysis' option under the Advanced settings. Go get some coffee and wait until the tracker has completed its work.
Once you tracked your footage you should see a large number of track points overlayed onto your footage. If that is not the case, something might have gone wrong and you may have to adjust your 3D Camera Tracker settings and try again. Depending on your footage, you may also see the message in the screenshot below:
'No depth from a tripod pan solve' indicates that because your camera did not move in/out of the scene very much, the 3D Camera Tracker was not able to figure out how far the objects in your scene are from one another. If all you did was pan the camera around as if it was fixed on a tripod, this is the expected outcome.
Most of the time, as with the shot above, you will find that it's actually not a problem because the shot itself only has horizontal or panning camera movement and it therefore doesn't matter whether your tracking data contains depth or not. For the building destruction effect we will be placing the fake building and the explosions in the back of the scene and the camera only pans so it does not matter.We are now ready to place the fake building into our scene!