Mapping the Milky Way with LAMOST I: method and overview