/trunk/services/modules/0.1/osm/ZoneAdmin.php |
---|
32,7 → 32,6 |
private $lat = null; |
private $lon = null; |
private $zone = null; |
public function __construct(Bdd $bdd) { |
$this->bdd = $bdd; |
43,7 → 42,6 |
$this->verifierParametres(); |
$this->lat = $this->parametres['lat']; |
$this->lon = $this->parametres['lon']; |
$this->zone = isset($this->parametres['zone']) ? $this->parametres['zone'] : null; |
$zoneTrouveeInfos = $this->localiserPointLatLon(); |
$corps = $this->formaterResultats($zoneTrouveeInfos); |
94,7 → 92,6 |
private function localiserPointLatLon() { |
$osmIdsInClause = $this->getOsmIdsDesCentresAProximites(); |
$zone = isset($this->zone) ? $this->bdd->proteger($this->zone) : null; |
$requete = 'SELECT id_zone_geo AS codeZoneGeo, intitule, code_iso_3166_1 AS codeIso31661, '. |
'code_iso_3166_2 AS codeIso31662, code_insee AS codeInsee, code_nuts as codeNuts, '. |
101,7 → 98,6 |
'nom_en AS nomEn, nom_es AS nomEs, wikipedia, niveau '. |
'FROM osm_zones_admin '. |
"WHERE st_within(GEOMFROMTEXT('POINT($this->lon $this->lat)'), polygone) = 1 ". |
(isset($zone) ? "AND zone = $zone " : ''). |
"AND osm_id IN ($osmIdsInClause) ". |
' -- '.__FILE__.' : '.__LINE__; |
$resultat = $this->bdd->recupererTous($requete); |
130,12 → 126,10 |
} |
private function construireRequeteUnion() { |
$zone = isset($this->zone) ? $this->bdd->proteger($this->zone) : null; |
$requeteTpl = 'SELECT osm_id, '. |
"(($this->lon - centre_lng) * ($this->lon -centre_lng) + ($this->lat - centre_lat) * ($this->lat - centre_lat)) AS distance ". |
'FROM osm_zones_admin '. |
'WHERE niveau = %s '. |
(isset($zone) ? "AND zone = $zone " : ''). |
'ORDER BY distance ASC '. |
"LIMIT %s "; |
$niveaux = array(2,3,4,5,6,7,8); |
/trunk/scripts/modules/osm/ZonesAdmin.php |
---|
66,7 → 66,7 |
"CONCAT('OSM-ID:',osm_id)))))), ". |
'osm_id, osm_version, osm_timestamp, '. |
"if(name_fr != '', name_fr, name), ". |
'shape, shape_centroid, Y(shape_centroid), X(shape_centroid), zone, '. |
'shape, shape_centroid, Y(shape_centroid), X(shape_centroid), '. |
'admin_level, iso3166_1, iso3166_2, ref_insee, ref_nuts, '. |
'name, name_fr, name_en, name_es, wikipedia '. |
"FROM {$this->bddOsmNom}.multipolygons_ref ". |
/trunk/scripts/modules/osm/config.ini |
---|
1,5 → 1,5 |
; Base de données contenant les infos provenant d'OSM |
bdd_osm_nom = "tb_osm" |
bdd_osm_nom = "osm" |
; Ajouter les nouvelles version à la suite dans versions et versionsDonnees. |
version = "2.0" |
/trunk/docs/projets/osm/bdd/osm.mwb |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/docs/projets/osm/bdd/osm_communes.sql |
---|
File deleted |
/trunk/docs/projets/osm/bdd/osm_communes.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/docs/projets/osm/bdd/osm.mwb.bak |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/docs/projets/osm/bdd/OSM.mwb |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/docs/projets/osm/bdd/OSM.mwb |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/docs/projets/osm/bdd/CommunesFrance.sql |
---|
New file |
0,0 → 1,101 |
-- phpMyAdmin SQL Dump |
-- version 3.3.9 |
-- http://www.phpmyadmin.net |
-- |
-- Serveur: localhost |
-- Généré le : Mer 15 Juin 2011 à 16:30 |
-- Version du serveur: 5.5.8 |
-- Version de PHP: 5.3.5 |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; |
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; |
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; |
/*!40101 SET NAMES utf8 */; |
-- |
-- Base de données: `osmMAJ` |
-- |
-- -------------------------------------------------------- |
-- |
-- Structure de la table `osm_communes` |
-- |
CREATE TABLE IF NOT EXISTS `osm_communes` ( |
`id_relation` int(11) NOT NULL, |
`nom` text NOT NULL, |
`code_insee` varchar(11) NOT NULL, |
`polygon` multipolygon DEFAULT NULL, |
`note` varchar(100) NOT NULL, |
`centre` point NOT NULL, |
PRIMARY KEY (`id_relation`), |
KEY `INSEE` (`code_insee`), |
KEY `communeOSM_polygone_index` (`polygon`(767),`centre`(25)) |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
-- -------------------------------------------------------- |
-- |
-- Structure de la table `osm_chemin_a_noeuds` |
-- |
CREATE TABLE IF NOT EXISTS `osm_chemin_a_noeuds` ( |
`id_chemin` int(11) NOT NULL, |
`id_noeud` int(11) NOT NULL, |
`ordre` int(11) NOT NULL, |
PRIMARY KEY (`id_chemin`,`id_noeud`,`ordre`), |
KEY `id_way` (`id_chemin`), |
KEY `id_node` (`id_noeud`) |
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; |
-- -------------------------------------------------------- |
-- |
-- Structure de la table `osm_noeuds` |
-- |
CREATE TABLE IF NOT EXISTS `osm_noeuds` ( |
`id_noeud` int(11) NOT NULL, |
`lat` double NOT NULL, |
`long` double NOT NULL, |
PRIMARY KEY (`id_noeud`) |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
-- -------------------------------------------------------- |
-- |
-- Structure de la table `osm_relations` |
-- |
CREATE TABLE IF NOT EXISTS `osm_relations` ( |
`id_relation` int(11) NOT NULL, |
`nom` text NOT NULL, |
`code_insee` varchar(11) NOT NULL, |
PRIMARY KEY (`id_relation`), |
KEY `INSEE` (`code_insee`) |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
-- -------------------------------------------------------- |
-- |
-- Structure de la table `osm_relation_a_chemins` |
-- |
CREATE TABLE IF NOT EXISTS `osm_relation_a_chemins` ( |
`id_relation` int(11) NOT NULL, |
`id_chemin` int(11) NOT NULL, |
`role` varchar(20) CHARACTER SET latin1 NOT NULL, |
`ordre` int(11) NOT NULL, |
`sens` varchar(15) CHARACTER SET latin1 NOT NULL, |
`nbre_poly` int(11) NOT NULL, |
PRIMARY KEY (`id_relation`,`id_chemin`), |
KEY `role` (`role`), |
KEY `ordre` (`ordre`), |
KEY `sens` (`sens`), |
KEY `nbPoly` (`nbre_poly`) |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
/trunk/docs/projets/osm/bdd/osm.mdb.mwb |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/docs/projets/osm/bdd/osm.mdb.mwb |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/docs/projets/osm/bdd/osm2.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/docs/projets/osm/bdd/osm2.pdf |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |