Refactor Location model to integrate PostGIS for spatial data, add legacy coordinate fields for compatibility, and enhance documentation for geocoding service implementation.

This commit is contained in:
pacnpal
2025-02-23 20:06:27 -05:00
parent 7e5d15eb46
commit f15392806a
8 changed files with 723 additions and 109 deletions

View File

@@ -0,0 +1,75 @@
# GeocodeService Implementation Prompt
## Context
Continue ThrillWiki Laravel+Livewire development, focusing on implementing the GeocodeService for the Location System. The Location model and HasLocation trait are complete, providing the foundation for location management.
## Key Memory Bank Files
1. memory-bank/activeContext.md - Current progress and next steps
2. memory-bank/features/LocationSystem.md - System design and implementation plan
3. memory-bank/models/LocationModel.md - Location model documentation
4. memory-bank/traits/HasLocation.md - HasLocation trait documentation
## Current Progress
- ✅ Created Location model with polymorphic relationships
- ✅ Implemented HasLocation trait
- ✅ Set up location-based queries and calculations
- ✅ Added comprehensive documentation
## Next Implementation Steps
1. Create GeocodeService
- API integration
- Address lookup
- Coordinate validation
- Batch processing
- Cache management
2. Implement Location Components
- Map integration
- Location selection
- Search functionality
- Clustering support
## Technical Requirements
### GeocodeService Features
- Address to coordinates conversion
- Reverse geocoding (coordinates to address)
- Batch geocoding support
- Result caching
- Error handling
- Rate limiting
- Validation
### Integration Points
- Location model geocoding methods
- HasLocation trait helpers
- Component integration
- Cache system
### Performance Considerations
- Cache geocoding results
- Implement request batching
- Handle API rate limits
- Optimize response storage
## Development Guidelines
- Follow Memory Bank documentation practices
- Document technical decisions
- Update activeContext.md after each step
- Create comprehensive service tests
- Consider error handling and edge cases
## Project Stack
- Laravel for backend
- Livewire for components
- PostgreSQL for database (with PostGIS extension)
- Memory Bank for documentation
## PostgreSQL Spatial Features
- Using PostGIS for spatial operations
- Native coordinate type (POINT)
- Efficient spatial indexing
- Advanced distance calculations
- Geographic vs Geometric types
Continue implementation following established patterns and maintaining comprehensive documentation.