The application requirement of Geospatial data is increasing and complex as it is getting numerous as a result of furthering study on geosciences. Based on a deeply research on Oracle Spatial storage management mechanism, this paper proposed a method that applies the graph theory to domain of optimizing spatial query of massive geographical data, and established a geospatial data query model in order to settle a problem of lower spatial query efficiency in geospatial database. Combining with the practical applications, this paper did a conventional spatial query test and a spatial query based on geospatial data model respectively. The result is that the spatial query based on geospatial data query model has a better efficiency than that on conventional method. Besides, this model can greatly improve the spatial query performance and this improvement will be increasingly apparent as the data volume increases.