fix: bboxes précises par île (Basse-Terre, Grande-Terre, Désirade séparés), requête Overpass élargie

This commit is contained in:
Gwadaking
2026-04-09 00:46:09 -04:00
parent ddfa6a3ecb
commit 9143cf857d

View File

@@ -22,15 +22,19 @@ class ImportCoastalPointsCommand extends Command
// bbox format Overpass : sud,ouest,nord,est
private const ISLANDS = [
'Guadeloupe' => ['bbox' => '15.7,-62.0,16.7,-60.8', 'region' => 'Guadeloupe'],
'Martinique' => ['bbox' => '14.3,-61.3,14.9,-60.7', 'region' => 'Martinique'],
'Sainte-Lucie' => ['bbox' => '13.7,-61.1,14.2,-60.8', 'region' => 'Sainte-Lucie'],
'Barbade' => ['bbox' => '13.0,-59.8,13.4,-59.3', 'region' => 'Barbade'],
'Saint-Martin' => ['bbox' => '17.8,-63.2,18.2,-62.9', 'region' => 'Saint-Martin'],
'Dominique' => ['bbox' => '15.2,-61.5,15.7,-61.2', 'region' => 'Dominique'],
'Saint-Barthélemy' => ['bbox' => '17.85,-62.9,17.98,-62.7', 'region' => 'Saint-Barthélemy'],
'Marie-Galante' => ['bbox' => '15.8,-61.4,16.1,-61.1', 'region' => 'Guadeloupe'],
'Les Saintes' => ['bbox' => '15.8,-61.7,15.9,-61.5', 'region' => 'Guadeloupe'],
// Guadeloupe : Basse-Terre + Grande-Terre séparés pour éviter que la bbox
// englobe trop de mer et rate des côtes
'Basse-Terre' => ['bbox' => '15.82,-61.82,16.52,-61.55', 'region' => 'Guadeloupe'],
'Grande-Terre' => ['bbox' => '15.97,-61.55,16.52,-61.07', 'region' => 'Guadeloupe'],
'Marie-Galante' => ['bbox' => '15.83,-61.40,16.08,-61.10', 'region' => 'Guadeloupe'],
'La Désirade' => ['bbox' => '16.27,-61.10,16.37,-60.82', 'region' => 'Guadeloupe'],
'Les Saintes' => ['bbox' => '15.83,-61.68,15.90,-61.55', 'region' => 'Guadeloupe'],
'Martinique' => ['bbox' => '14.38,-61.25,14.88,-60.80', 'region' => 'Martinique'],
'Sainte-Lucie' => ['bbox' => '13.70,-61.10,14.15,-60.85', 'region' => 'Sainte-Lucie'],
'Barbade' => ['bbox' => '13.00,-59.80,13.40,-59.40', 'region' => 'Barbade'],
'Saint-Martin' => ['bbox' => '17.85,-63.20,18.18,-62.95', 'region' => 'Saint-Martin'],
'Saint-Barthélemy' => ['bbox' => '17.85,-62.90,17.98,-62.78', 'region' => 'Saint-Barthélemy'],
'Dominique' => ['bbox' => '15.20,-61.50,15.65,-61.24', 'region' => 'Dominique'],
];
public function __construct(
@@ -82,7 +86,7 @@ class ImportCoastalPointsCommand extends Command
foreach ($elements as $el) {
$osmId = $el['type'] . '/' . $el['id'];
$osmName = $el['tags']['name'] ?? null;
$osmName = $el['tags']['name'] ?? $el['tags']['name:fr'] ?? null;
if ($osmName === null) {
continue;
@@ -143,16 +147,24 @@ class ImportCoastalPointsCommand extends Command
private function queryOverpass(string $bbox, SymfonyStyle $io): array
{
$query = <<<OVERPASS
[out:json][timeout:30];
[out:json][timeout:40];
(
node["natural"="beach"]["name"]({$bbox});
node["natural"="beach"]["name:fr"]({$bbox});
node["leisure"="beach_resort"]["name"]({$bbox});
node["leisure"="marina"]["name"]({$bbox});
node["harbour"="fishing"]["name"]({$bbox});
node["harbour"]["name"]({$bbox});
node["seamark:type"="harbour"]["name"]({$bbox});
node["amenity"="ferry_terminal"]["name"]({$bbox});
node["sport"="surfing"]["name"]({$bbox});
node["waterway"="dock"]["name"]({$bbox});
way["natural"="beach"]["name"]({$bbox});
way["natural"="beach"]["name:fr"]({$bbox});
way["leisure"="beach_resort"]["name"]({$bbox});
way["leisure"="marina"]["name"]({$bbox});
way["harbour"="fishing"]["name"]({$bbox});
way["harbour"]["name"]({$bbox});
relation["natural"="beach"]["name"]({$bbox});
relation["natural"="beach"]["name:fr"]({$bbox});
);
out center;
OVERPASS;