A Redis Stack-based geospatial search API for managing and querying gas stations. This project demonstrates storing, retrieving, and searching geospatial data using Redis GEO commands in ASP.NET Core.
- Store gas stations with geospatial coordinates in Redis
- Search gas stations within a bounding box
- Find the nearest gas station to a coordinate
- Seed sample gas stations automatically via a background service
- Use aversine distance formula.
- ASP.NET Core 7
- C# 11
- StackExchange.Redis (v2.7+) for Redis Stack integration
- Redis Stack (with GEO support)
- .NET 7 SDK
- Redis Stack running locally or in Docker
- (Optional) VS Code with REST Client extension for testing
git clone https://github.com/mahdidelzendeh72/Geo-Search.git
cd Geo-SearchConfigure Redis Connection
{
"ConnectionStrings": {
"Redis": "localhost:6379"
}
}Run the Application
dotnet runAPI Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/gasstationgeo/set |
POST | Add or update gas station geo data |
/api/gasstationgeo/search-bounding-box |
POST | Search gas stations within a bounding box |
/api/gasstationgeo/find-nearest-gas-station |
POST | Find the nearest gas station to a coordinate |