mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-10-04 17:04:53 +02:00
fix export CSV
This commit is contained in:
parent
2ea7f7711f
commit
8136d8e0cb
3 changed files with 12 additions and 36 deletions
|
@ -312,7 +312,7 @@ class Place
|
|||
$noteContent .= "FIXME: " . $tags['fixme'];
|
||||
$hasNote = true;
|
||||
}
|
||||
$this->setNoteContent($noteContent ?: null);
|
||||
$this->setNoteContent($noteContent ? $noteContent : null);
|
||||
$this->setHasNote($hasNote);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class Motocultrice
|
|||
|
||||
public $overpass_base_places = '
|
||||
(
|
||||
nw["amenity"~"^(cafe|bar|restaurant|library|cinema|fast_food|post_office|marketplace|community_centre|theatre|bank|townhall|animal_boarding|animal_breeding|animal_shelter|animal_training|archive|arts_centre|bank|bar|bicycle_rental|biergarten|boat_rental|boat_storage|bureau_de_change|cafe|canteen|car_rental|car_wash|casino|childcare|clinic|college|conference_centre|courthouse|coworking_space|crematorium|dancing_school|dentist|dive_centre|doctors)$"](area.searchArea);
|
||||
nw["amenity"~"^(cafe|bar|restaurant|library|cinema|fast_food|post_office|marketplace|community_centre|theatre|bank|townhall|animal_boarding|animal_breeding|animal_shelter|animal_training|archive|arts_centre|bicycle_rental|biergarten|boat_rental|boat_storage|bureau_de_change|canteen|car_rental|car_wash|casino|childcare|clinic|college|conference_centre|courthouse|coworking_space|crematorium|dancing_school|dentist|dive_centre|doctors)$"](area.searchArea);
|
||||
nw["shop"](area.searchArea);
|
||||
nw["tourism"~"^(hotel|hostel|motel|wilderness_hut|yes|chalet|gallery|guest_house|museum|zoo|theme_park|aquarium|alpine_hut|apartment)$"](area.searchArea);
|
||||
nw["healthcare"](area.searchArea);
|
||||
|
@ -85,23 +85,25 @@ public function find_siret($tags) {
|
|||
public function export($zone) {
|
||||
$query = $this->get_export_query($zone);
|
||||
try {
|
||||
$response = $this->client->request('GET', 'https://overpass-api.de/api/interpreter', [
|
||||
'query' => [
|
||||
'data' => $query
|
||||
]
|
||||
$response = $this->client->request('POST', 'https://overpass-api.de/api/interpreter', [
|
||||
'body' => ['data' => $query],
|
||||
'timeout' => 120 // Augmenter le timeout pour les exports CSV
|
||||
]);
|
||||
|
||||
if ($response->getStatusCode() !== 200) {
|
||||
throw new \Exception('L\'API Overpass a retourné un code de statut non-200 : ' . $response->getStatusCode());
|
||||
}
|
||||
|
||||
return $response->getContent();
|
||||
} catch (\Exception $e) {
|
||||
return "Erreur lors de la requête Overpass : " . $e->getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function get_export_query($zone) {
|
||||
return <<<QUERY
|
||||
[out:csv(::id,::type,::lat,::lon,::timestamp,::version,::user,::uid,::changeset,name,amenity,shop,office,healthcare,"contact:email",email,"contact:phone",phone,"contact:website",website,image,url,wikidata, opening_hours,"contact:housenumber","addr:housenumber","contact:street","addr:street",note,fixme,harassment_prevention,cuisine,brand,tourism,source,zip_code,"ref:FR:SIRET")];
|
||||
{{geocodeArea:"{$zone}, France"}}->.searchArea;
|
||||
[out:csv(::id,::type,::lat,::lon,::timestamp,::version,::user,::uid,::changeset,name,amenity,shop,office,healthcare,"contact:email",email,"contact:phone",phone,"contact:website",website,image,url,wikidata,opening_hours,"contact:housenumber","addr:housenumber","contact:street","addr:street",note,fixme,harassment_prevention,cuisine,brand,tourism,source,zip_code,"ref:FR:SIRET")];
|
||||
area["ref:INSEE"="{$zone}"]->.searchArea;
|
||||
{$this->overpass_base_places}
|
||||
out meta;
|
||||
QUERY;
|
||||
|
|
|
@ -208,33 +208,7 @@
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="table-container">
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">
|
||||
<i class="bi bi-search"></i>
|
||||
</span>
|
||||
<input type="text" id="stats-table-search" class="form-control" placeholder="Filtrer les lieux...">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-outline-secondary" id="export-selected">
|
||||
<i class="bi bi-download"></i> Exporter sélection
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary" id="select-all">
|
||||
<i class="bi bi-check-all"></i> Tout sélectionner
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary" id="deselect-all">
|
||||
<i class="bi bi-x-circle"></i> Désélectionner
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="table_container" class="table-container" >
|
||||
<table id="stats-table" class="table table-bordered table-striped table-hover table-responsive table-sort">
|
||||
{% include 'admin/stats/table-head.html.twig' %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue