Add REST API and address search features with Dutch municipality name handling
This commit adds two major features to the pakketpunten webapp:
1. REST API (OpenAPI 3.0.3 compatible):
- Endpoint: GET /api/v1/municipality/{identifier}
- Supports 3 identifier types: municipality name, slug, CBS code
- Rate limiting: 100 requests per 15 minutes
- CORS enabled for public access
- Interactive Redocly documentation at /api/v1/docs
- CBS codes merged into municipalities.json (342 municipalities)
2. Address Search with Autocomplete:
- Real-time address search using PDOK Locatieserver API
- Autocomplete suggestions with 300ms debounce
- Keyboard navigation support (arrows, Enter, Escape)
- Automatic municipality switching and map zoom to address
- Comprehensive Dutch municipality name mapping for edge cases
Dutch Municipality Name Handling:
- Apostrophe cases: 's-Gravenhage → Den Haag, 's-Hertogenbosch → s-Hertogenbosch
- Bergen disambiguation: Bergen (NH) → Bergen (NH.), Bergen (L) → Bergen (L.)
- Regional identifiers: Hengelo (O), Beek (L), Laren (NH), Middelburg (Z), Rijswijk (ZH), Stein (L) mapped to simplified names
- Handles all 13 known Dutch places starting with 's-
Bug Fixes:
- Fixed font size inconsistency between municipality selector and address search
- Fixed map zoom behavior - now stays at searched address instead of zooming back out
- Fixed TypeScript build error with Redoc custom element
Files Added:
- webapp/app/api/v1/municipality/[identifier]/route.ts - REST API endpoint
- webapp/app/api/v1/docs/page.tsx - Redocly documentation page
- webapp/app/api/geocode/route.ts - PDOK proxy API for address search
- webapp/components/AddressSearchInput.tsx - Address search component
- webapp/public/openapi.yaml - OpenAPI 3.0.3 specification
- webapp/types/redoc.d.ts - TypeScript declarations for Redoc
- scripts/merge_cbs_codes.py - Script to merge CBS codes
- data/cbs_municipality_areas.json - CBS municipality data
- docs/NEW_FEATURES.md - Comprehensive documentation
Files Modified:
- webapp/app/page.tsx - Integrated address search with coordinate handling
- webapp/components/Map.tsx - Enhanced zoom behavior for address search
- webapp/next.config.ts - Added CSP rules for Redocly CDN
- webapp/public/municipalities.json - Added CBS codes to all 342 municipalities
- webapp/components/AboutModal.tsx - Minor updates
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>