A new numerical method to generate spatially variant lattices (SVLs) is derived and implemented. The algorithm proposed solves the underlying partial differential equations iteratively with an update equation derived using the finite-difference method to obtain an SVL that is continuous, smooth, and free of unintended defects while maintaining the unit cell geometry throughout the lattice. This iterative approach is shown to be more memory-efficient when compared to the matrix-based approach and is, thus, suitable for the calculation of large-scale SVLs. The iterative nature of the solver allows it to be easily implemented in graphics processing unit to parallelize the computation of SVLs. Two spatially variant self-collimating photonic crystals are generated and simulated to demonstrate the functionality of the algorithm as a tool to generate fully three-dimensional photonic devices of realistic size.