# 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.