The petition may be filed in the court of the county in which the land, or any part of it lies, or in which the defendant resides. If all the claimants join in the petition, or assent to the partition, it may be filed in any county in the state, whether any of the land lies therein or not.