From: x2001corpet
Date: Sat, 1 Jul 2006 07:23:20 +0000 (+0000)
Subject: correction de la geoloc pour les adresses precises
X-Git-Tag: xorg/0.9.10~22
X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=42be0564f328944a60779cf416a5a71e3f1479fb;p=platal.git
correction de la geoloc pour les adresses precises
git-svn-id: svn+ssh://murphy/home/svn/platal/branches/platal-0.9.10@351 839d8a87-29fc-0310-9880-83ba4fa771e5
---
diff --git a/htdocs/admin/geoloc_dynamap.php b/htdocs/admin/geoloc_dynamap.php
index b479c73..88827f9 100644
--- a/htdocs/admin/geoloc_dynamap.php
+++ b/htdocs/admin/geoloc_dynamap.php
@@ -35,6 +35,10 @@ if (Env::get('fix') == 'smallest_maps') {
set_smallest_levels();
}
+if (Env::get('fix') == 'precise_coordinates') {
+ $globals->xdb->execute("UPDATE adresses AS a INNER JOIN geoloc_city AS c ON(a.cityid = c.id) SET a.glat = c.lat / 100000, a.glng = c.lon / 100000");
+}
+
if (Env::has('new_maps')) {
require_once('geoloc.inc.php');
if (!get_new_maps(Env::get('url')))
@@ -47,11 +51,15 @@ $missing = $countMissing->fetchOneCell();
$countNoSmallest = $globals->xdb->query("SELECT SUM(IF(infos = 'smallest',1,0)) AS n FROM geoloc_city_in_maps GROUP BY city_id ORDER BY n");
$noSmallest = $countNoSmallest->fetchOneCell() == 0;
+$countNoCoordinates = $globals->xdb->query("SELECT COUNT(*) FROM adresses WHERE cityid IS NOT NULL AND glat = 0 AND glng = 0");
+$noCoordinates = $countNoCoordinates->fetchOneCell();
+
if (isset($refresh) && $missing) {
- $page->assign("xorg_extra_header", "");
+ $page->assign("xorg_extra_header", "");
}
$page->assign("nb_cities_not_on_map", $missing);
$page->assign("no_smallest", $noSmallest);
+$page->assign("no_coordinates", $noCoordinates);
$page->run();
diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php
index ea247fb..a8d2c08 100644
--- a/include/geoloc.inc.php
+++ b/include/geoloc.inc.php
@@ -74,7 +74,7 @@ $GLOBALS['page']->register_function('geoloc_region', '_geoloc_region_smarty');
*/
function get_address_infos($txt) {
global $globals;
- $url = $globals->geoloc->webservice_url."address.php?txt=".urlencode(utf8_encode($txt)."&precise=1");
+ $url = $globals->geoloc->webservice_url."address.php?precise=1&txt=".urlencode(utf8_encode($txt));
if (!($f = @fopen($url, 'r'))) return false;
$keys = explode('|',fgets($f));
$vals = explode('|',fgets($f));
diff --git a/templates/admin/geoloc_dynamap.tpl b/templates/admin/geoloc_dynamap.tpl
index 28981bc..153d27c 100644
--- a/templates/admin/geoloc_dynamap.tpl
+++ b/templates/admin/geoloc_dynamap.tpl
@@ -50,5 +50,12 @@
Il faut définir la plus petite carte pour chaque ville (à ne faire qu'une fois quand on a placé toutes les villes).
{/if}
-
+{if $no_coordinates}
+
+ Placement précis des adresses
+
+
+ {$no_coordinates} adresses n'ont pas été bien reconnues précisément. [Mettre les coordonnées du centre de la ville]
+
+{/if}
{* vim:set et sw=2 sts=2 sws=2: *}