As hard as this is to believe, very little of The Avengers was shot in New York City, including the epic finale. To pull off the trick, the Industrial Light and Magic crew created an intricately detailed 20-block "digital playground" that was mapped against the real thing. Check out this video to see how they pulled it off.

Writing in fstoppers, Trevor Dayley breaks it down:

- While the movie plot takes place in New York, all but the aerial footage was filmed elsewhere.
- The shots of the actors down on the streets of New York City was actually captured in New Mexico on a green screen set and parts of it in streets of Cleveland.
- A CGI playground covering 20 blocks of the city had to be recreated.
- The team photographed 7 miles of streets, from cranes, on top of 35 different buildings, from every angle possible shooting a total of over 250,000 photos.
- From the photos they recreated over 2000 different reality spheres which were projected onto the geometry of the buildings in the computer and used to recreate New York City.
- The team had to then paint out all the trees, cars, and people from the photos to then recreate digitally so they could show movement.
- For the night shots, they used photos of their own office building rooms and used those to recreate offices lit up in the buildings at night.

Via fstoppers via engadget.