Optimization for Spatial Query Processing