Find Nearby Venues
Search for active venues within a specified radius of a geographic location. This endpoint uses PostGIS geospatial indexing for efficient proximity searches.Query Parameters
Latitude of the search center point (range: -90 to 90)Example:
41.3851 (Barcelona, Spain)Longitude of the search center point (range: -180 to 180)Example:
2.1734 (Barcelona, Spain)Search radius in metersDefault: 5000 (5 km)Examples:
1000- 1 kilometer5000- 5 kilometers (default)10000- 10 kilometers
Response
Returns an array of venue objects within the specified radius, sorted by distance from the search point.Unique identifier for the venue
ID of the venue owner
Venue name
Venue description
Street address
City
Country
Postal/ZIP code
Latitude coordinate of the venue
Longitude coordinate of the venue
Venue status (only ACTIVE venues are returned)
Reason for rejection (null for active venues)
Number of active resources at this venue (null in nearby search)
Creation timestamp
Last update timestamp
Example Searches
Search Near Barcelona City Center
Search Near Madrid
Search with Default Radius
Geospatial Implementation
This endpoint leverages PostGIS spatial indexing for high-performance proximity searches. The database uses the
ST_DWithin function to efficiently query venues within the specified radius.How It Works
- Coordinate System: The API uses the WGS 84 coordinate system (SRID 4326) for latitude/longitude values
- Distance Calculation: PostGIS calculates great-circle distances on the Earth’s surface
- Spatial Index: A GiST index on the coordinates column enables efficient geographic queries
- Active Only: Only venues with status
ACTIVEare included in search results
Performance Characteristics
- Typical Response Time: < 100ms for searches returning up to 100 venues
- Scalability: Spatial index ensures logarithmic query time regardless of database size
- Accuracy: Great-circle distance calculations accurate to within meters
Use Cases
- Mobile Apps: “Find courts near me” feature using device GPS
- Map Interfaces: Display venues on interactive maps with dynamic radius
- Location-Based Booking: Show available courts within walking/driving distance
- Coverage Analysis: Identify underserved areas for new venue opportunities
Common Coordinate Examples
| City | Latitude | Longitude | Example Query |
|---|---|---|---|
| Barcelona, Spain | 41.3851 | 2.1734 | ?lat=41.3851&lng=2.1734&radiusMeters=5000 |
| Madrid, Spain | 40.4168 | -3.7038 | ?lat=40.4168&lng=-3.7038&radiusMeters=5000 |
| London, UK | 51.5074 | -0.1278 | ?lat=51.5074&lng=-0.1278&radiusMeters=5000 |
| Paris, France | 48.8566 | 2.3522 | ?lat=48.8566&lng=2.3522&radiusMeters=5000 |
| New York, USA | 40.7128 | -74.0060 | ?lat=40.7128&lng=-74.0060&radiusMeters=5000 |
Best Practices
Choosing the Right Radius
- Urban Areas: 1-3 km (users willing to travel shorter distances)
- Suburban Areas: 5-10 km (more spread out venues)
- Rural Areas: 15-25 km (fewer venues, longer travel acceptable)