feat: Gestion des secteurs et migration v3.0.4+304
- Ajout système complet de gestion des secteurs avec contours géographiques - Import des contours départementaux depuis GeoJSON - API REST pour la gestion des secteurs (/api/sectors) - Service de géolocalisation pour déterminer les secteurs - Migration base de données avec tables x_departements_contours et sectors_adresses - Interface Flutter pour visualisation et gestion des secteurs - Ajout thème sombre dans l'application - Corrections diverses et optimisations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
28
api/migration_add_departements_contours.sql
Normal file
28
api/migration_add_departements_contours.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- Table pour stocker les contours (polygones) des départements
|
||||
CREATE TABLE IF NOT EXISTS `x_departements_contours` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`code_dept` varchar(3) NOT NULL COMMENT 'Code département (22, 2A, 971...)',
|
||||
`nom_dept` varchar(100) NOT NULL,
|
||||
`contour` POLYGON NOT NULL COMMENT 'Polygone du contour du département',
|
||||
`bbox_min_lat` decimal(10,8) DEFAULT NULL COMMENT 'Latitude min de la bounding box',
|
||||
`bbox_max_lat` decimal(10,8) DEFAULT NULL COMMENT 'Latitude max de la bounding box',
|
||||
`bbox_min_lng` decimal(11,8) DEFAULT NULL COMMENT 'Longitude min de la bounding box',
|
||||
`bbox_max_lng` decimal(11,8) DEFAULT NULL COMMENT 'Longitude max de la bounding box',
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_code_dept` (`code_dept`),
|
||||
SPATIAL KEY `idx_contour` (`contour`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Index pour améliorer les performances
|
||||
CREATE INDEX idx_dept_bbox ON x_departements_contours (bbox_min_lat, bbox_max_lat, bbox_min_lng, bbox_max_lng);
|
||||
|
||||
-- Exemples d'insertion (à remplacer par les vraies données)
|
||||
-- Les coordonnées doivent être dans l'ordre : longitude latitude
|
||||
-- Le polygone doit être fermé (premier point = dernier point)
|
||||
/*
|
||||
INSERT INTO x_departements_contours (code_dept, nom_dept, contour, bbox_min_lat, bbox_max_lat, bbox_min_lng, bbox_max_lng) VALUES
|
||||
('22', 'Côtes-d\'Armor', ST_GeomFromText('POLYGON((-3.65 48.90, -2.00 48.90, -2.00 48.05, -3.65 48.05, -3.65 48.90))'), 48.05, 48.90, -3.65, -2.00),
|
||||
('29', 'Finistère', ST_GeomFromText('POLYGON((-5.14 48.75, -3.38 48.75, -3.38 47.64, -5.14 47.64, -5.14 48.75))'), 47.64, 48.75, -5.14, -3.38);
|
||||
*/
|
||||
Reference in New Issue
Block a user