What Caused the Battle of Gettysburg?

Lee had an idea that he could catch the Union soldiers when they were spread out. It was not the case. Plus, the area was a strong hold.