Extended Kalman Filter (EKF) is the conventional method for real-time kinematic (RTK) positioning. This paper investigates an alternative approach that implements factor graph optimization (FGO) for post-processing RTK in urban environments. In the factor graph-based framework, the pseudorange, carrier-phase and Doppler measurements have been applied to construct five types of factors to evaluate the float solutions, after which the integer ambiguities can be resolved independently between epochs. Then the second factor graph-based optimization has been proposed in this paper that the fixed integer ambiguities are connected with the ambiguities to be estimated on neighbor epochs. A practical vehicular test in urban environments shows that, compared with the EKF based positioning performance, the FGO based RTK provides smoother positioning results and can obtain higher positioning accuracy and fix rates with the second optimization.