Cơ sở dữ liệu không gian dần trở nên phổ biến và được sử dụng rộng rãi trong nhiều lĩnh vực nhờ sự phát triển của công nghệ trong việc thu thập dữ liệu. Lượng cơ sở dữ liệu không gian phong phú được thu thập từ các vệ tinh, cảm biến và các thiết bị khác có thể giúp cải thiện kết quả của các tác vụ phân tích nhưng cũng tạo ra thử thách trong việc xử lý dữ liệu. Một số công trình nghiên cứu đã đề ra các giải pháp xử lý đối với cơ sở dữ liệu không gian có kích thước lớn như tạo chỉ mục, thu giảm số chiều dữ liệu. Trong bài báo này, chúng tôi sẽ trình bày hai phương pháp để tối ưu việc lưu trữ và truy vấn dữ liệu không gian. Thứ nhất, chúng tôi đề xuất một phương pháp nén hình ảnh dạng raster để thu giảm kích thước nhưng không mất thông tin của dữ liệu. Ngoài ra, chúng tôi cũng đưa ra một số kỹ thuật để tối ưu thời gian thực thi câu truy vấn. Kết quả cho thấy phương pháp đề xuất của chúng tôi giúp cải thiện thời gian thực thi truy vấn đồng thời thu giảm được không gian lưu trữ dữ liệu.Due to recent technological developments that have facilitated the collection of large amounts of data, spatial data has become popular and has been widely used in many areas. The rich spatial datasets, which come from satellites, sensors, and other devices, can help improve results in data analysis tasks. However, it is also a challenge to address the complexity of data processing. There has been some research work that proposed methods for handling large spatial databases, such as indexing spatial data, reducing the dimension of spatial data. In this paper, we present two effective methods for optimizing storing and querying spatial data. In our method, we devised an image compression method that helps in reducing the size of raster images but retains meaningful properties of the original data. Furthermore, we implemented some query techniques to decrease the query execution time for spatial data. Experimental results show that our proposed methods not only improve the time of data query but also reduce the storage space.