mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-09 17:02:46 +02:00
bubble fraicheur des completions ajouté
This commit is contained in:
parent
cd8369d08c
commit
93086eba60
18 changed files with 179 additions and 66 deletions
|
@ -252,16 +252,21 @@ out meta;';
|
|||
}
|
||||
|
||||
public function get_city_osm_from_zip_code($zip_code) {
|
||||
// Détection spéciale pour Paris, Lyon, Marseille
|
||||
if (preg_match('/^75(0[1-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9])$/', $zip_code)) {
|
||||
$arr = intval(substr($zip_code, 2, 3));
|
||||
return 'Paris ' . $arr . 'e arr.';
|
||||
}
|
||||
if (preg_match('/^69(0[1-9]|1[0-9]|2[0-9])$/', $zip_code)) {
|
||||
$arr = intval(substr($zip_code, 2, 3));
|
||||
return 'Lyon ' . $arr . 'e arr.';
|
||||
}
|
||||
if (preg_match('/^13(0[1-9]|1[0-6])$/', $zip_code)) {
|
||||
$arr = intval(substr($zip_code, 2, 3));
|
||||
return 'Marseille ' . $arr . 'e arr.';
|
||||
}
|
||||
// Requête Overpass pour obtenir la zone administrative de niveau 8 avec un nom
|
||||
$query = "[out:json][timeout:25];
|
||||
area[\"ref:INSEE\"=\"{$zip_code}\"]->.searchArea;
|
||||
(
|
||||
relation[\"admin_level\"=\"8\"][\"name\"][\"type\"=\"boundary\"][\"boundary\"=\"administrative\"](area.searchArea);
|
||||
);
|
||||
out body;
|
||||
>;
|
||||
out skel qt;";
|
||||
|
||||
$query = "[out:json][timeout:25];\n area[\"ref:INSEE\"=\"{$zip_code}\"]->.searchArea;\n (\n relation[\"admin_level\"=\"8\"][\"name\"][\"type\"=\"boundary\"][\"boundary\"=\"administrative\"](area.searchArea);\n );\n out body;\n >;\n out skel qt;";
|
||||
$response = $this->client->request('POST', $this->overpassApiUrl, [
|
||||
'body' => ['data' => $query]
|
||||
]);
|
||||
|
@ -389,10 +394,6 @@ out meta;';
|
|||
|
||||
|
||||
|
||||
public static function uuid_create_static() {
|
||||
return $this->uuid_create();
|
||||
}
|
||||
|
||||
public function uuid_create() {
|
||||
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
// 32 bits for "time_low"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue