Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1042 → Rev 1049

/tags/v5.7-arrayanal/initialiserBddSurServeur.sh
New file
0,0 → 1,53
#!/bin/bash
##############################################################################################################
# But : Script permettant d'initialiser en une seule commande l'ensemble de la base de données eFlore.
# Auteur : Jean-Pascal Milcent <jpm@tela-botanica.org> (translate bat file to shell script)
# Encodage : ISO-8859-15
# License : GPL v3
# Création : 07 decembre 2011
# Version: 0.1
# 2012-03-21 : Création de la version serveur en ISO-8859-15, modification des chemins, suppression des scripts inutiles.
# 2011-12-07 : Création de la version originale en UTF-8
# $Id$
##############################################################################################################
# Constante
APPDIR_ABSOLU=`pwd`;
#
CHEMIN_PHP="sudo -u telabotap /usr/local/bin"
CHEMIN_TBF_CLI="$APPDIR_ABSOLU"
MEMORY_LIMIT="4000M
echo -e "\033[31m`tput blink`ATTENTION :`tput sgr0` Nécessite la création préalable de la base de données \033[31mtb_eflore\033[00m"
echo "Nettoyage et chargement en cours...";
echo "BASEFLOR :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php baseflor -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php baseflor -a chargerTous
echo "BDNT :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php bdnt -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php bdnt -a chargerTous
echo "BDTFX :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php bdtfx -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php bdtfx -a chargerTous
echo "CHORODEP :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php chorodep -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php chorodep -a chargerTous
echo "EFLORE :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php eflore -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php eflore -a chargerTous
echo "INSEE-D :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php insee_d -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php insee_d -a chargerTous
echo "ISO-3166-1 :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php iso_3166_1 -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php iso_3166_1 -a chargerTous
echo "ISO-639-1 :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php iso_639_1 -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php iso_639_1 -a chargerTous
echo "NVJFL :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php nvjfl -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php nvjfl -a chargerTous
echo "NVA :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php nva -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php nva -a chargerTous
echo "PHOTOFLORA :";
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php photoflora -a supprimerTous
$CHEMIN_PHP/php -d memory_limit=$MEMORY_LIMIT $CHEMIN_TBF_CLI/cli.php photoflora -a chargerTous
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:eol-style
+native
\ No newline at end of property
/tags/v5.7-arrayanal/CHANGELOG
New file
0,0 → 1,91
Changements <next>:
 
Changements 2014-03-24 [création de la branche "v5.6-arganeraie"]:
* Services : renommage "bdtao" => "apd"
* Scripts : renommage "bdtao" => "apd"
* Apd: version "1_00" => "3_4_0"
* derniere version baseveg
* carte sans contours de département pour moissonnage petit format (png)
* Légère amélioration de la gestion des couleurs pour les petites tailles de png
* Prise en compte de la migration des données eFlore sur Agathis
* Mise à jour des services, scripts et docs du projet OSM.
* Ajout d'une condition dans les requetes sur les ids inférieurs et supérieurs des taxons qui les limite au nom retenu
* Ajout du champ num type s'il n'est pas déjà demandé dans les requetes de synonymie
 
Changements 2014-03-04 [création de la branche "v5.5-arbousiere"]:
* Ajout du web service renvoyant des liens vers les cartes de flore probable isssue de sophy
* nouvelle version de la bdtfx
* debug graphique baseflor valeur vide ne s'affiche plus comme 0
* correction requete vue tapir
* Script d'intégration du référentiel bdtao
* Ajout des scripts eFlore pour bdtao ; utilisation de 'num_basionyme' à la place de 'basionyme'.
 
Changements 2014-02-11 [création de la branche "v5.4-Arboretum"]:
* nouvelle version baseflor
* Les services Noms des trois référentiels (bdtfx, bdtxa, isfan) retournent maintenant en plus du libellé du rang, le code du rang dans "rang.code" lorsqu'on leur demande "champs.retour=rang"
* script de création données ifn et vue tapir
* script transformant les données des tables de tb_moissonnage à une table _tapir et une table meta dans tb_eflore
* ajout du moissonage de l'ifn
* interrogation ifn et baznat par num_nom et plus par nom_sci
 
Changements 2014-01-06 [création de la branche "v5.3-Amandaie"]:
* service presencemuseum
* Protection du graphique Baseflor contre les données NULL
* ajout de version chorodep
* Coste/textes : REDIRECT_QUERY_STRING => QUERY_STRING
* array_unique() sur les courriels de la carte de répartition
 
Changements 20130912 [création de la branche "Acheb"]:
* API change: coste
* référentiels: bdtfx 2.00, ontologies 4.40
* config:
- directives inutiles supprimées pour Coste [r857]
- bdnt: ontologie: 4_40
* coste: réécriture du webservice
 
Changements [[http://svn.tela-botanica.net/websvn/filedetails.php?repname=eFlore%2FProjets.eflore-projets&path=%2Ftrunk%2FChangelog&peg=839 v5.0-agropyraie-20130829]] :
- tenue du Changelog
- config: directives modifiées:
- cache.miseEnCache
- cache.dureeDeVie
- cache.stockageChemin
- ontologies:
- support critères multiples bdnt
- support critères multiples nvjfl
- support critères multiples baseflor
- cache d'appels pour bdtfx/meta-donnees
- SQL hard-codé en place du HTTP dans certains cas
- tests: nombreux ajouts et quelques changements de prototypes
- scripts:
- upgrades pour Cel
- Makefile pour configuration/
- renommage de noms de classes en conflit: Cartes et Ontologies
- améliorations dans l'usage du cache
 
Changements v0.1-20130830-1:
* nvjfl: fix notices
* cache: correction du cache des synonymes (noms à 255 caractères)
* cel/images: déduplication de auteurs au préalable de la requête d'identités
* Note: erreur de tag sur "v0.1-20130830"
 
Changements v0.1-20130829:
* tenue du Changelog
* config: directives modifiées:
- cache.miseEnCache
- cache.dureeDeVie
- cache.stockageChemin
* ontologies:
* support critères multiples bdnt
* support critères multiples nvjfl
* support critères multiples baseflor
* support critères multiples eflore
* cache d'appels pour bdtfx/meta-donnees
* SQL hard-codé en place du HTTP dans certains cas
* tests: nombreux ajouts et quelques changements de prototypes
* scripts:
* upgrades pour Cel
* Makefile pour configuration/
* renommage de noms de classes en conflit: Cartes et Ontologies
* améliorations dans l'usage du cache
 
v0.1-20130600
/tags/v5.7-arrayanal/scripts/modules/nvps/nvps.ini
New file
0,0 → 1,14
version = "2012"
dossierTsv = "{ref:dossierDonneesEflore}nvps/2012/"
dossierSql = "{ref:dossierTsv}"
 
[tables]
nvps = "nvps_v{ref:version}"
 
[fichiers]
structureSql = "nvps_v{ref:version}.sql"
nvps = "{ref:tables.nvps}.tsv"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
nvps = "{ref:dossierTsv}{ref:fichiers.nvps}"
/tags/v5.7-arrayanal/scripts/modules/nvps/Nvps.php
New file
0,0 → 1,124
<?php
/** Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M ~/web/eflore-projets/scripts/cli.php nvps
* -a chargerTous
* Options :
* -t : Permet de tester le script sur un jeux réduit de données (indiquer le nombre de lignes).
*/
class Nvps extends EfloreScript {
 
private $nomsIndex = array();
private $numeroIndex = 1;
 
protected $parametres_autorises = array(
'-t' => array(false, false, 'Permet de tester le script sur un jeux réduit de données (indiquer le nombre de lignes).'));
 
public function executer() {
// Lancement de l'action demandée
try {
$this->initialiserProjet('nvps');
 
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerNvps();
break;
case 'chargerStructure' :
$this->chargerStructureSql();
break;
case 'chargerNvps' :
$this->chargerNvps();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
/**
* Charge le fichier en créant un id pour chaque nom vernaculaire.
*/
private function chargerNvps() {
//Debug::printr(Config::get('fichiers'));
$fichierOuvert = $this->ouvrirFichier(Config::get('chemins.nvps'));
$donnees = $this->analyserFichier($fichierOuvert);
fclose($fichierOuvert);
foreach ($donnees as $donnee) {
$table = Config::get('tables.nvps');
$fields = implode(', ', array_keys($donnee));
$values = implode(', ', $donnee);
 
$requete = "INSERT INTO $table ($fields) VALUES ($values) ";
$this->getBdd()->requeter($requete);
 
$this->afficherAvancement("Insertion des noms vernaculaires dans la base de données");
if ($this->stopperLaBoucle($this->getParametre('t'))) {
break;
}
}
echo "\n";
}
 
private function ouvrirFichier($chemin) {
$fichierOuvert = false;
if ($chemin) {
if (file_exists($chemin) === true) {
$fichierOuvert = fopen($chemin, 'r');
if ($fichierOuvert == false) {
throw new Exception("Le fichier $chemin n'a pas pu être ouvert.");
}
} else {
throw new Exception("Le fichier $chemin est introuvable.");
}
} else {
throw new Exception("Aucun chemin de fichier n'a été fourni.");
}
return $fichierOuvert;
}
 
private function analyserFichier($fichierOuvert) {
$entetesCsv = explode("\t", trim(fgets($fichierOuvert)));
 
$donnees = array();
while ($ligneCsv = fgets($fichierOuvert)) {
$champs = explode("\t", trim($ligneCsv));
if (count($champs) > 0) {
$infos = array();
foreach ($entetesCsv as $ordre => $champNom) {
$valeur = isset($champs[$ordre]) ? $champs[$ordre] : '';
$infos[$champNom] = $valeur;
}
$infos['id'] = $this->getIndexNomVernaculaire($infos['nom_vernaculaire']);
$donnees[] = $this->getBdd()->protegerTableau($infos);
}
$this->afficherAvancement("Analyse du fichier des noms vernaculaires");
if ($this->stopperLaBoucle()) {
break;
}
}
echo "\n";
 
return $donnees;
}
 
private function getIndexNomVernaculaire($nomVernaculaire) {
$indexCourrant = null;
if (array_key_exists($nomVernaculaire, $this->nomsIndex) == false) {
$this->nomsIndex[$nomVernaculaire] = $this->numeroIndex++;
}
$indexCourrant = $this->nomsIndex[$nomVernaculaire];
return $indexCourrant;
}
 
private function supprimerTous() {
$requete = "DROP TABLE IF EXISTS nvps_meta, nvps_v2007, nvps_v2012";
$this->getBdd()->requeter($requete);
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/iso_3166_1/Iso31661.php
New file
0,0 → 1,82
<?php
/** Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M ~/web/eflore-projets/scripts/cli.php iso6391
* -a chargerTous
* Options :
* -t : Permet de tester le script sur un jeux réduit de données (indiquer le nombre de lignes).
*/
class Iso31661 extends EfloreScript {
 
public function executer() {
// Lancement de l'action demandée
try {
$this->initialiserProjet('iso-3166-1');
 
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerIso31661();
$this->chargerOntologies();
break;
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'chargerIso31661' :
$this->chargerIso31661();
break;
case 'chargerOntologies' :
$this->chargerOntologies();
break;
case 'test' :
$this->tester();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
default :
$this->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
private function tester() {
echo Config::get('test');
}
 
private function chargerIso31661() {
$chemin = Config::get('chemins.iso31661');
$table = Config::get('tables.iso31661');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '\"' ".
" ESCAPED BY '\\\' ".
'IGNORE 1 LINES';
$this->getBdd()->requeter($requete);
}
 
private function chargerOntologies() {
$chemin = Config::get('chemins.ontologies');
$table = Config::get('tables.ontologies');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '\"' ".
" ESCAPED BY '\\\' ".
'IGNORE 1 LINES';
$this->getBdd()->requeter($requete);
}
 
private function supprimerTous() {
$requete = "DROP TABLE IF EXISTS iso_3166_1_meta, iso_3166_1_ontologies_v2006, iso_3166_1_v2006";
$this->getBdd()->requeter($requete);
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/iso_3166_1/iso-3166-1.ini
New file
0,0 → 1,18
version="2006"
dossierTsv = "{ref:dossierDonneesEflore}iso-3166-1/{ref:version}/"
dossierSql = "{ref:dossierTsv}"
 
 
[tables]
iso31661 = "iso_3166_1_v{ref:version}"
ontologies = "iso_3166_1_ontologies_v{ref:version}"
 
[fichiers]
structureSql = "iso-3166-1_v{ref:version}.sql"
iso31661 = "iso-3166-1_v{ref:version}.tsv"
ontologies = "iso-3166-1_ontologies_v{ref:version}.tsv"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
iso31661 = "{ref:dossierTsv}{ref:fichiers.iso31661}"
ontologies = "{ref:dossierTsv}{ref:fichiers.ontologies}"
/tags/v5.7-arrayanal/scripts/modules/iso_3166_1
New file
Property changes:
Added: svn:ignore
+iso-3166-1.ini
/tags/v5.7-arrayanal/scripts/modules/bonnier/bonnier.ini
New file
0,0 → 1,20
; Encodage : UTF-8
; Exemple de fichier de configuration d'un projet
; Les commentaires commencent par ';', comme dans php.ini
 
; Indique le nom du projet
projet_nom = bonnier
; Indique le nombre sur un chiffre de la version du projet
version = 0
; Indique le nombre sur deux chiffres de la sous version du projet
sous_version = 00
; Indique la date de début de cette version du projet
date_debut = "2009-12-11 00:00:00"
; Indique la date de fin de cette version du projet
date_fin = NULL
; Indique le chemin où les fichier html vont être générés
chemin_fichier_sortie = "php:'/home/'.'david'.'/Bureau/bonnierhtml/'"
; Indique le chemin où trouver le fichier du projet contenant les données à charger puis standardiser
chemin_fichier_tab = "php:'/home/'.'david'.'/Bureau/bonnierhtml/'"
; Indique le chemin où stocker le fichier de log
log_chemin = "php:'/home/'.'david'.'/Bureau/bonnierhtml/'"
/tags/v5.7-arrayanal/scripts/modules/bonnier/Bonnier.php
New file
0,0 → 1,508
<?php
// Encodage : UTF-8
// +-------------------------------------------------------------------------------------------------------------------+
/* Importation des fichiers excel de Bonnier pour créer une version HTML pour PDA.
* Utilisation au préalable des utillitaire de traitement de fichier mdb sous Unix (voir ci après)
*
* Pré-requis :
* 1. Installer le paquet pour Perl nommé ParseExcel : urpmi perl-spreadsheet-parseexcel
* 2. Télécharger les fichiers Excel de Bonnier : http://www.tela-botanica.org/projets/74/documents/16211
* 3. Créer un dossier où vous dézipperez l'archive des fichiers Excel
* 4. Copier dans ce dossier les fichier xls2sql.pl et generer_sql.sh que vous trouverez dans le dossier shell de ce module
* 5. Donner les droits d'execution au fichier generer_sql.sh et lancer le : ./generer_sql.sh
* 6. Vous devez obtenir un fichier SQL par fichier Excel.
*
* Pour lancer ce script fichier par fichier :
* 1. Ouvrir une console et se positionner dans le dossier "scripts"
* 2. Pour charger le 1er fichier Excel, taper la commande : /opt/lampp/bin/php script.php bonnier -p bonnier -a charger -table renonculacees
* 3. Pour generer le html issu du chargement precedent :
* /opt/lampp/bin/php script.php bonnier -p bonnier -a html -dossier "menus/001-Renonculacees" -table renonculacees
*
* // Auteur original :
* @author David DELON <david@clapas.net>
* @copyright David DELON 2009
* @link http://www.tela-botanica.org/wikini/eflore
* @licence GPL v3 & CeCILL v2
* @version $Id$
*/
// +-------------------------------------------------------------------------------------------------------------------+
class Bonnier extends ScriptCommandeEflore {
 
/**
* Paramêtres disponible pour la ligne de commande
* le tableau se construit de la forme suivnate :
* - clé = nom du paramêtre '-foo'
* - value = contient un nouveau tableau composé de cette façaon :
* - booléen: true si le paramêtre est obligatoire
* - booléen ou var : true si le paramêtre nécessite un valeur à sa suite ou la valeur par défaut
* - string: description du contenu du paramêtre
* Les paramêtres optionels devraient être déclaré à la fin du tableau.
* Le dernier parametre du tableau peut avoir la valeur '...',
* il contiendra alors l'ensemble des paramêtres suivant trouvés sur la ligne de commande.
* @var array
*/
public $parametres = array( '-table' => array(true, true, "Nom de la table où seront stockées les données d'une famille"),
'-dossier' => array(true, true, "Dossier où sont générés les fichiers html pour la table"));
public function executer() {
 
error_reporting(E_ALL & ~E_DEPRECATED );
$table = $this->getParam('table');
$dossier = $this->getParam('dossier');
@mkdir($this->getIni('chemin_fichier_sortie').$dossier);
$cmd = $this->getParam('a');
switch ($cmd) {
// chargement des fichiers sql issus de la transformation xls dans la base de donnee, une table par fichir sql, 2 tables par
// familles : texte (navigation / clef) et plantes : description des plantes.
case 'charger' :
$this->creerTableBonnier($this->version, $table);
$this->chargerDonnees($table);
break;
case 'html' :
// tranformation sql vers html : pour la famille considerée : parcours de l'ensemble de ses clef et generation html pour
// les feuilles.
$this->realiserHtml($dossier, $table);
break;
default :
trigger_error('Erreur : la commande "'.$cmd.'" n\'existe pas!'."\n", E_USER_ERROR);
}
}
 
private function realiserHtml($dossier, $table) {
// Parcours de l'ensemble des données ? ou famille par famille ?
// on charge plante et texte dans des tableaux
$this->type_donnee = $table.'_texte';
$requete = 'SELECT * '.
'FROM '.$this->projet_nom.'_v'.$this->version.'_'.$this->sous_version.'_'.$this->type_donnee.' '.
'ORDER BY uid';
$lignesTexte = $this->retournerDonneesRequete($requete);
// Analyse des données
echo "Analyse des données : ".$this->type_donnee."\n";
foreach ($lignesTexte as $ligneTexte) {
if (!isset($aso_lignes[$ligneTexte['identifiant']])) {
$aso_lignes[$ligneTexte['identifiant']] = $ligneTexte;
} else {
echo "identifiant en double : ".$ligneTexte['identifiant']."\n";
}
}
 
$this->type_donnee = $table.'_plante';
$requete = 'SELECT * '.
'FROM '.$this->projet_nom.'_v'.$this->version.'_'.$this->sous_version.'_'.$this->type_donnee.' '.
'ORDER BY uid';
$lignesPlante = $this->retournerDonneesRequete($requete);
foreach ($lignesPlante as $lignePlante) {
if (!isset($aso_lignes[$lignePlante['identifiant']])) {
$aso_lignes[$lignePlante['identifiant']] = $lignePlante;
} else {
echo "identifiant en double : ".$lignePlante['identifiant']."\n";
}
}
//print_r($aso_lignes_texte[$lignesTexte[0]['identifiant']] ['titre']);
// $ariane : tableau des identifiants parcourus dans la branche
// $niveau : niveau dans l'arbre
$ariane = array();
$niveau = 0;
// Parcours de l'arbre des clefs depuis la racine
$this->genererHtmlTexte($lignesTexte[1]['identifiant'], $aso_lignes, $ariane, $niveau, $dossier);
}
// Generation des elements de navigation (clef)
private function genererHtmlTexte($identifiant, $lignesTexteIdentifiant, $ariane, $niveau, $dossier) {
 
$ariane[] = $identifiant;
$niveau++;
if (isset ($lignesTexteIdentifiant[$identifiant])) { // Si des identifiants sont en doubles
$ligneIdentifiant = $lignesTexteIdentifiant[$identifiant];
}
else {
// initialiser valeur par defaut indiquant une erreur
}
 
$f_html = fopen($this->getIni('chemin_fichier_sortie').$dossier.'/'.$identifiant.'.html', 'wb');
$html =
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n".
'<head>'."\n".
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\n".
'<title>Flore BONNIER sur PDA</title>'."\n".
'<link rel="stylesheet" type="text/css" href="../../style/style640.css" media="screen" />'."\n".
'</head>'."\n";
$html .= '<body>'."\n";
$html .= '<div class="titre">'."\n";
$html .= '<p id="titre">';
if (isset($ligneIdentifiant)) {
$html .= $ligneIdentifiant['titre'];
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
// print "identifiant : ".$ligneIdentifiant['identifiant']."\n";
// Destinations
// Branche niveau inferieur
$html.='<div class="fenetreMenu">'."\n";
for ($i = 1; $i < 6; $i++) {
if (isset($ligneIdentifiant['texte_'.$i]) && $ligneIdentifiant['texte_'.$i] != "") {
$html .= '<div class="menu'.($i-1).'">'."\n";
$html .= '<a href="'.$ligneIdentifiant['destination_'.$i].'.html">';
$html .= $ligneIdentifiant['texte_'.$i];
$html .= '</a>'."\n";
$html .= '</div>'."\n";
}
}
 
$html .= '</div>'."\n";
$html .= '<div class="espace" style="top:518px;">'."\n";
$html .= '</div>'."\n";
$html .= '<div class="navigation">'."\n";
$html .= '<p id="navigation">'."\n";
// Navigation
for ($i = 0; $i < $niveau; $i++) {
if (($ariane[$i]) && $ariane[$i] != '') {
$html .= '<a href="'.$ariane[$i].'.html">';
if (isset ($lignesTexteIdentifiant[$ariane[$i]])) { // Si des identifiants sont en doubles
$html .= $lignesTexteIdentifiant[$ariane[$i]]['titre'];
}
$html .= '</a>'."\n";
}
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
 
$html .= '<div class="retour">'."\n";
$html .= '<p id="retour">'."\n";
// Retour niveau superieur
if (isset($ariane[$niveau - 2]) && $ariane[$niveau - 2] != '') {
$html .= '<a href="'.$ariane[$niveau - 2].'.html">';
$html .= $lignesTexteIdentifiant[$ariane[$niveau - 2]]['titre'];
$html .= '</a>'."\n";
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="glossaire">'."\n";
$html .= '<p id="glossaire">'."\n";
$html .= '<a href="../000-general/glossaire0_640.html">'."\n";
$html .= 'Glossaire'."\n";
$html .= '</a>'."\n";
$html .= '</p></div><div class="text">'."\n";
$html .= '<p id="Text">'."\n";
$html .= '<a href="../000-general/accueil1_640.html">'."\n";
$html .= ' Top'."\n";
$html .= '</a>'."\n";
$html .= ' </p>'."\n";
$html .= '</div>'."\n";
 
$html .= '</body>'."\n";
$html .= '</html>'."\n";
fwrite($f_html, $html);
fclose($f_html);
// Ecriture des feuilles (description plantes)
for ($i = 1; $i < 6; $i++) {
if (isset($ligneIdentifiant['destination_'.$i]) && $ligneIdentifiant['destination_'.$i] != '') {
if (substr($ligneIdentifiant['destination_'.$i], 0, 1) == 'p') {
$this->genererHtmlPlante($ligneIdentifiant['destination_'.$i], $lignesTexteIdentifiant, $ariane, $niveau, $dossier);
} else {
$this->genererHtmlTexte($ligneIdentifiant['destination_'.$i], $lignesTexteIdentifiant, $ariane, $niveau, $dossier);
}
}
}
}
// Plante
private function genererHtmlPlante($identifiant, $lignesTexteIdentifiant, $ariane, $niveau, $dossier) {
$ariane[] = $identifiant;
$niveau++;
if (isset ($lignesTexteIdentifiant[$identifiant])) { // Au cas ou des identifiants sont en doubles
$ligneIdentifiant = $lignesTexteIdentifiant[$identifiant];
}
$nom_latin = '';
if (isset($ariane[($niveau - 2)]) && isset($lignesTexteIdentifiant[$ariane[($niveau - 2)]]['texte_1'])) {
$nom_latin = trim(strrchr($lignesTexteIdentifiant[$ariane[($niveau - 2)]]['texte_1'], ':'), ' :');
}
 
$f_html = fopen($this->getIni('chemin_fichier_sortie').$dossier.'/'.$identifiant.'.html', 'wb');
$html=
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n".
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n".
'<head>'."\n".
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\n".
'<title>Flore BONNIER sur PDA</title>'."\n".
'<link rel="stylesheet" type="text/css" href="../../style/style_plante.css" media="screen" />'."\n".
'</head>'."\n";
$html .= '<body>'."\n";
$html .= '<div class="titre">'."\n";
$html .= '<p id="titre">';
$html .= $nom_latin;
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="famille">'."\n";
$html .= '<p id="famille1">Famille : </p>'."\n";
$html .= '<p id="famille2">';
$html .= $lignesTexteIdentifiant[$ariane[0]]['titre'];
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="genre">'."\n";
$html .= '<p id="genre1">Genre : </p>'."\n";
$html .= '<p id="genre2">';
if (isset($ligneIdentifiant)) {
$html .= $ligneIdentifiant['genre'];
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="nom_latin">'."\n";
$html .= '<p id="nom_latin1">Nom Latin : </p>'."\n";
$html .= '<p id="nom_latin2">';
$html .= $nom_latin;
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="nom_francais">'."\n";
$html .= '<p id="nom_francais1">Nom Francais : </p>'."\n";
$html .= '<p id="nom_francais2">';
if (isset($ligneIdentifiant)) {
$html .= $ligneIdentifiant['nom_francais'];
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="nom_commun">'."\n";
$html .= '<p id="nom_commun1">Nom Vulgaire : </p>'."\n";
$html .= '<p id="nom_commun2">';
if (isset($ligneIdentifiant)) {
$html .= $ligneIdentifiant['nom_vulgaire'];
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="caracteres">'."\n";
$html .= '<p id="caracteres1">Caractéristiques spécifiques : </p>'."\n";
$html .= '<p id="caracteres2">';
if (isset($ligneIdentifiant)) {
$html .= $ligneIdentifiant['description'];
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="habitat">'."\n";
$html .= '<p id="habitat1">Habitat / taille / floraison : </p>'."\n";
$html .= '<p id="habitat2">';
if (isset($ligneIdentifiant)) {
$html .= $ligneIdentifiant['habitat'];
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="aire">'."\n";
$html .= '<p id="aire1">Aire g&eacute;ographique : </p>'."\n";
$html .= '<p id="aire2">';
if (isset($ligneIdentifiant)) {
$html .= $ligneIdentifiant['geographie'];
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="identifiant">'."\n";
$html .= '<p id="identifiant">';
$html .= 'Bonnier : '.$identifiant;
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="planche">'."\n";
$html .= '<p id="planche">';
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="retour">'."\n";
$html .= '<p id="retour">'."\n";
if (($ariane[$niveau - 2]) && $ariane[$niveau - 2] != '') {
$html .= '<a href="'.$ariane[$niveau - 2].'.html">';
$html .= $lignesTexteIdentifiant[$ariane[$niveau - 2]]['titre'];
$html .= '</a>'."\n";
}
$html .= '</p>'."\n";
$html .= '</div>'."\n";
$html .= '<div class="glossaire">'."\n";
$html .= '<p id="glossaire">'."\n";
$html .= '<a href="../000-general/glossaire0_640.html">'."\n";
$html .= 'Glossaire'."\n";
$html .= '</a>'."\n";
$html .= '</p></div><div class="text">'."\n";
$html .= '<p id="Text">'."\n";
$html .= '<a href="../000-general/accueil1_640.html">'."\n";
$html .= ' Top'."\n";
$html .= '</a>'."\n";
$html .= ' </p>'."\n";
$html .= '</div>'."\n";
 
$html .= '</body>'."\n";
$html .= '</html>'."\n";
fwrite($f_html, $html);
fclose($f_html);
}
 
 
private function creerTableBonnier($version, $table) {
//+------------------------------------------------------------------------------------------------------------+
// texte
$this->type_donnee = $table.'_texte';
$requete = 'DROP TABLE IF EXISTS '.$this->projet_nom.'_v'.$this->version.'_'.$this->sous_version.'_'.$this->type_donnee;
$this->traiterRequete($requete);
$requete = 'CREATE TABLE '.$this->projet_nom.'_v'.$this->version.'_'.$this->sous_version.'_'.$this->type_donnee.' ('.
'uid int(11) not null auto_increment,'.
'identifiant varchar(25),'.
'titre varchar(100),'.
'texte_1 varchar(255),'.
'texte_2 varchar(255),'.
'texte_3 varchar(255),'.
'texte_4 varchar(255),'.
'texte_5 varchar(255),'.
'texte_6 varchar(255),'.
'destination_1 varchar(25),'.
'destination_2 varchar(25),'.
'destination_3 varchar(25),'.
'destination_4 varchar(25),'.
'destination_5 varchar(25),'.
'destination_6 varchar(25),'.
'planche_croquis varchar(25),'.
'PRIMARY KEY (uid)'.
') DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ' ;
$this->traiterRequete($requete);
//+------------------------------------------------------------------------------------------------------------+
//plante
$this->type_donnee = $table.'_plante';
$requete = 'DROP TABLE IF EXISTS '.$this->projet_nom.'_v'.$this->version.'_'.$this->sous_version.'_'.$this->type_donnee;
$this->traiterRequete($requete);
$requete = 'CREATE TABLE '.$this->projet_nom.'_v'.$this->version.'_'.$this->sous_version.'_'.$this->type_donnee.' ('.
'uid int(11) not null auto_increment,'.
'identifiant varchar(25),'.
'genre varchar(100),'.
'nom_francais varchar(100),'.
'nom_vulgaire varchar(100),'.
'description varchar(512),'.
'habitat varchar(255),'.
'geographie varchar(255),'.
'planche_croquis varchar(25),'.
'PRIMARY KEY (uid)'.
') DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ' ;
$this->traiterRequete($requete);
}
 
protected function chargerDonnees($table) {
print "Chargements des données ...";
print "\n";
$this->type_donnee = $table.'_texte';
$this->chargerDonneesSql($table);
$this->type_donnee = $table.'_plante';
$this->chargerDonneesSql($table);
return;
}
protected function chargerDonneesSql($table) {
echo $this->type_donnee."\n";
$fichier_sql = $this->chemin_fichier_tab.$this->projet_nom.'_v'.$this->version.'_'.$this->sous_version.'_'.$this->type_donnee.'.sql';
print $fichier_sql."\n";
if (file_exists($fichier_sql)) {
// Des champs textes sont multilignes, d'ou la boucle sur INSERT, marqueur de fin de la requete precedente.
if ($lines = file($fichier_sql)) {
$i = 0;
$ligne_courante = $lines[$i];
if (($i + 1) >= count($lines)) {
$ligne_suivante = 'FIN';
} else {
$ligne_suivante = $lines[$i+1];
}
while ($i < count($lines)) {
$line_in = $ligne_courante;
while (($i < count($lines)) && (substr($ligne_suivante, 0, 6) != 'INSERT') && ($ligne_suivante != 'FIN')) {
$line_in .= $ligne_suivante;
$i++;
$ligne_courante = $lines[$i];
if (($i + 1) >= count($lines)) {
$ligne_suivante = 'FIN';
} else {
$ligne_suivante = $lines[$i + 1];
}
}
$requete = $line_in;
if (substr($requete, 0, 6) == 'INSERT') {
$requete = preg_replace('/ VALUES\(/',' VALUES(0,', $requete);
$this->traiterRequete(utf8_encode($requete));
}
$i++;
if (($i + 1) >= count($lines)) {
$ligne_suivante = 'FIN';
} else {
$ligne_courante = $lines[$i];
$ligne_suivante = $lines[$i + 1];
}
if ($i == (int) $this->getParam('t')) {
break;
}
}
}
} else {
echo 'Fichier sql introuvable'."\n";
}
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/bonnier/shell/xls2sql.pl
New file
0,0 → 1,205
#!/usr/bin/perl
 
# $Date: 2005/10/19 10:14:00 $
 
# Excel to SQL statements translator.
# Needs the Spreadsheet::ParseExcel module from CPAN
#
# Example usage:
#
# xls2sql.pl help
# xls2sql.pl file=6960_TS_Bressanone_Brixen.xls \
# coldefs="year INTEGER,MEAN1 DOUBLE PRECISION,MEAN2 DOUBLE PRECISION,MEAN3 DOUBLE PRECISION"
#
# Released under GPLv2.0
# by Daniel Calvelo Aros (dca@users.sf.net)
#
# few modifications by MN (why not reading 'Learning Perl' O'Reilly book)
 
#use strict;
use English;
use Spreadsheet::ParseExcel;
# gparser-like options:
# option label => [ref to var to hold opt value, "description", default value or undef for no default]
%gopts = ( file => [\$file, "Name of input excel spreadsheet file", undef],
skip => [\$skip, "Number of rows to skip at the beginning of sheet", 0],
table => [\$tablename,"Name of output table", "mytable"],
rows => [\$nrows, "Number of rows to extract", undef],
sheet => [\$sheetn, "Sheet number to convert from the workbook, counting from 1", 1],
coldefs=> [\$coldefs, "Column definitions as in SQL", "auto"],
nodata => [\$nodata, "No data character(s) used in the Excel table", ""],
help => [\$help, "Help, of course", undef],
debug => [\$DEBUG, "Debugging flag, for developers only", 0]);
#function defined below:
&parse_opts();
 
#-- Open and look for obvious errors
my $wkbk =
Spreadsheet::ParseExcel::Workbook->Parse($file);
if( !defined $wkbk->{Worksheet}) {die "Error:couldn't parse file $file\n"}
my($iR, $iC, $sheet, $ncols, $roffset, $rsize);
$sheet = @{$wkbk->{Worksheet}}[--$sheetn]; #-- Numbering starts at 1 for the user
$ncols = $sheet->{MaxCol} or die "Error:the specified sheet $sheetn does not contain data\n";
$ncols -= $sheet->{MinCol} if defined $sheet->{MinCol} ;
$roffset = $sheet->{MinRow}-1;
$rsize = $sheet->{MaxRow} - $sheet->{MinRow};
die "Error:the specified worksheet seems to contain only one line\n" if $rsize == 0;
$roffset += $skip;
$lastrow = ( defined $nrows
? $nrows + $roffset -1
: $sheet->{MaxRow} );
die "Invalid skip option: the sheet only has $rsize rows" if $roffset >= $rsize - 1;
my (@types, @sqltypes, @firstrow, @titlerow);
 
if($coldefs ne "auto"){
#-- We have user-defined column definitions
#-- Check them
$coldefs =~ s/^\s*//;
$coldefs =~ s/\s*$//;
@defs = split ",", $coldefs;
foreach $i (0..$#defs){
($colname, $typedef) = split /\s+/,$defs[$i],2;
die "Column specification $i: can't parse SQL type definition '$typedef' (should be INTEGER, DOUBLE PRECISION, CHAR).\n" if $typedef !~ /INTEGER|DOUBLE PRECISION|CHAR/i;
die "Column name '$colname' for column $i contains spurious characters (no spaces permitted in list).\n" if $colname !~ /[a-zA-Z][a-zA-Z_0-9]*/;
push @sqltypes, $typedef;
push @titles, $colname;
}
}else{
#-- Inspect file for types:
#-- First estimate initial types from the first row of data
@firstrow = @{$sheet->{Cells}[$roffset+1]};
@types = map { $_->{Type}} @firstrow;
%cvt = (Text=>'CHAR',Numeric=>'INTEGER',Date=>'DOUBLE');
@sqltypes = map { $cvt{$_} } @types;
@lens = map { 0 } @types;
print STDERR "\nTypes:", join ";", @types if $DEBUG;
print STDERR "\nInitial sqltypes:", join ";", @sqltypes if $DEBUG;
#-- Then adjust widths and numeric type from the data
for(my $iR = $roffset ; $iR <= $lastrow ; $iR++) {
for(my $iC = $sheet->{MinCol} ;$iC <= $sheet->{MaxCol} ; $iC++) {
$cell = $sheet->{Cells}[$iR][$iC];
next if !defined $cell;
$cellvalue = $cell->Value;
if($types[$iC] eq 'Text'){
$thislength = length( $cellvalue );
$lens[$iC] = $thislength if $thislength > $lens[$iC];
}else{
if( $cellvalue =~ /[\.,]/ ){
$sqltypes[$iC] = 'DOUBLE PRECISION';
}
if( $cellvalue =~ /[a-df-z]/ ){
$sqltypes[$iC] = 'CHAR'; $lens[$iC] = length( $cellvalue);
}
}
}
}
foreach $i (0..$#sqltypes){
if( $sqltypes[$i] eq 'CHAR' ){
$sqltypes[$i] .= "($lens[$i])";
}
}
print STDERR "\nAdjusted sqltypes:", join ";", @sqltypes if $DEBUG;
 
#-- Generate field names from the title row
@titlerow = @{$sheet->{Cells}[$roffset]};
print STDERR "\nTitlerow:", join ";", map { defined $_ ? $_->Value : "" } @titlerow if $DEBUG;
$varname = "V000";
@titles = map {
/^[^a-zA-Z]/ ? $varname++ : $_
} map {
if( defined $_ && length > 0 ) {$_=$_->Value;y/a-z/A-Z/;s/[^a-zA-Z_0-9]/_/g}
else { $_=$varname++ }
$_;
} @titlerow;
map { $istitle{$_}++ } @titles;
foreach $i (reverse 0..$#titles){
if( $istitle{$titles[$i]} > 1){
$titles[$i] .= --$istitle{$titles[$i]};
}
}
while( $#titles < $ncols ){ #Missing titles, according to the size of the sheet
push @titles, $varname++;
push @sqltypes, "CHAR(32)";
}
print STDERR "\nTitles:" ,join ";", @titles if $DEBUG;
print STDERR "\n" if $DEBUG;
}
 
#-- Write out
print "CREATE TABLE $tablename (";
print join ",", map {"$titles[$_] $sqltypes[$_]"} (0..$#titles);
print ");\n";
if($coldefs eq "auto"){
$lastcol = $sheet->{MaxCol};
}else{
$lastcol = $#sqltypes + $sheet->{MinCol};
foreach $i (reverse 0..$#sqltypes){
$sqltypes[$i + $sheet->{MinCol}] = $sqltypes[$i];
}
}
for(my $iR = $roffset+1 ; $iR <= $lastrow ; $iR++) {
print "INSERT INTO $tablename VALUES(";
print join ",", map {
my $c = $sheet->{Cells}[$iR][$_];
# defined $c ? '"'.&cast($c->Value,$sqltypes[$_]).'"' : NULL
defined $c ? ''.&cast($c->Value,$sqltypes[$_]).'' : NULL
} ($sheet->{MinCol}..$lastcol);
print ");\n"
}
 
sub cast($$){
my ($value, $sqltype) = @_;
if( length($value)>0 ){
if ($value eq $nodata){
$value = "NULL"; # no data coded with char
}else{
if( $sqltype =~ /CHAR\s*\((\d+)\)/i ){
$value =~ s/[\n\r]/ /gm;
$value =~ s/"/\\"/g;
$value =~ s/'/\\'/g;
# $value = substr( $value, 0, $1 );
$value = '\''.substr( $value, 0, $1 ).'\'';
}elsif( $sqltype =~ /DOUBLE PRECISION/i ){
$value += 0;
}elsif( $sqltype =~ /INTEGER/i ){
$value = int $value;
}else{
die "Unknown SQL type '$sqltype'; can't typecast '$value' to that type.\n";
}
}
}else{
$value = "NULL"; # no data
}
}
 
sub parse_opts(){
for $o (sort keys %gopts){
if( defined $gopts{$o}[2] ){
${$gopts{$o}[0]} = $gopts{$o}[2];
}
for $arg (@ARGV){
$arg =~ /^\Q$o\E(?:\s*=\s*(.+)$)?/;
if( length($1)>0 ){
${$gopts{$o}[0]} = $1;
}elsif( $& ){
${$gopts{$o}[0]} = 1;
}
}
}
if($help){
select STDERR;
print "\n$PROGRAM_NAME : extract sheets from an excel workbook and\n";
print "produce SQL statements that create the database\n";
print "\nArguments (use grass style, i.e. arg=value):\n";
foreach (keys %gopts){ $longest = $longest < length() ? length() : $longest }
foreach $arg (grep {!/help/} keys %gopts){
print " $arg".(" "x($longest+2-length $arg));
print $gopts{$arg}[1];
print " (default: ".$gopts{$arg}[2].")" if defined $gopts{$arg}[2];
print "\n";
}
select STDOUT;
die "\n";
}
}
 
/tags/v5.7-arrayanal/scripts/modules/bonnier/shell/charger_sql.sh
New file
0,0 → 1,149
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/001-Renonculacees" -table renonculacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/002-Berberidees" -table berberidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/003-Nympheacees" -table nympheacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/004-Papaveracees" -table papaveracees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/005-Fumariacees" -table fumariacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/006-Cruciferes" -table cruciferes
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/007-Capparidees" -table capparidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/008-Cistinees" -table cistinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/009-Violariees" -table violariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/010-Resedacees" -table resedacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/011-Droseracees" -table droseracees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/012-Polygalees" -table polygalees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/013-Frankeniacees" -table frankeniacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/014-Caryophyllees" -table caryophyllees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/015-Elatinees" -table elatinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/016-Linees" -table linees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/017-Tiliacees" -table tiliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/018-Malvacees" -table malvacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/019-Geraniees" -table geraniees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/020-Hypericinees" -table hypericinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/021-Acerinees" -table acerinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/022-Ampelidees" -table ampelidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/023-Hippocastanees" -table hippocastanees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/024-Meliacees" -table meliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/025-Balsaminees" -table balsaminees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/026-tablexalidees" -table oxalidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/027-Zygophyllees" -table zygophyllees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/028-Hesperidees" -table hesperidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/029-Rutacees" -table rutacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/030-Coriariees" -table coriariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/031-Celastrinees" -table celastrinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/032-Staphyleacees" -table staphyleacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/033-Ilicinees" -table ilicinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/034-Rhamnees" -table rhamnees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/035-Terebinthacees" -table terebinthacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/036-Papilionacees" -table papilionacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/037-Cesalpiniees" -table cesalpiniees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/038-Rosacees" -table rosacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/039-Granatees" -table granatees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/040-tablenagrariees" -table onagrariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/041-Myriophyllees" -table myriophyllees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/042-Hippuridees" -table hippuridees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/043-Callitrichinees" -table callitrichinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/044-Ceratophyllees" -table ceratophyllees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/045-Lythrariees" -table lythrariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/046-Philadelphees" -table philadelphees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/047-Tamariscinees" -table tamariscinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/048-Myrtacees" -table myrtacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/049-Cucurbitacees" -table cucurbitacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/050-Portulacees" -table portulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/051-Paronychiees" -table paronychiees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/052-Crassulacees" -table crassulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/053-Cactees" -table cactees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/054-Ficoïdees" -table ficoïdees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/055-Grossulariees" -table grossulariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/056-Saxifragees" -table saxifragees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/057-tablembelliferes" -table ombelliferes
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/058-Araliacees" -table araliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/059-Cornees" -table cornees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/060-Loranthacees" -table loranthacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/061-Caprifoliacees" -table caprifoliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/062-Rubiacees" -table rubiacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/063-Valerianees" -table valerianees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/064-Dipsacees" -table dipsacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/065-Composees" -table composees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/066-Ambrosiacees" -table ambrosiacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/067-Lobeliacees" -table lobeliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/068-Campanulacees" -table campanulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/069-Vacciniees" -table vacciniees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/070-Ericinees" -table ericinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/071-Pyrolacees" -table pyrolacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/072-Monotropees" -table monotropees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/073-Lentibulariees" -table lentibulariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/074-Primulacees" -table primulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/075-Ebenacees" -table ebenacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/076-Styracees" -table styracees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/077-tableleinees" -table oleinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/078-Jasminees" -table jasminees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/079-Apocynees" -table apocynees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/080-Asclepiadees" -table asclepiadees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/081-Gentianees" -table gentianees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/082-Polemoniacees" -table polemoniacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/083-Convolvulacees" -table convolvulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/084-Cuscutacees" -table cuscutacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/085-Ramondiacees" -table ramondiacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/086-Borraginees" -table borraginees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/087-Solanees" -table solanees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/088-Verbascees" -table verbascees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/089-Scrofularinees" -table scrofularinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/090-tablerobanchees" -table orobanchees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/091-Labiees" -table labiees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/092-Acanthacees" -table acanthacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/093-Verbenacees" -table verbenacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/094-Plantaginees" -table plantaginees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/095-Plombaginees" -table plombaginees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/096-Globulariees" -table globulariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/097-Phytolaccees" -table phytolaccees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/098-Amarantacees" -table amarantacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/099-Salsolacees" -table salsolacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/100-Polygonees" -table polygonees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/101-Daphnoidees" -table daphnoidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/102-Laurinees" -table laurinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/103-Santalacees" -table santalacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/104-Eleagnees" -table eleagnees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/105-Cytinees" -table cytinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/106-Aristolochiees" -table aristolochiees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/107-Empetrees" -table empetrees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/108-Euphorbiacees" -table euphorbiacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/109-Morees" -table morees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/110-Ficacees" -table ficacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/111-Celtidees" -table celtidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/112-Ulmacees" -table ulmacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/113-Urticees" -table urticees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/114-Cannabinees" -table cannabinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/115-Juglandees" -table juglandees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/116-Cupuliferes" -table cupuliferes
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/117-Salicinees" -table salicinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/118-Platanees" -table platanees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/119-Betulinees" -table betulinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/120-Myricees" -table myricees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/121-Alismacees" -table alismacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/122-Butomees" -table butomees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/123-Colchicacees" -table colchicacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/124-Liliacees" -table liliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/125-Dioscorees" -table dioscorees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/126-Iridees" -table iridees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/127-Amaryllidees" -table amaryllidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/128-tablerchidees" -table orchidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/129-Hydrocharidees" -table hydrocharidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/130-Joncaginees" -table joncaginees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/131-Potamees" -table potamees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/132-Naiadees" -table naiadees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/133-Zosteracees" -table zosteracees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/134-Lemnacees" -table lemnacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/135-Aroidees" -table aroidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/136-Typhacees" -table typhacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/137-Joncees" -table joncees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/138-Cyperacees" -table cyperacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/139-Graminees" -table graminees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/140-Abietinees" -table abietinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/141-Cupressinees" -table cupressinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/142-Taxinees" -table taxinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/143-Gnetacees" -table gnetacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/144-Fougeres" -table fougeres
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/145-tablephioglossees" -table ophioglossees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/146-Marsiliacees" -table marsiliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/147-Equisetacees" -table equisetacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/148-Isoetees" -table isoetees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a charger -dossier "menus/149-Lycopodiacees" -table lycopodiacees
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:eol-style
+native
\ No newline at end of property
/tags/v5.7-arrayanal/scripts/modules/bonnier/shell/generer_html.sh
New file
0,0 → 1,149
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/001-Renonculacees" -table renonculacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/002-Berberidees" -table berberidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/003-Nympheacees" -table nympheacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/004-Papaveracees" -table papaveracees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/005-Fumariacees" -table fumariacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/006-Cruciferes" -table cruciferes
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/007-Capparidees" -table capparidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/008-Cistinees" -table cistinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/009-Violariees" -table violariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/010-Resedacees" -table resedacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/011-Droseracees" -table droseracees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/012-Polygalees" -table polygalees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/013-Frankeniacees" -table frankeniacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/014-Caryophyllees" -table caryophyllees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/015-Elatinees" -table elatinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/016-Linees" -table linees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/017-Tiliacees" -table tiliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/018-Malvacees" -table malvacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/019-Geraniees" -table geraniees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/020-Hypericinees" -table hypericinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/021-Acerinees" -table acerinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/022-Ampelidees" -table ampelidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/023-Hippocastanees" -table hippocastanees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/024-Meliacees" -table meliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/025-Balsaminees" -table balsaminees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/026-tablexalidees" -table oxalidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/027-Zygophyllees" -table zygophyllees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/028-Hesperidees" -table hesperidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/029-Rutacees" -table rutacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/030-Coriariees" -table coriariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/031-Celastrinees" -table celastrinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/032-Staphyleacees" -table staphyleacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/033-dossierlicinees" -table ilicinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/034-Rhamnees" -table rhamnees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/035-Terebinthacees" -table terebinthacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/036-Papilionacees" -table papilionacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/037-Cesalpiniees" -table cesalpiniees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/038-Rosacees" -table rosacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/039-Granatees" -table granatees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/040-tablenagrariees" -table onagrariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/041-Myriophyllees" -table myriophyllees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/042-Hippuridees" -table hippuridees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/043-Callitrichinees" -table callitrichinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/044-Ceratophyllees" -table ceratophyllees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/045-Lythrariees" -table lythrariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/046-Philadelphees" -table philadelphees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/047-Tamariscinees" -table tamariscinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/048-Myrtacees" -table myrtacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/049-Cucurbitacees" -table cucurbitacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/050-Portulacees" -table portulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/051-Paronychiees" -table paronychiees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/052-Crassulacees" -table crassulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/053-Cactees" -table cactees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/054-Ficoïdees" -table ficoïdees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/055-Grossulariees" -table grossulariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/056-Saxifragees" -table saxifragees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/057-tablembelliferes" -table ombelliferes
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/058-Araliacees" -table araliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/059-Cornees" -table cornees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/060-Loranthacees" -table loranthacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/061-Caprifoliacees" -table caprifoliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/062-Rubiacees" -table rubiacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/063-Valerianees" -table valerianees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/064-Dipsacees" -table dipsacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/065-Composees" -table composees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/066-Ambrosiacees" -table ambrosiacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/067-Lobeliacees" -table lobeliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/068-Campanulacees" -table campanulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/069-Vacciniees" -table vacciniees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/070-Ericinees" -table ericinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/071-Pyrolacees" -table pyrolacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/072-Monotropees" -table monotropees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/073-Lentibulariees" -table lentibulariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/074-Primulacees" -table primulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/075-Ebenacees" -table ebenacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/076-Styracees" -table styracees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/077-tableleinees" -table oleinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/078-Jasminees" -table jasminees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/079-Apocynees" -table apocynees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/080-Asclepiadees" -table asclepiadees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/081-Gentianees" -table gentianees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/082-Polemoniacees" -table polemoniacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/083-Convolvulacees" -table convolvulacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/084-Cuscutacees" -table cuscutacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/085-Ramondiacees" -table ramondiacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/086-Borraginees" -table borraginees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/087-Solanees" -table solanees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/088-Verbascees" -table verbascees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/089-Scrofularinees" -table scrofularinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/090-tablerobanchees" -table orobanchees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/091-Labiees" -table labiees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/092-Acanthacees" -table acanthacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/093-Verbenacees" -table verbenacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/094-Plantaginees" -table plantaginees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/095-Plombaginees" -table plombaginees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/096-Globulariees" -table globulariees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/097-Phytolaccees" -table phytolaccees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/098-Amarantacees" -table amarantacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/099-Salsolacees" -table salsolacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/100-Polygonees" -table polygonees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/101-Daphnoidees" -table daphnoidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/102-Laurinees" -table laurinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/103-Santalacees" -table santalacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/104-Eleagnees" -table eleagnees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/105-Cytinees" -table cytinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/106-Aristolochiees" -table aristolochiees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/107-Empetrees" -table empetrees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/108-Euphorbiacees" -table euphorbiacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/109-Morees" -table morees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/110-Ficacees" -table ficacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/111-Celtidees" -table celtidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/112-Ulmacees" -table ulmacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/113-Urticees" -table urticees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/114-Cannabinees" -table cannabinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/115-Juglandees" -table juglandees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/116-Cupuliferes" -table cupuliferes
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/117-Salicinees" -table salicinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/118-Platanees" -table platanees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/119-Betulinees" -table betulinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/120-Myricees" -table myricees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/121-Alismacees" -table alismacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/122-Butomees" -table butomees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/123-Colchicacees" -table colchicacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/124-Liliacees" -table liliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/125-Dioscorees" -table dioscorees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/126-dossierridees" -table iridees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/127-Amaryllidees" -table amaryllidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/128-tablerchidees" -table orchidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/129-Hydrocharidees" -table hydrocharidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/130-Joncaginees" -table joncaginees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/131-Potamees" -table potamees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/132-Naiadees" -table naiadees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/133-Zosteracees" -table zosteracees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/134-Lemnacees" -table lemnacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/135-Aroidees" -table aroidees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/136-Typhacees" -table typhacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/137-Joncees" -table joncees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/138-Cyperacees" -table cyperacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/139-Graminees" -table graminees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/140-Abietinees" -table abietinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/141-Cupressinees" -table cupressinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/142-Taxinees" -table taxinees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/143-Gnetacees" -table gnetacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/144-Fougeres" -table fougeres
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/145-tablephioglossees" -table ophioglossees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/146-Marsiliacees" -table marsiliacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/147-Equisetacees" -table equisetacees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/148-dossiersoetees" -table isoetees
/opt/lampp/bin/php ../../../script.php bonnier -p bonnier -a html -dossier "menus/149-Lycopodiacees" -table lycopodiacees
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:eol-style
+native
\ No newline at end of property
/tags/v5.7-arrayanal/scripts/modules/bonnier/shell/generer_sql.sh
New file
0,0 → 1,298
perl xls2sql.pl file="001-Renonculacées-Plante.xls" skip=0 table="bonnier_v0_00_renonculacees_plante" > bonnier_v0_00_renonculacees_plante.sql
perl xls2sql.pl file="001-Renonculacées-Texte.xls" skip=0 table="bonnier_v0_00_renonculacees_texte" > bonnier_v0_00_renonculacees_texte.sql
perl xls2sql.pl file="002-Berbéridées-Plante.xls" skip=0 table="bonnier_v0_00_berberidees_plante" > bonnier_v0_00_berberidees_plante.sql
perl xls2sql.pl file="002-Berbéridées-Texte.xls" skip=0 table="bonnier_v0_00_berberidees_texte" > bonnier_v0_00_berberidees_texte.sql
perl xls2sql.pl file="003-Nymphéacées-Plante.xls" skip=0 table="bonnier_v0_00_nympheacees_plante" > bonnier_v0_00_nympheacees_plante.sql
perl xls2sql.pl file="003-Nymphéacées-Texte.xls" skip=0 table="bonnier_v0_00_nympheacees_texte" > bonnier_v0_00_nympheacees_texte.sql
perl xls2sql.pl file="004-Papavéracées-Plante.xls" skip=0 table="bonnier_v0_00_papaveracees_plante" > bonnier_v0_00_papaveracees_plante.sql
perl xls2sql.pl file="004-Papavéracées-Texte.xls" skip=0 table="bonnier_v0_00_papaveracees_texte" > bonnier_v0_00_papaveracees_texte.sql
perl xls2sql.pl file="005-Fumariacées-Plante.xls" skip=0 table="bonnier_v0_00_fumariacees_plante" > bonnier_v0_00_fumariacees_plante.sql
perl xls2sql.pl file="005-Fumariacées-Texte.xls" skip=0 table="bonnier_v0_00_fumariacees_texte" > bonnier_v0_00_fumariacees_texte.sql
perl xls2sql.pl file="006-Crucifères-Plante.xls" skip=0 table="bonnier_v0_00_cruciferes_plante" > bonnier_v0_00_cruciferes_plante.sql
perl xls2sql.pl file="006-Crucifères-Texte.xls" skip=0 table="bonnier_v0_00_cruciferes_texte" > bonnier_v0_00_cruciferes_texte.sql
perl xls2sql.pl file="007-Capparidées-Plante.xls" skip=0 table="bonnier_v0_00_capparidees_plante" > bonnier_v0_00_capparidees_plante.sql
perl xls2sql.pl file="007-Capparidées-Texte.xls" skip=0 table="bonnier_v0_00_capparidees_texte" > bonnier_v0_00_capparidees_texte.sql
perl xls2sql.pl file="008-Cistinées-Plante.xls" skip=0 table="bonnier_v0_00_cistinees_plante" > bonnier_v0_00_cistinees_plante.sql
perl xls2sql.pl file="008-Cistinées-Texte.xls" skip=0 table="bonnier_v0_00_cistinees_texte" > bonnier_v0_00_cistinees_texte.sql
perl xls2sql.pl file="009-Violariées-Plante.xls" skip=0 table="bonnier_v0_00_violariees_plante" > bonnier_v0_00_violariees_plante.sql
perl xls2sql.pl file="009-Violariées-Texte.xls" skip=0 table="bonnier_v0_00_violariees_texte" > bonnier_v0_00_violariees_texte.sql
perl xls2sql.pl file="010-Résédacées-Plante.xls" skip=0 table="bonnier_v0_00_résedacees_plante" > bonnier_v0_00_résedacees_plante.sql
perl xls2sql.pl file="010-Résédacées-Texte.xls" skip=0 table="bonnier_v0_00_résedacees_texte" > bonnier_v0_00_résedacees_texte.sql
perl xls2sql.pl file="011-Droséracées-Plante.xls" skip=0 table="bonnier_v0_00_droseracees_plante" > bonnier_v0_00_droseracees_plante.sql
perl xls2sql.pl file="011-Droséracées-Texte.xls" skip=0 table="bonnier_v0_00_droseracees_texte" > bonnier_v0_00_droseracees_texte.sql
perl xls2sql.pl file="012-Polygalées-Plante.xls" skip=0 table="bonnier_v0_00_polygalees_plante" > bonnier_v0_00_polygalees_plante.sql
perl xls2sql.pl file="012-Polygalées-Texte.xls" skip=0 table="bonnier_v0_00_polygalees_texte" > bonnier_v0_00_polygalees_texte.sql
perl xls2sql.pl file="013-Frankéniacées-Plante.xls" skip=0 table="bonnier_v0_00_frankeniacees_plante" > bonnier_v0_00_frankeniacees_plante.sql
perl xls2sql.pl file="013-Frankéniacées-Texte.xls" skip=0 table="bonnier_v0_00_frankeniacees_texte" > bonnier_v0_00_frankeniacees_texte.sql
perl xls2sql.pl file="014-Caryophyllées-Plante.xls" skip=0 table="bonnier_v0_00_caryophyllees_plante" > bonnier_v0_00_caryophyllees_plante.sql
perl xls2sql.pl file="014-Caryophyllées-Texte.xls" skip=0 table="bonnier_v0_00_caryophyllees_texte" > bonnier_v0_00_caryophyllees_texte.sql
perl xls2sql.pl file="015-Elatinées-Plante.xls" skip=0 table="bonnier_v0_00_elatinees_plante" > bonnier_v0_00_elatinees_plante.sql
perl xls2sql.pl file="015-Elatinées-Texte.xls" skip=0 table="bonnier_v0_00_elatinees_texte" > bonnier_v0_00_elatinees_texte.sql
perl xls2sql.pl file="016-Linées-Plante.xls" skip=0 table="bonnier_v0_00_linees_plante" > bonnier_v0_00_linees_plante.sql
perl xls2sql.pl file="016-Linées-Texte.xls" skip=0 table="bonnier_v0_00_linees_texte" > bonnier_v0_00_linees_texte.sql
perl xls2sql.pl file="017-Tiliacées-Plante.xls" skip=0 table="bonnier_v0_00_tiliacees_plante" > bonnier_v0_00_tiliacees_plante.sql
perl xls2sql.pl file="017-Tiliacées-Texte.xls" skip=0 table="bonnier_v0_00_tiliacees_texte" > bonnier_v0_00_tiliacees_texte.sql
perl xls2sql.pl file="018-Malvacées-Plante.xls" skip=0 table="bonnier_v0_00_malvacees_plante" > bonnier_v0_00_malvacees_plante.sql
perl xls2sql.pl file="018-Malvacées-Texte.xls" skip=0 table="bonnier_v0_00_malvacees_texte" > bonnier_v0_00_malvacees_texte.sql
perl xls2sql.pl file="019-Géraniées-Plante.xls" skip=0 table="bonnier_v0_00_geraniees_plante" > bonnier_v0_00_geraniees_plante.sql
perl xls2sql.pl file="019-Géraniées-Texte.xls" skip=0 table="bonnier_v0_00_geraniees_texte" > bonnier_v0_00_geraniees_texte.sql
perl xls2sql.pl file="020-Hypéricinées-Plante.xls" skip=0 table="bonnier_v0_00_hypericinees_plante" > bonnier_v0_00_hypericinees_plante.sql
perl xls2sql.pl file="020-Hypéricinées-Texte.xls" skip=0 table="bonnier_v0_00_hypericinees_texte" > bonnier_v0_00_hypericinees_texte.sql
perl xls2sql.pl file="021-Acérinées-Plante.xls" skip=0 table="bonnier_v0_00_acerinees_plante" > bonnier_v0_00_acerinees_plante.sql
perl xls2sql.pl file="021-Acérinées-Texte.xls" skip=0 table="bonnier_v0_00_acerinees_texte" > bonnier_v0_00_acerinees_texte.sql
perl xls2sql.pl file="022-Ampélidées-Plante.xls" skip=0 table="bonnier_v0_00_ampelidees_plante" > bonnier_v0_00_ampelidees_plante.sql
perl xls2sql.pl file="022-Ampélidées-Texte.xls" skip=0 table="bonnier_v0_00_ampelidees_texte" > bonnier_v0_00_ampelidees_texte.sql
perl xls2sql.pl file="023-Hippocastanées-Plante.xls" skip=0 table="bonnier_v0_00_hippocastanees_plante" > bonnier_v0_00_hippocastanees_plante.sql
perl xls2sql.pl file="023-Hippocastanées-Texte.xls" skip=0 table="bonnier_v0_00_hippocastanees_texte" > bonnier_v0_00_hippocastanees_texte.sql
perl xls2sql.pl file="024-Méliacées-Plante.xls" skip=0 table="bonnier_v0_00_meliacees_plante" > bonnier_v0_00_meliacees_plante.sql
perl xls2sql.pl file="024-Méliacées-Texte.xls" skip=0 table="bonnier_v0_00_meliacees_texte" > bonnier_v0_00_meliacees_texte.sql
perl xls2sql.pl file="025-Balsaminées-Plante.xls" skip=0 table="bonnier_v0_00_balsaminees_plante" > bonnier_v0_00_balsaminees_plante.sql
perl xls2sql.pl file="025-Balsaminées-Texte.xls" skip=0 table="bonnier_v0_00_balsaminees_texte" > bonnier_v0_00_balsaminees_texte.sql
perl xls2sql.pl file="026-Oxalidées-Plante.xls" skip=0 table="bonnier_v0_00_oxalidees_plante" > bonnier_v0_00_oxalidees_plante.sql
perl xls2sql.pl file="026-Oxalidées-Texte.xls" skip=0 table="bonnier_v0_00_oxalidees_texte" > bonnier_v0_00_oxalidees_texte.sql
perl xls2sql.pl file="027-Zygophyllées-Plante.xls" skip=0 table="bonnier_v0_00_zygophyllees_plante" > bonnier_v0_00_zygophyllees_plante.sql
perl xls2sql.pl file="027-Zygophyllées-Texte.xls" skip=0 table="bonnier_v0_00_zygophyllees_texte" > bonnier_v0_00_zygophyllees_texte.sql
perl xls2sql.pl file="028-Hespéridées-Plante.xls" skip=0 table="bonnier_v0_00_hesperidees_plante" > bonnier_v0_00_hesperidees_plante.sql
perl xls2sql.pl file="028-Hespéridées-Texte.xls" skip=0 table="bonnier_v0_00_hesperidees_texte" > bonnier_v0_00_hesperidees_texte.sql
perl xls2sql.pl file="029-Rutacées-Plante.xls" skip=0 table="bonnier_v0_00_rutacees_plante" > bonnier_v0_00_rutacees_plante.sql
perl xls2sql.pl file="029-Rutacées-Texte.xls" skip=0 table="bonnier_v0_00_rutacees_texte" > bonnier_v0_00_rutacees_texte.sql
perl xls2sql.pl file="030-Coriariées-Plante.xls" skip=0 table="bonnier_v0_00_coriariees_plante" > bonnier_v0_00_coriariees_plante.sql
perl xls2sql.pl file="030-Coriariées-Texte.xls" skip=0 table="bonnier_v0_00_coriariees_texte" > bonnier_v0_00_coriariees_texte.sql
perl xls2sql.pl file="031-Celastrinées-Plante.xls" skip=0 table="bonnier_v0_00_celastrinees_plante" > bonnier_v0_00_celastrinees_plante.sql
perl xls2sql.pl file="031-Celastrinées-Texte.xls" skip=0 table="bonnier_v0_00_celastrinees_texte" > bonnier_v0_00_celastrinees_texte.sql
perl xls2sql.pl file="032-Staphyléacées-Plante.xls" skip=0 table="bonnier_v0_00_staphyleacees_plante" > bonnier_v0_00_staphyleacees_plante.sql
perl xls2sql.pl file="032-Staphyléacées-Texte.xls" skip=0 table="bonnier_v0_00_staphyleacees_texte" > bonnier_v0_00_staphyleacees_texte.sql
perl xls2sql.pl file="033-Ilicinées-Plante.xls" skip=0 table="bonnier_v0_00_ilicinees_plante" > bonnier_v0_00_ilicinees_plante.sql
perl xls2sql.pl file="033-Ilicinées-Texte.xls" skip=0 table="bonnier_v0_00_ilicinees_texte" > bonnier_v0_00_ilicinees_texte.sql
perl xls2sql.pl file="034-Rhamnées-Plante.xls" skip=0 table="bonnier_v0_00_rhamnees_plante" > bonnier_v0_00_rhamnees_plante.sql
perl xls2sql.pl file="034-Rhamnées-Texte.xls" skip=0 table="bonnier_v0_00_rhamnees_texte" > bonnier_v0_00_rhamnees_texte.sql
perl xls2sql.pl file="035-Térébinthacées-Plante.xls" skip=0 table="bonnier_v0_00_térebinthacees_plante" > bonnier_v0_00_térebinthacees_plante.sql
perl xls2sql.pl file="035-Térébinthacées-Texte.xls" skip=0 table="bonnier_v0_00_térebinthacees_texte" > bonnier_v0_00_térebinthacees_texte.sql
perl xls2sql.pl file="036-Papilionacées-Plante.xls" skip=0 table="bonnier_v0_00_papilionacees_plante" > bonnier_v0_00_papilionacees_plante.sql
perl xls2sql.pl file="036-Papilionacées-Texte.xls" skip=0 table="bonnier_v0_00_papilionacees_texte" > bonnier_v0_00_papilionacees_texte.sql
perl xls2sql.pl file="037-Césalpiniées-Plante.xls" skip=0 table="bonnier_v0_00_cesalpiniees_plante" > bonnier_v0_00_cesalpiniees_plante.sql
perl xls2sql.pl file="037-Césalpiniées-Texte.xls" skip=0 table="bonnier_v0_00_cesalpiniees_texte" > bonnier_v0_00_cesalpiniees_texte.sql
perl xls2sql.pl file="038-Rosacées-Plante.xls" skip=0 table="bonnier_v0_00_rosacees_plante" > bonnier_v0_00_rosacees_plante.sql
perl xls2sql.pl file="038-Rosacées-Texte.xls" skip=0 table="bonnier_v0_00_rosacees_texte" > bonnier_v0_00_rosacees_texte.sql
perl xls2sql.pl file="039-Granatées-Plante.xls" skip=0 table="bonnier_v0_00_granatees_plante" > bonnier_v0_00_granatees_plante.sql
perl xls2sql.pl file="039-Granatées-Texte.xls" skip=0 table="bonnier_v0_00_granatees_texte" > bonnier_v0_00_granatees_texte.sql
perl xls2sql.pl file="040-Onagrariées-Plante.xls" skip=0 table="bonnier_v0_00_onagrariees_plante" > bonnier_v0_00_onagrariees_plante.sql
perl xls2sql.pl file="040-Onagrariées-Texte.xls" skip=0 table="bonnier_v0_00_onagrariees_texte" > bonnier_v0_00_onagrariees_texte.sql
perl xls2sql.pl file="041-Myriophyllées-Plante.xls" skip=0 table="bonnier_v0_00_myriophyllees_plante" > bonnier_v0_00_myriophyllees_plante.sql
perl xls2sql.pl file="041-Myriophyllées-Texte.xls" skip=0 table="bonnier_v0_00_myriophyllees_texte" > bonnier_v0_00_myriophyllees_texte.sql
perl xls2sql.pl file="042-Hippuridées-Plante.xls" skip=0 table="bonnier_v0_00_hippuridees_plante" > bonnier_v0_00_hippuridees_plante.sql
perl xls2sql.pl file="042-Hippuridées-Texte.xls" skip=0 table="bonnier_v0_00_hippuridees_texte" > bonnier_v0_00_hippuridees_texte.sql
perl xls2sql.pl file="043-Callitrichinées-Plante.xls" skip=0 table="bonnier_v0_00_callitrichinees_plante" > bonnier_v0_00_callitrichinees_plante.sql
perl xls2sql.pl file="043-Callitrichinées-Texte.xls" skip=0 table="bonnier_v0_00_callitrichinees_texte" > bonnier_v0_00_callitrichinees_texte.sql
perl xls2sql.pl file="044-Ceratophyllées-Plante.xls" skip=0 table="bonnier_v0_00_ceratophyllees_plante" > bonnier_v0_00_ceratophyllees_plante.sql
perl xls2sql.pl file="044-Ceratophyllées-Texte.xls" skip=0 table="bonnier_v0_00_ceratophyllees_texte" > bonnier_v0_00_ceratophyllees_texte.sql
perl xls2sql.pl file="045-Lythrariées-Plante.xls" skip=0 table="bonnier_v0_00_lythrariees_plante" > bonnier_v0_00_lythrariees_plante.sql
perl xls2sql.pl file="045-Lythrariées-Texte.xls" skip=0 table="bonnier_v0_00_lythrariees_texte" > bonnier_v0_00_lythrariees_texte.sql
perl xls2sql.pl file="046-Philadelphées-Plante.xls" skip=0 table="bonnier_v0_00_philadelphees_plante" > bonnier_v0_00_philadelphees_plante.sql
perl xls2sql.pl file="046-Philadelphées-Texte.xls" skip=0 table="bonnier_v0_00_philadelphees_texte" > bonnier_v0_00_philadelphees_texte.sql
perl xls2sql.pl file="047-Tamariscinées-Plante.xls" skip=0 table="bonnier_v0_00_tamariscinees_plante" > bonnier_v0_00_tamariscinees_plante.sql
perl xls2sql.pl file="047-Tamariscinées-Texte.xls" skip=0 table="bonnier_v0_00_tamariscinees_texte" > bonnier_v0_00_tamariscinees_texte.sql
perl xls2sql.pl file="048-Myrtacées-Plante.xls" skip=0 table="bonnier_v0_00_myrtacees_plante" > bonnier_v0_00_myrtacees_plante.sql
perl xls2sql.pl file="048-Myrtacées-Texte.xls" skip=0 table="bonnier_v0_00_myrtacees_texte" > bonnier_v0_00_myrtacees_texte.sql
perl xls2sql.pl file="049-Cucurbitacées-Plante.xls" skip=0 table="bonnier_v0_00_cucurbitacees_plante" > bonnier_v0_00_cucurbitacees_plante.sql
perl xls2sql.pl file="049-Cucurbitacées-Texte.xls" skip=0 table="bonnier_v0_00_cucurbitacees_texte" > bonnier_v0_00_cucurbitacees_texte.sql
perl xls2sql.pl file="050-Portulacées-Plante.xls" skip=0 table="bonnier_v0_00_portulacees_plante" > bonnier_v0_00_portulacees_plante.sql
perl xls2sql.pl file="050-Portulacées-Texte.xls" skip=0 table="bonnier_v0_00_portulacees_texte" > bonnier_v0_00_portulacees_texte.sql
perl xls2sql.pl file="051-Paronychiées-Plante.xls" skip=0 table="bonnier_v0_00_paronychiees_plante" > bonnier_v0_00_paronychiees_plante.sql
perl xls2sql.pl file="051-Paronychiées-Texte.xls" skip=0 table="bonnier_v0_00_paronychiees_texte" > bonnier_v0_00_paronychiees_texte.sql
perl xls2sql.pl file="052-Crassulacées-Plante.xls" skip=0 table="bonnier_v0_00_crassulacees_plante" > bonnier_v0_00_crassulacees_plante.sql
perl xls2sql.pl file="052-Crassulacées-Texte.xls" skip=0 table="bonnier_v0_00_crassulacees_texte" > bonnier_v0_00_crassulacees_texte.sql
perl xls2sql.pl file="053-Cactées-Plante.xls" skip=0 table="bonnier_v0_00_cactees_plante" > bonnier_v0_00_cactees_plante.sql
perl xls2sql.pl file="053-Cactées-Texte.xls" skip=0 table="bonnier_v0_00_cactees_texte" > bonnier_v0_00_cactees_texte.sql
perl xls2sql.pl file="054-Ficoïdées-Plante.xls" skip=0 table="bonnier_v0_00_ficoïdees_plante" > bonnier_v0_00_ficoïdees_plante.sql
perl xls2sql.pl file="054-Ficoïdées-Texte.xls" skip=0 table="bonnier_v0_00_ficoïdees_texte" > bonnier_v0_00_ficoïdees_texte.sql
perl xls2sql.pl file="055-Grossulariées-Plante.xls" skip=0 table="bonnier_v0_00_grossulariees_plante" > bonnier_v0_00_grossulariees_plante.sql
perl xls2sql.pl file="055-Grossulariées-Texte.xls" skip=0 table="bonnier_v0_00_grossulariees_texte" > bonnier_v0_00_grossulariees_texte.sql
perl xls2sql.pl file="056-Saxifragées-Plante.xls" skip=0 table="bonnier_v0_00_saxifragees_plante" > bonnier_v0_00_saxifragees_plante.sql
perl xls2sql.pl file="056-Saxifragées-Texte.xls" skip=0 table="bonnier_v0_00_saxifragees_texte" > bonnier_v0_00_saxifragees_texte.sql
perl xls2sql.pl file="057-Ombelliféres-Plante.xls" skip=0 table="bonnier_v0_00_ombelliferes_plante" > bonnier_v0_00_ombelliferes_plante.sql
perl xls2sql.pl file="057-Ombelliféres-Texte.xls" skip=0 table="bonnier_v0_00_ombelliferes_texte" > bonnier_v0_00_ombelliferes_texte.sql
perl xls2sql.pl file="058-Araliacées-Plante.xls" skip=0 table="bonnier_v0_00_araliacees_plante" > bonnier_v0_00_araliacees_plante.sql
perl xls2sql.pl file="058-Araliacées-Texte.xls" skip=0 table="bonnier_v0_00_araliacees_texte" > bonnier_v0_00_araliacees_texte.sql
perl xls2sql.pl file="059-Cornées-Plante.xls" skip=0 table="bonnier_v0_00_cornees_plante" > bonnier_v0_00_cornees_plante.sql
perl xls2sql.pl file="059-Cornées-Texte.xls" skip=0 table="bonnier_v0_00_cornees_texte" > bonnier_v0_00_cornees_texte.sql
perl xls2sql.pl file="060-Loranthacées-Plante.xls" skip=0 table="bonnier_v0_00_loranthacees_plante" > bonnier_v0_00_loranthacees_plante.sql
perl xls2sql.pl file="060-Loranthacées-Texte.xls" skip=0 table="bonnier_v0_00_loranthacees_texte" > bonnier_v0_00_loranthacees_texte.sql
perl xls2sql.pl file="061-Caprifoliacées-Plante.xls" skip=0 table="bonnier_v0_00_caprifoliacees_plante" > bonnier_v0_00_caprifoliacees_plante.sql
perl xls2sql.pl file="061-Caprifoliacées-Texte.xls" skip=0 table="bonnier_v0_00_caprifoliacees_texte" > bonnier_v0_00_caprifoliacees_texte.sql
perl xls2sql.pl file="062-Rubiacées-Plante.xls" skip=0 table="bonnier_v0_00_rubiacees_plante" > bonnier_v0_00_rubiacees_plante.sql
perl xls2sql.pl file="062-Rubiacées-Texte.xls" skip=0 table="bonnier_v0_00_rubiacees_texte" > bonnier_v0_00_rubiacees_texte.sql
perl xls2sql.pl file="063-Valérianées-Plante.xls" skip=0 table="bonnier_v0_00_valerianees_plante" > bonnier_v0_00_valerianees_plante.sql
perl xls2sql.pl file="063-Valérianées-Texte.xls" skip=0 table="bonnier_v0_00_valerianees_texte" > bonnier_v0_00_valerianees_texte.sql
perl xls2sql.pl file="064-Dipsacées-Plante.xls" skip=0 table="bonnier_v0_00_dipsacees_plante" > bonnier_v0_00_dipsacees_plante.sql
perl xls2sql.pl file="064-Dipsacées-Texte.xls" skip=0 table="bonnier_v0_00_dipsacees_texte" > bonnier_v0_00_dipsacees_texte.sql
perl xls2sql.pl file="065-Composées-Plante.xls" skip=0 table="bonnier_v0_00_composees_plante" > bonnier_v0_00_composees_plante.sql
perl xls2sql.pl file="065-Composées-Texte.xls" skip=0 table="bonnier_v0_00_composees_texte" > bonnier_v0_00_composees_texte.sql
perl xls2sql.pl file="066-Ambrosiacées-Plante.xls" skip=0 table="bonnier_v0_00_ambrosiacees_plante" > bonnier_v0_00_ambrosiacees_plante.sql
perl xls2sql.pl file="066-Ambrosiacées-Texte.xls" skip=0 table="bonnier_v0_00_ambrosiacees_texte" > bonnier_v0_00_ambrosiacees_texte.sql
perl xls2sql.pl file="067-Lobéliacées-Plante.xls" skip=0 table="bonnier_v0_00_lobeliacees_plante" > bonnier_v0_00_lobeliacees_plante.sql
perl xls2sql.pl file="067-Lobéliacées-Texte.xls" skip=0 table="bonnier_v0_00_lobeliacees_texte" > bonnier_v0_00_lobeliacees_texte.sql
perl xls2sql.pl file="068-Campanulacées-Plante.xls" skip=0 table="bonnier_v0_00_campanulacees_plante" > bonnier_v0_00_campanulacees_plante.sql
perl xls2sql.pl file="068-Campanulacées-Texte.xls" skip=0 table="bonnier_v0_00_campanulacees_texte" > bonnier_v0_00_campanulacees_texte.sql
perl xls2sql.pl file="069-Vacciniées-Plante.xls" skip=0 table="bonnier_v0_00_vacciniees_plante" > bonnier_v0_00_vacciniees_plante.sql
perl xls2sql.pl file="069-Vacciniées-Texte.xls" skip=0 table="bonnier_v0_00_vacciniees_texte" > bonnier_v0_00_vacciniees_texte.sql
perl xls2sql.pl file="070-Ericinées-Plante.xls" skip=0 table="bonnier_v0_00_ericinees_plante" > bonnier_v0_00_ericinees_plante.sql
perl xls2sql.pl file="070-Ericinées-Texte.xls" skip=0 table="bonnier_v0_00_ericinees_texte" > bonnier_v0_00_ericinees_texte.sql
perl xls2sql.pl file="071-Pyrolacées-Plante.xls" skip=0 table="bonnier_v0_00_pyrolacees_plante" > bonnier_v0_00_pyrolacees_plante.sql
perl xls2sql.pl file="071-Pyrolacées-Texte.xls" skip=0 table="bonnier_v0_00_pyrolacees_texte" > bonnier_v0_00_pyrolacees_texte.sql
perl xls2sql.pl file="072-Monotropées-Plante.xls" skip=0 table="bonnier_v0_00_monotropees_plante" > bonnier_v0_00_monotropees_plante.sql
perl xls2sql.pl file="072-Monotropées-Texte.xls" skip=0 table="bonnier_v0_00_monotropees_texte" > bonnier_v0_00_monotropees_texte.sql
perl xls2sql.pl file="073-Lentibulariées-Plante.xls" skip=0 table="bonnier_v0_00_lentibulariees_plante" > bonnier_v0_00_lentibulariees_plante.sql
perl xls2sql.pl file="073-Lentibulariées-Texte.xls" skip=0 table="bonnier_v0_00_lentibulariees_texte" > bonnier_v0_00_lentibulariees_texte.sql
perl xls2sql.pl file="074-Primulacées-Plante.xls" skip=0 table="bonnier_v0_00_primulacees_plante" > bonnier_v0_00_primulacees_plante.sql
perl xls2sql.pl file="074-Primulacées-Texte.xls" skip=0 table="bonnier_v0_00_primulacees_texte" > bonnier_v0_00_primulacees_texte.sql
perl xls2sql.pl file="075-Ebénacées-Plante.xls" skip=0 table="bonnier_v0_00_ebenacees_plante" > bonnier_v0_00_ebenacees_plante.sql
perl xls2sql.pl file="075-Ebénacées-Texte.xls" skip=0 table="bonnier_v0_00_ebenacees_texte" > bonnier_v0_00_ebenacees_texte.sql
perl xls2sql.pl file="076-Styracées-Plante.xls" skip=0 table="bonnier_v0_00_styracees_plante" > bonnier_v0_00_styracees_plante.sql
perl xls2sql.pl file="076-Styracées-Texte.xls" skip=0 table="bonnier_v0_00_styracees_texte" > bonnier_v0_00_styracees_texte.sql
perl xls2sql.pl file="077-Oléinées-Plante.xls" skip=0 table="bonnier_v0_00_oleinees_plante" > bonnier_v0_00_oleinees_plante.sql
perl xls2sql.pl file="077-Oléinées-Texte.xls" skip=0 table="bonnier_v0_00_oleinees_texte" > bonnier_v0_00_oleinees_texte.sql
perl xls2sql.pl file="078-Jasminées-Plante.xls" skip=0 table="bonnier_v0_00_jasminees_plante" > bonnier_v0_00_jasminees_plante.sql
perl xls2sql.pl file="078-Jasminées-Texte.xls" skip=0 table="bonnier_v0_00_jasminees_texte" > bonnier_v0_00_jasminees_texte.sql
perl xls2sql.pl file="079-Apocynées-Plante.xls" skip=0 table="bonnier_v0_00_apocynees_plante" > bonnier_v0_00_apocynees_plante.sql
perl xls2sql.pl file="079-Apocynées-Texte.xls" skip=0 table="bonnier_v0_00_apocynees_texte" > bonnier_v0_00_apocynees_texte.sql
perl xls2sql.pl file="080-Asclépiadées-Plante.xls" skip=0 table="bonnier_v0_00_asclepiadees_plante" > bonnier_v0_00_asclepiadees_plante.sql
perl xls2sql.pl file="080-Asclépiadées-Texte.xls" skip=0 table="bonnier_v0_00_asclepiadees_texte" > bonnier_v0_00_asclepiadees_texte.sql
perl xls2sql.pl file="081-Gentianées-Plante.xls" skip=0 table="bonnier_v0_00_gentianees_plante" > bonnier_v0_00_gentianees_plante.sql
perl xls2sql.pl file="081-Gentianées-Texte.xls" skip=0 table="bonnier_v0_00_gentianees_texte" > bonnier_v0_00_gentianees_texte.sql
perl xls2sql.pl file="082-Polémoniacées-Plante.xls" skip=0 table="bonnier_v0_00_polemoniacees_plante" > bonnier_v0_00_polemoniacees_plante.sql
perl xls2sql.pl file="082-Polémoniacées-Texte.xls" skip=0 table="bonnier_v0_00_polemoniacees_texte" > bonnier_v0_00_polemoniacees_texte.sql
perl xls2sql.pl file="083-Convolvulacées-Plante.xls" skip=0 table="bonnier_v0_00_convolvulacees_plante" > bonnier_v0_00_convolvulacees_plante.sql
perl xls2sql.pl file="083-Convolvulacées-Texte.xls" skip=0 table="bonnier_v0_00_convolvulacees_texte" > bonnier_v0_00_convolvulacees_texte.sql
perl xls2sql.pl file="084-Cuscutacées-Plante.xls" skip=0 table="bonnier_v0_00_cuscutacees_plante" > bonnier_v0_00_cuscutacees_plante.sql
perl xls2sql.pl file="084-Cuscutacées-Texte.xls" skip=0 table="bonnier_v0_00_cuscutacees_texte" > bonnier_v0_00_cuscutacees_texte.sql
perl xls2sql.pl file="085-Ramondiacées-Plante.xls" skip=0 table="bonnier_v0_00_ramondiacees_plante" > bonnier_v0_00_ramondiacees_plante.sql
perl xls2sql.pl file="085-Ramondiacées-Texte.xls" skip=0 table="bonnier_v0_00_ramondiacees_texte" > bonnier_v0_00_ramondiacees_texte.sql
perl xls2sql.pl file="086-Borraginées-Plante.xls" skip=0 table="bonnier_v0_00_borraginees_plante" > bonnier_v0_00_borraginees_plante.sql
perl xls2sql.pl file="086-Borraginées-Texte.xls" skip=0 table="bonnier_v0_00_borraginees_texte" > bonnier_v0_00_borraginees_texte.sql
perl xls2sql.pl file="087-Solanées-Plante.xls" skip=0 table="bonnier_v0_00_solanees_plante" > bonnier_v0_00_solanees_plante.sql
perl xls2sql.pl file="087-Solanées-Texte.xls" skip=0 table="bonnier_v0_00_solanees_texte" > bonnier_v0_00_solanees_texte.sql
perl xls2sql.pl file="088-Verbascées-Plante.xls" skip=0 table="bonnier_v0_00_verbascees_plante" > bonnier_v0_00_verbascees_plante.sql
perl xls2sql.pl file="088-Verbascées-Texte.xls" skip=0 table="bonnier_v0_00_verbascees_texte" > bonnier_v0_00_verbascees_texte.sql
perl xls2sql.pl file="089-Scrofularinées-Plante.xls" skip=0 table="bonnier_v0_00_scrofularinees_plante" > bonnier_v0_00_scrofularinees_plante.sql
perl xls2sql.pl file="089-Scrofularinées-Texte.xls" skip=0 table="bonnier_v0_00_scrofularinees_texte" > bonnier_v0_00_scrofularinees_texte.sql
perl xls2sql.pl file="090-Orobanchées-Plante.xls" skip=0 table="bonnier_v0_00_orobanchees_plante" > bonnier_v0_00_orobanchees_plante.sql
perl xls2sql.pl file="090-Orobanchées-Texte.xls" skip=0 table="bonnier_v0_00_orobanchees_texte" > bonnier_v0_00_orobanchees_texte.sql
perl xls2sql.pl file="091-Labiées-Plante.xls" skip=0 table="bonnier_v0_00_labiees_plante" > bonnier_v0_00_labiees_plante.sql
perl xls2sql.pl file="091-Labiées-Texte.xls" skip=0 table="bonnier_v0_00_labiees_texte" > bonnier_v0_00_labiees_texte.sql
perl xls2sql.pl file="092-Acanthacées-Plante.xls" skip=0 table="bonnier_v0_00_acanthacees_plante" > bonnier_v0_00_acanthacees_plante.sql
perl xls2sql.pl file="092-Acanthacées-Texte.xls" skip=0 table="bonnier_v0_00_acanthacees_texte" > bonnier_v0_00_acanthacees_texte.sql
perl xls2sql.pl file="093-Verbénacées-Plante.xls" skip=0 table="bonnier_v0_00_verbenacees_plante" > bonnier_v0_00_verbenacees_plante.sql
perl xls2sql.pl file="093-Verbénacées-Texte.xls" skip=0 table="bonnier_v0_00_verbenacees_texte" > bonnier_v0_00_verbenacees_texte.sql
perl xls2sql.pl file="094-Plantaginées-Plante.xls" skip=0 table="bonnier_v0_00_plantaginees_plante" > bonnier_v0_00_plantaginees_plante.sql
perl xls2sql.pl file="094-Plantaginées-Texte.xls" skip=0 table="bonnier_v0_00_plantaginees_texte" > bonnier_v0_00_plantaginees_texte.sql
perl xls2sql.pl file="095-Plombaginées-Plante.xls" skip=0 table="bonnier_v0_00_plombaginees_plante" > bonnier_v0_00_plombaginees_plante.sql
perl xls2sql.pl file="095-Plombaginées-Texte.xls" skip=0 table="bonnier_v0_00_plombaginees_texte" > bonnier_v0_00_plombaginees_texte.sql
perl xls2sql.pl file="096-Globulariées-Plante.xls" skip=0 table="bonnier_v0_00_globulariees_plante" > bonnier_v0_00_globulariees_plante.sql
perl xls2sql.pl file="096-Globulariées-Texte.xls" skip=0 table="bonnier_v0_00_globulariees_texte" > bonnier_v0_00_globulariees_texte.sql
perl xls2sql.pl file="097-Phytolaccées-Plante.xls" skip=0 table="bonnier_v0_00_phytolaccees_plante" > bonnier_v0_00_phytolaccees_plante.sql
perl xls2sql.pl file="097-Phytolaccées-Texte.xls" skip=0 table="bonnier_v0_00_phytolaccees_texte" > bonnier_v0_00_phytolaccees_texte.sql
perl xls2sql.pl file="098-Amarantacées-Plante.xls" skip=0 table="bonnier_v0_00_amarantacees_plante" > bonnier_v0_00_amarantacees_plante.sql
perl xls2sql.pl file="098-Amarantacées-Texte.xls" skip=0 table="bonnier_v0_00_amarantacees_texte" > bonnier_v0_00_amarantacees_texte.sql
perl xls2sql.pl file="099-Salsolacées-Plante.xls" skip=0 table="bonnier_v0_00_salsolacees_plante" > bonnier_v0_00_salsolacees_plante.sql
perl xls2sql.pl file="099-Salsolacées-Texte.xls" skip=0 table="bonnier_v0_00_salsolacees_texte" > bonnier_v0_00_salsolacees_texte.sql
perl xls2sql.pl file="100-Polygonées-Plante.xls" skip=0 table="bonnier_v0_00_polygonees_plante" > bonnier_v0_00_polygonees_plante.sql
perl xls2sql.pl file="100-Polygonées-Texte.xls" skip=0 table="bonnier_v0_00_polygonees_texte" > bonnier_v0_00_polygonees_texte.sql
perl xls2sql.pl file="101-Daphnoidées-Plante.xls" skip=0 table="bonnier_v0_00_daphnoidees_plante" > bonnier_v0_00_daphnoidees_plante.sql
perl xls2sql.pl file="101-Daphnoidées-Texte.xls" skip=0 table="bonnier_v0_00_daphnoidees_texte" > bonnier_v0_00_daphnoidees_texte.sql
perl xls2sql.pl file="102-Laurinées-Plante.xls" skip=0 table="bonnier_v0_00_laurinees_plante" > bonnier_v0_00_laurinees_plante.sql
perl xls2sql.pl file="102-Laurinées-Texte.xls" skip=0 table="bonnier_v0_00_laurinees_texte" > bonnier_v0_00_laurinees_texte.sql
perl xls2sql.pl file="103-Santalacées-Plante.xls" skip=0 table="bonnier_v0_00_santalacees_plante" > bonnier_v0_00_santalacees_plante.sql
perl xls2sql.pl file="103-Santalacées-Texte.xls" skip=0 table="bonnier_v0_00_santalacees_texte" > bonnier_v0_00_santalacees_texte.sql
perl xls2sql.pl file="104-Eléagnées-Plante.xls" skip=0 table="bonnier_v0_00_eleagnees_plante" > bonnier_v0_00_eleagnees_plante.sql
perl xls2sql.pl file="104-Eléagnées-Texte.xls" skip=0 table="bonnier_v0_00_eleagnees_texte" > bonnier_v0_00_eleagnees_texte.sql
perl xls2sql.pl file="105-Cytinées-Plante.xls" skip=0 table="bonnier_v0_00_cytinees_plante" > bonnier_v0_00_cytinees_plante.sql
perl xls2sql.pl file="105-Cytinées-Texte.xls" skip=0 table="bonnier_v0_00_cytinees_texte" > bonnier_v0_00_cytinees_texte.sql
perl xls2sql.pl file="106-Aristolochiées-Plante.xls" skip=0 table="bonnier_v0_00_aristolochiees_plante" > bonnier_v0_00_aristolochiees_plante.sql
perl xls2sql.pl file="106-Aristolochiées-Texte.xls" skip=0 table="bonnier_v0_00_aristolochiees_texte" > bonnier_v0_00_aristolochiees_texte.sql
perl xls2sql.pl file="107-Empétrées-Plante.xls" skip=0 table="bonnier_v0_00_empetrees_plante" > bonnier_v0_00_empetrees_plante.sql
perl xls2sql.pl file="107-Empétrées-Texte.xls" skip=0 table="bonnier_v0_00_empetrees_texte" > bonnier_v0_00_empetrees_texte.sql
perl xls2sql.pl file="108-Euphorbiacées-Plante.xls" skip=0 table="bonnier_v0_00_euphorbiacees_plante" > bonnier_v0_00_euphorbiacees_plante.sql
perl xls2sql.pl file="108-Euphorbiacées-Texte.xls" skip=0 table="bonnier_v0_00_euphorbiacees_texte" > bonnier_v0_00_euphorbiacees_texte.sql
perl xls2sql.pl file="109-Morées-Plante.xls" skip=0 table="bonnier_v0_00_morees_plante" > bonnier_v0_00_morees_plante.sql
perl xls2sql.pl file="109-Morées-Texte.xls" skip=0 table="bonnier_v0_00_morees_texte" > bonnier_v0_00_morees_texte.sql
perl xls2sql.pl file="110-Ficacées-Plante.xls" skip=0 table="bonnier_v0_00_ficacees_plante" > bonnier_v0_00_ficacees_plante.sql
perl xls2sql.pl file="110-Ficacées-Texte.xls" skip=0 table="bonnier_v0_00_ficacees_texte" > bonnier_v0_00_ficacees_texte.sql
perl xls2sql.pl file="111-Celtidées-Plante.xls" skip=0 table="bonnier_v0_00_celtidees_plante" > bonnier_v0_00_celtidees_plante.sql
perl xls2sql.pl file="111-Celtidées-Texte.xls" skip=0 table="bonnier_v0_00_celtidees_texte" > bonnier_v0_00_celtidees_texte.sql
perl xls2sql.pl file="112-Ulmacées-Plante.xls" skip=0 table="bonnier_v0_00_ulmacees_plante" > bonnier_v0_00_ulmacees_plante.sql
perl xls2sql.pl file="112-Ulmacées-Texte.xls" skip=0 table="bonnier_v0_00_ulmacees_texte" > bonnier_v0_00_ulmacees_texte.sql
perl xls2sql.pl file="113-Urticées-Plante.xls" skip=0 table="bonnier_v0_00_urticees_plante" > bonnier_v0_00_urticees_plante.sql
perl xls2sql.pl file="113-Urticées-Texte.xls" skip=0 table="bonnier_v0_00_urticees_texte" > bonnier_v0_00_urticees_texte.sql
perl xls2sql.pl file="114-Cannabinées-Plante.xls" skip=0 table="bonnier_v0_00_cannabinees_plante" > bonnier_v0_00_cannabinees_plante.sql
perl xls2sql.pl file="114-Cannabinées-Texte.xls" skip=0 table="bonnier_v0_00_cannabinees_texte" > bonnier_v0_00_cannabinees_texte.sql
perl xls2sql.pl file="115-Juglandées-Plante.xls" skip=0 table="bonnier_v0_00_juglandees_plante" > bonnier_v0_00_juglandees_plante.sql
perl xls2sql.pl file="115-Juglandées-Texte.xls" skip=0 table="bonnier_v0_00_juglandees_texte" > bonnier_v0_00_juglandees_texte.sql
perl xls2sql.pl file="116-Cupulifères-Plante.xls" skip=0 table="bonnier_v0_00_cupuliferes_plante" > bonnier_v0_00_cupuliferes_plante.sql
perl xls2sql.pl file="116-Cupulifères-Texte.xls" skip=0 table="bonnier_v0_00_cupuliferes_texte" > bonnier_v0_00_cupuliferes_texte.sql
perl xls2sql.pl file="117-Salicinées-Plante.xls" skip=0 table="bonnier_v0_00_salicinees_plante" > bonnier_v0_00_salicinees_plante.sql
perl xls2sql.pl file="117-Salicinées-Texte.xls" skip=0 table="bonnier_v0_00_salicinees_texte" > bonnier_v0_00_salicinees_texte.sql
perl xls2sql.pl file="118-Platanées-Plante.xls" skip=0 table="bonnier_v0_00_platanees_plante" > bonnier_v0_00_platanees_plante.sql
perl xls2sql.pl file="118-Platanées-Texte.xls" skip=0 table="bonnier_v0_00_platanees_texte" > bonnier_v0_00_platanees_texte.sql
perl xls2sql.pl file="119-Bétulinèes-Plante.xls" skip=0 table="bonnier_v0_00_betulinees_plante" > bonnier_v0_00_betulinees_plante.sql
perl xls2sql.pl file="119-Bétulinèes-Texte.xls" skip=0 table="bonnier_v0_00_betulinees_texte" > bonnier_v0_00_betulinees_texte.sql
perl xls2sql.pl file="120-Myricèes-Plante.xls" skip=0 table="bonnier_v0_00_myricees_plante" > bonnier_v0_00_myricees_plante.sql
perl xls2sql.pl file="120-Myricèes-Texte.xls" skip=0 table="bonnier_v0_00_myricees_texte" > bonnier_v0_00_myricees_texte.sql
perl xls2sql.pl file="121-Alismacées-Plante.xls" skip=0 table="bonnier_v0_00_alismacees_plante" > bonnier_v0_00_alismacees_plante.sql
perl xls2sql.pl file="121-Alismacées-Texte.xls" skip=0 table="bonnier_v0_00_alismacees_texte" > bonnier_v0_00_alismacees_texte.sql
perl xls2sql.pl file="122-Butomées-Plante.xls" skip=0 table="bonnier_v0_00_butomees_plante" > bonnier_v0_00_butomees_plante.sql
perl xls2sql.pl file="122-Butomées-Texte.xls" skip=0 table="bonnier_v0_00_butomees_texte" > bonnier_v0_00_butomees_texte.sql
perl xls2sql.pl file="123-Colchicacées-Plante.xls" skip=0 table="bonnier_v0_00_colchicacees_plante" > bonnier_v0_00_colchicacees_plante.sql
perl xls2sql.pl file="123-Colchicacées-Texte.xls" skip=0 table="bonnier_v0_00_colchicacees_texte" > bonnier_v0_00_colchicacees_texte.sql
perl xls2sql.pl file="124-Liliacées-Plante.xls" skip=0 table="bonnier_v0_00_liliacees_plante" > bonnier_v0_00_liliacees_plante.sql
perl xls2sql.pl file="124-Liliacées-Texte.xls" skip=0 table="bonnier_v0_00_liliacees_texte" > bonnier_v0_00_liliacees_texte.sql
perl xls2sql.pl file="125-Dioscorées-Plante.xls" skip=0 table="bonnier_v0_00_dioscorees_plante" > bonnier_v0_00_dioscorees_plante.sql
perl xls2sql.pl file="125-Dioscorées-Texte.xls" skip=0 table="bonnier_v0_00_dioscorees_texte" > bonnier_v0_00_dioscorees_texte.sql
perl xls2sql.pl file="126-Iridées-Plante.xls" skip=0 table="bonnier_v0_00_iridees_plante" > bonnier_v0_00_iridees_plante.sql
perl xls2sql.pl file="126-Iridées-Texte.xls" skip=0 table="bonnier_v0_00_iridees_texte" > bonnier_v0_00_iridees_texte.sql
perl xls2sql.pl file="127-Amaryllidées-Plante.xls" skip=0 table="bonnier_v0_00_amaryllidees_plante" > bonnier_v0_00_amaryllidees_plante.sql
perl xls2sql.pl file="127-Amaryllidées-Texte.xls" skip=0 table="bonnier_v0_00_amaryllidees_texte" > bonnier_v0_00_amaryllidees_texte.sql
perl xls2sql.pl file="128-Orchidées-Plante.xls" skip=0 table="bonnier_v0_00_orchidees_plante" > bonnier_v0_00_orchidees_plante.sql
perl xls2sql.pl file="128-Orchidées-Texte.xls" skip=0 table="bonnier_v0_00_orchidees_texte" > bonnier_v0_00_orchidees_texte.sql
perl xls2sql.pl file="129-Hydrocharidées-Plante.xls" skip=0 table="bonnier_v0_00_hydrocharidees_plante" > bonnier_v0_00_hydrocharidees_plante.sql
perl xls2sql.pl file="129-Hydrocharidées-Texte.xls" skip=0 table="bonnier_v0_00_hydrocharidees_texte" > bonnier_v0_00_hydrocharidees_texte.sql
perl xls2sql.pl file="130-Joncaginées-Plante.xls" skip=0 table="bonnier_v0_00_joncaginees_plante" > bonnier_v0_00_joncaginees_plante.sql
perl xls2sql.pl file="130-Joncaginées-Texte.xls" skip=0 table="bonnier_v0_00_joncaginees_texte" > bonnier_v0_00_joncaginees_texte.sql
perl xls2sql.pl file="131-Potamées-Plante.xls" skip=0 table="bonnier_v0_00_potamees_plante" > bonnier_v0_00_potamees_plante.sql
perl xls2sql.pl file="131-Potamées-Texte.xls" skip=0 table="bonnier_v0_00_potamees_texte" > bonnier_v0_00_potamees_texte.sql
perl xls2sql.pl file="132-Naiadees-Plante.xls" skip=0 table="bonnier_v0_00_naiadees_plante" > bonnier_v0_00_naiadees_plante.sql
perl xls2sql.pl file="132-Naiadees-Texte.xls" skip=0 table="bonnier_v0_00_naiadees_texte" > bonnier_v0_00_naiadees_texte.sql
perl xls2sql.pl file="133-Zosteracées-Plante.xls" skip=0 table="bonnier_v0_00_zosteracees_plante" > bonnier_v0_00_zosteracees_plante.sql
perl xls2sql.pl file="133-Zosteracées-Texte.xls" skip=0 table="bonnier_v0_00_zosteracees_texte" > bonnier_v0_00_zosteracees_texte.sql
perl xls2sql.pl file="134-Lemnacées-Plante.xls" skip=0 table="bonnier_v0_00_lemnacees_plante" > bonnier_v0_00_lemnacees_plante.sql
perl xls2sql.pl file="134-Lemnacées-Texte.xls" skip=0 table="bonnier_v0_00_lemnacees_texte" > bonnier_v0_00_lemnacees_texte.sql
perl xls2sql.pl file="135-Aroidées-Plante.xls" skip=0 table="bonnier_v0_00_aroidees_plante" > bonnier_v0_00_aroidees_plante.sql
perl xls2sql.pl file="135-Aroidées-Texte.xls" skip=0 table="bonnier_v0_00_aroidees_texte" > bonnier_v0_00_aroidees_texte.sql
perl xls2sql.pl file="136-Typhacées-Plante.xls" skip=0 table="bonnier_v0_00_typhacees_plante" > bonnier_v0_00_typhacees_plante.sql
perl xls2sql.pl file="136-Typhacées-Texte.xls" skip=0 table="bonnier_v0_00_typhacees_texte" > bonnier_v0_00_typhacees_texte.sql
perl xls2sql.pl file="137-Joncées-Plante.xls" skip=0 table="bonnier_v0_00_joncees_plante" > bonnier_v0_00_joncees_plante.sql
perl xls2sql.pl file="137-Joncées-Texte.xls" skip=0 table="bonnier_v0_00_joncees_texte" > bonnier_v0_00_joncees_texte.sql
perl xls2sql.pl file="138-Cyperacées-Plante.xls" skip=0 table="bonnier_v0_00_cyperacees_plante" > bonnier_v0_00_cyperacees_plante.sql
perl xls2sql.pl file="138-Cyperacées-Texte.xls" skip=0 table="bonnier_v0_00_cyperacees_texte" > bonnier_v0_00_cyperacees_texte.sql
perl xls2sql.pl file="139-Graminées-Plante.xls" skip=0 table="bonnier_v0_00_graminees_plante" > bonnier_v0_00_graminees_plante.sql
perl xls2sql.pl file="139-Graminées-Texte.xls" skip=0 table="bonnier_v0_00_graminees_texte" > bonnier_v0_00_graminees_texte.sql
perl xls2sql.pl file="140-Abietinées-Plante.xls" skip=0 table="bonnier_v0_00_abietinees_plante" > bonnier_v0_00_abietinees_plante.sql
perl xls2sql.pl file="140-Abietinées-Texte.xls" skip=0 table="bonnier_v0_00_abietinees_texte" > bonnier_v0_00_abietinees_texte.sql
perl xls2sql.pl file="141-Cupressinées-Plante.xls" skip=0 table="bonnier_v0_00_cupressinees_plante" > bonnier_v0_00_cupressinees_plante.sql
perl xls2sql.pl file="141-Cupressinées-Texte.xls" skip=0 table="bonnier_v0_00_cupressinees_texte" > bonnier_v0_00_cupressinees_texte.sql
perl xls2sql.pl file="142-Taxinées-Plante.xls" skip=0 table="bonnier_v0_00_taxinees_plante" > bonnier_v0_00_taxinees_plante.sql
perl xls2sql.pl file="142-Taxinées-Texte.xls" skip=0 table="bonnier_v0_00_taxinees_texte" > bonnier_v0_00_taxinees_texte.sql
perl xls2sql.pl file="143-Gnetacées-Plante.xls" skip=0 table="bonnier_v0_00_gnetacees_plante" > bonnier_v0_00_gnetacees_plante.sql
perl xls2sql.pl file="143-Gnetacées-Texte.xls" skip=0 table="bonnier_v0_00_gnetacees_texte" > bonnier_v0_00_gnetacees_texte.sql
perl xls2sql.pl file="144-Fougères-Plante.xls" skip=0 table="bonnier_v0_00_fougeres_plante" > bonnier_v0_00_fougeres_plante.sql
perl xls2sql.pl file="144-Fougères-Texte.xls" skip=0 table="bonnier_v0_00_fougeres_texte" > bonnier_v0_00_fougeres_texte.sql
perl xls2sql.pl file="145-Ophioglossées-Plante.xls" skip=0 table="bonnier_v0_00_ophioglossees_plante" > bonnier_v0_00_ophioglossees_plante.sql
perl xls2sql.pl file="145-Ophioglossées-Texte.xls" skip=0 table="bonnier_v0_00_ophioglossees_texte" > bonnier_v0_00_ophioglossees_texte.sql
perl xls2sql.pl file="146-Marsiliacées-Plante.xls" skip=0 table="bonnier_v0_00_marsiliacees_plante" > bonnier_v0_00_marsiliacees_plante.sql
perl xls2sql.pl file="146-Marsiliacées-Texte.xls" skip=0 table="bonnier_v0_00_marsiliacees_texte" > bonnier_v0_00_marsiliacees_texte.sql
perl xls2sql.pl file="147-Equisétacées-Plante.xls" skip=0 table="bonnier_v0_00_equisetacees_plante" > bonnier_v0_00_equisetacees_plante.sql
perl xls2sql.pl file="147-Equisétacées-Texte.xls" skip=0 table="bonnier_v0_00_equisetacees_texte" > bonnier_v0_00_equisetacees_texte.sql
perl xls2sql.pl file="148-Isoétées-Plante.xls" skip=0 table="bonnier_v0_00_isoetees_plante" > bonnier_v0_00_isoetees_plante.sql
perl xls2sql.pl file="148-Isoétées-Texte.xls" skip=0 table="bonnier_v0_00_isoetees_texte" > bonnier_v0_00_isoetees_texte.sql
perl xls2sql.pl file="149-Lycopodiacées-Plante.xls" skip=0 table="bonnier_v0_00_lycopodiacees_plante" > bonnier_v0_00_lycopodiacees_plante.sql
perl xls2sql.pl file="149-Lycopodiacées-Texte.xls" skip=0 table="bonnier_v0_00_lycopodiacees_texte" > bonnier_v0_00_lycopodiacees_texte.sql
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:eol-style
+native
\ No newline at end of property
/tags/v5.7-arrayanal/scripts/modules/baseflor/BaseflorIndex.php
New file
0,0 → 1,83
<?php
/**
*
* @author Mathilde SALTHUN-LASSALLE <mathilde@tela-botanica.org>
*
*
*/
class BaseflorIndex {
private $conteneur;
private $efloreCommun;
private $message;
private $dossierBase;
private $valeurs_insertion = array();
private $Bdd;
public function __construct(Conteneur $conteneur, Bdd $Bdd) {
$this->conteneur = $conteneur;
$this->Bdd = $Bdd;
$this->efloreCommun = $conteneur->getEfloreCommun();
$this->message = $conteneur->getMessages();
$this->dossierBase = dirname(__FILE__).'/';
}
public function insererDonnees(){
$this->efloreCommun->chargerFichierSql('chemins.index_sql');
$this->recupererDonneesBaseflor();
$this->recupererDonneesRangSup();
$this->insererDonneesIndex();
}
private function recupererDonneesBaseflor() {
$table = Config::get('tables.donnees');
$requete = "SELECT cle, num_nomen, BDNT FROM $table WHERE num_nomen != 0 ".
" AND num_nomen != 0 ".
" AND !(ve_lumiere = '' and ve_mat_org_sol = '' and ve_temperature = '' and ve_continentalite = '' ".
" and ve_humidite_atmos = '' and ve_humidite_edaph = '' and ve_nutriments_sol = '' and ve_salinite = ''".
" and ve_texture_sol = '' and ve_reaction_sol = '')";
$resultat = $this->Bdd->recupererTous($requete);
$this->valeurs_insertion['baseflor'] = $resultat;
$this->valeurs_insertion['rangSup'] = $resultat;
}
private function recupererDonneesRangSup() {
$table = Config::get('tables.rang_sup');
$requete = "SELECT cle, num_nomen, bdnt FROM $table ;";
$resultat = $this->Bdd->recupererTous($requete);
$this->valeurs_insertion['rangSup']= $resultat;
 
}
 
private function insererDonneesIndex() {
$table = Config::get('tables.index');
$requete_truncate = 'TRUNCATE TABLE '.$table;
$this->Bdd->requeter($requete_truncate);
$i = 0;
foreach ($this->valeurs_insertion as $tab => $res){
if ($tab == 'baseflor') {
foreach ($res as $valeurs ) {
if ($valeurs['num_nomen'] != 0) {
$requete = "INSERT INTO $table VALUES({$i},{$valeurs['cle']},null,'".strtolower($valeurs['BDNT']).".nn:{$valeurs['num_nomen']}')";
$this->Bdd->requeter($requete);
$i++;
$this->message->afficherAvancement('Insertion des valeurs issues de baseflor en cours');
}
}
} else {
foreach ($res as $valeurs ) {
if ($valeurs['num_nomen'] != 0) {
$requete = "INSERT INTO $table VALUES({$i},null,{$valeurs['cle']},'{$valeurs['bdnt']}.nn:{$valeurs['num_nomen']}')";
$this->Bdd->requeter($requete);
$i++;
$this->message->afficherAvancement('Insertion des valeurs issues des rangs supérieurs en cours');
}
}
}
}
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/baseflor/baseflor.ini
New file
0,0 → 1,52
version="2014_01_06"
dossierTsv = "{ref:dossierDonneesEflore}baseflor/2014-01-06/"
dossierSql = "{ref:dossierTsv}"
dossierRangSup = "{ref:dossierDonneesEflore}baseflor/2014-01-06/rang_sup/"
dossierIndex = "{ref:dossierDonneesEflore}baseflor/2014-01-06/index/"
 
[tables]
donnees = "baseflor_v{ref:version}"
ontologies = "baseflor_ontologies"
metadonnees = "baseflor_meta"
rang_sup = "baseflor_rang_sup_ecologie_v{ref:version}"
taxons = "bdtfx_v2_00";
index = "baseflor_index_v{ref:version}";
 
 
 
[fichiers]
structureSql = "baseflor.sql"
metadonnees = "insertion_baseflor_meta.sql"
donnees = "baseflor_v{ref:version}.tsv"
donnees_verif = "baseflor_verif.txt"
ontologies = "baseflor_ontologies.tsv"
rang_sup_sql = "baseflor_rang_sup_ecologie.sql"
index_sql = "baseflor_index.sql"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
donnees = "{ref:dossierTsv}{ref:fichiers.donnees}"
donnees_verif = "{ref:dossierTsv}{ref:fichiers.donnees_verif}"
ontologies ="{ref:dossierTsv}{ref:fichiers.ontologies}"
metadonnees = "{ref:dossierSql}{ref:fichiers.metadonnees}"
rang_sup_sql = "{ref:dossierRangSup}{ref:fichiers.rang_sup_sql}"
index_sql = "{ref:dossierIndex}{ref:fichiers.index_sql}"
 
[services]
url_base="http://localhost/"
url_service_base="{ref:url_base}service:eflore:0.1/"
 
[Parametres]
typesBio = "A,a,B,b,C,c,Cfru,cfru,Csuf,csuf,Ccou,ccou,H,h,Heri,heri,Hsto,hsto,Hces,hces,Hros,hros,Hrub,hrub,Hbis,hbis,G,g,Gbul,gbul,Gtub,gtub,Grhi,grhi,T,t,Tver,tver,Test,test"
sousTypesBio = "aqua,lia,épi,hpar,par,suc,semp,cad,car"
signesSeuls = "?, x, x~, x=, xb, xB, -"
signesNonSeuls = "~, =, b, B"
intervalles = "1-9 = 23;24;25;26;28;29;31;32;33;34;35;37;38,
1-12 = 27;36,
0-9 = 30;39"
motifs = "/(^[0-9]*\/)|(inconnu)/ = 1,
/(^[AB]?[0-9]+$)|(^nc$)/ = 2;3,
/[^0-9]+/ = 4;5;6;7;8;9;10;11;12;13;16;19;20;21;22;40;41;42;43;44;45;46;47;48;49;50;51;52;53;54;55,
/^([1-9]|1[0-2])(\-([1-9]|1[0-2]))*$/ = 14"
champsEcologiques = "ve_lumiere,ve_temperature,ve_continentalite,ve_humidite_atmos,ve_humidite_edaph,ve_reaction_sol,ve_nutriments_sol,ve_salinite,ve_texture_sol,ve_mat_org_sol"
 
/tags/v5.7-arrayanal/scripts/modules/baseflor/BaseflorRangSupInsertion.php
New file
0,0 → 1,272
<?php
/**
*
*
* @author Mathilde SALTHUN-LASSALLE <mathilde@tela-botanica.org>
*
*
*/
class BaseflorRangSupInsertion {
private $table = null;
private $donnees_initiales = array();
private $valeurs_insertion;
private $infos_taxon = array();
private $conteneur;
private $efloreCommun;
private $message;
private $outils;
private $nn_courant;
private $nn_superieur;
private $champs_ecologiques = array();
private $Bdd;
public function __construct(Conteneur $conteneur, Bdd $bdd) {
$this->conteneur = $conteneur;
$this->Bdd = $bdd;
$this->efloreCommun = $conteneur->getEfloreCommun();
$this->message = $conteneur->getMessages();
$this->outils = $conteneur->getOutils();
$this->dossierBase = dirname(__FILE__).'/';
}
public function insererDonnees(){
echo "Chargement de la structure en cours \n" ;
$this->efloreCommun->chargerFichierSql('chemins.rang_sup_sql');
echo "Récupération des données de baseflor en cours \n";
$this->recupererDonneesInitiales();
echo "Calcul des valeurs pour les rangs supérieurs en cours \n";
$this->consulterInfosTaxons();
$this->recupererValeursInsertion();
$this->insererDonneesRangSup();
}
private function insererDonneesRangSup() {
$table = Config::get('tables.rang_sup');
$requete_truncate = 'TRUNCATE TABLE '.$table;
$this->Bdd->requeter($requete_truncate);
$i = 0;
foreach ($this->valeurs_insertion as $nn => $valeurs){
$requete = "INSERT INTO $table VALUES({$i},$nn, 'bdtfx', '{$valeurs['ve_lumiere']['min']}', ".
"'{$valeurs['ve_lumiere']['max']}','{$valeurs['ve_temperature']['min']}',".
"'{$valeurs['ve_temperature']['max']}','{$valeurs['ve_continentalite']['min']}',".
"'{$valeurs['ve_continentalite']['max']}','{$valeurs['ve_humidite_atmos']['min']}',".
"'{$valeurs['ve_humidite_atmos']['max']}','{$valeurs['ve_humidite_edaph']['min']}',".
"'{$valeurs['ve_humidite_edaph']['max']}','{$valeurs['ve_reaction_sol']['min']}',".
"'{$valeurs['ve_reaction_sol']['max']}','{$valeurs['ve_nutriments_sol']['min']}',".
"'{$valeurs['ve_nutriments_sol']['max']}','{$valeurs['ve_salinite']['min']}',".
"'{$valeurs['ve_salinite']['max']}','{$valeurs['ve_texture_sol']['min']}',".
"'{$valeurs['ve_texture_sol']['max']}','{$valeurs['ve_mat_org_sol']['min']}',".
"'{$valeurs['ve_mat_org_sol']['max']}');";
$this->Bdd->requeter($requete);
$i++;
$this->message->afficherAvancement('Insertion des valeurs pour les rangs supérieurs en cours');
}
}
 
 
// dans cette solution je parcours les donnees de baseflor
// je teste une donnée (si min max) pour récuperer les valeurs pour chaque rang superieur
// jusqu'à famille (180) puis je passe à la suivante jusqu'à avoir parcouru tout baseflor
private function recupererValeursInsertion(){
$this->champs_ecologiques = $this->outils->recupererTableauConfig(Config::get('Parametres.champsEcologiques'));
$this->valeurs_insertion = array();
if (empty($this->donnees_initiales)) {
throw new Exception("Erreur : pas de données à traiter.");
} else {
foreach ($this->donnees_initiales as $nn => $ecologie) {
$this->nn_courant = $nn;
$this->nn_superieur = isset($this->infos_taxon[$this->nn_courant]) ? $this->infos_taxon[$this->nn_courant]['nn_sup'] : null;
$rang = isset($this->infos_taxon[$this->nn_superieur]) ? $this->infos_taxon[$this->nn_superieur]['rang'] : 179 ;
while ($rang >= 180){
if (!isset($donnees_initiales[$this->nn_superieur])) {
foreach ($this->champs_ecologiques as $nom) {
$this->testerSiMinMax($nom, $ecologie[$nom]);
}
}
$this->nn_superieur = isset($this->infos_taxon[$this->nn_superieur]) ? $this->infos_taxon[$this->nn_superieur]['nn_sup'] : null;
$rang = !empty($this->nn_superieur) ? $this->infos_taxon[$this->nn_superieur]['rang'] : 179 ;
}
}
}
}
// ici je parcours toutes les données de baseflor et je teste et récupère les valeurs pour le rang superieur
//direct puis je récupère les données obtenues et je recommence jusqu'à que tous les rangs obtenus soient des familles
private function recupererValeursInsertion2(){
$this->champs_ecologiques = $this->outils->recupererTableauConfig(Config::get('Parametres.champsEcologiques'));
$this->valeurs_insertion = array();
if (empty($this->donnees_initiales)) {
throw new Exception("Erreur : pas de données à traiter.");
} else {
$donnees_traitees = $this->donnees_initiales;
$donnees_deja_traitees = array();
$condition_fin = true;
$tab_num_nom = array_keys($donnees_traitees);
while (!empty($donnees_traitees)) {
reset($donnees_traitees);
$this->nn_courant = array_shift($tab_num_nom);
$data = array_shift($donnees_traitees);
if (isset($this->infos_taxon[$this->nn_courant])) {
$this->nn_superieur = $this->infos_taxon[$this->nn_courant]['nn_sup'];
if (!isset($donnees_deja_traitees[$this->nn_courant])) {
if ($this->infos_taxon[$this->nn_superieur]['rang'] >= 180){
$condition_fin = false;
foreach ($this->champs_ecologiques as $nom) {
$this->testerSiMinMax($nom, $data[$nom]);
}
}
}
$donnees_deja_traitees[$this->nn_courant] = 1;
}
if ($condition_fin == false && empty($donnees_traitees)) {
$donnees_traitees = $this->valeurs_insertion;
$tab_num_nom = array_keys($donnees_traitees);
$condition_fin = true;
}
}
}
}
// je stocke des valeurs à insérer sous la forme : $insertion [{nn_tax_sup}][{nom_de_chps}][{max ou min}] = {valeur}
private function testerSiMinMax($nom, $valeur) {
$nn = $this->nn_superieur;
if ( !isset($this->valeurs_insertion[$nn][$nom]['min'])
|| empty($valeur['min'])
|| empty($this->valeurs_insertion[$nn][$nom]['min'])
|| $this->valeurs_insertion[$nn][$nom]['min'] > $valeur['min'] ){
$this->valeurs_insertion[$nn][$nom]['min'] = $valeur['min'];
}
if ( !isset($this->valeurs_insertion[$nn][$nom]['max'])
|| empty($this->valeurs_insertion[$nn][$nom]['max'])
|| empty($valeur['max'])
|| $this->valeurs_insertion[$nn][$nom]['max'] < $valeur['max'] ) {
$this->valeurs_insertion[$nn][$nom]['max'] = $valeur['max'];
}
}
// je stocke les infos taxons sous la forme : $info_taxon[{num_nomem}][{num_nomen_sup ou rang}] = {valeur}
private function consulterInfosTaxons() {
$table = Config::get('tables.taxons');
$requete = 'SELECT A.num_nom AS nn, B.num_tax_sup AS nn_sup, A.rang '.
"FROM $table A JOIN $table B ON (A.num_nom_retenu = B.num_nom) ".
'WHERE B.num_nom = B.num_nom_retenu ';
$resultat = $this->Bdd->recupererTous($requete);
foreach ($resultat as $res) {
$this->infos_taxon[$res['nn']] = array('nn_sup' => $res['nn_sup'], 'rang' => $res['rang'] );
}
}
// je stocke les valeurs initiales sous la forme : $initiales[{nn_nomem}][{champs ecologique}][{'min' ou 'max'}]
private function recupererDonneesInitiales() {
$table = Config::get('tables.donnees');
$requete = "SELECT num_nomen, ve_lumiere, ve_temperature, ve_continentalite, ve_humidite_atmos, ".
"ve_humidite_edaph, ve_reaction_sol, ve_nutriments_sol, ve_salinite, ve_texture_sol, ve_mat_org_sol ".
"FROM $table WHERE BDNT = 'BDTFX' ".
" AND num_nomen != 0 ".
" AND !(ve_lumiere = '' and ve_mat_org_sol = '' and ve_temperature = '' and ve_continentalite = '' ".
" and ve_humidite_atmos = '' and ve_humidite_edaph = '' and ve_nutriments_sol = '' and ve_salinite = ''".
" and ve_texture_sol = '' and ve_reaction_sol = '')";
$resultat = $this->Bdd->recupererTous($requete);
foreach ($resultat as $res) {
$this->donnees_initiales[$res['num_nomen']] = array(
've_lumiere' => array('min' => $res['ve_lumiere'], 'max' => $res['ve_lumiere']),
've_temperature' => array('min' => $res['ve_temperature'], 'max' => $res['ve_temperature']),
've_continentalite' => array('min' => $res['ve_continentalite'], 'max' => $res['ve_continentalite']),
've_humidite_atmos' => array('min' => $res['ve_humidite_atmos'], 'max' => $res['ve_humidite_atmos']),
've_humidite_edaph' => array('min' => $res['ve_humidite_edaph'], 'max' => $res['ve_humidite_edaph']),
've_reaction_sol' => array('min' => $res['ve_reaction_sol'], 'max' => $res['ve_reaction_sol']),
've_nutriments_sol' => array('min' => $res['ve_nutriments_sol'], 'max' => $res['ve_nutriments_sol']),
've_salinite' => array('min' => $res['ve_salinite'], 'max' => $res['ve_salinite']),
've_texture_sol' => array('min' => $res['ve_texture_sol'], 'max' => $res['ve_texture_sol']),
've_mat_org_sol' => array('min' => $res['ve_mat_org_sol'], 'max' => $res['ve_mat_org_sol']));
}
}
// +++ Fonctions de vérification des donnée obtenues ++++//
public function testAscendantsDeBaseflor(){
$this->recupererDonneesInitiales();
$this->consulterInfosTaxons();
$fichier = dirname(__FILE__).'/log/verifTaxonsSup.log';
$liste = array();
foreach ($this->donnees_initiales as $nn => $data) {
$nn_sup = isset($this->infos_taxon[$nn]) ? $this->infos_taxon[$nn]['nn_sup'] : '' ;
if (!empty($nn_sup) && !isset($donnees_initiales[$nn_sup])){
$rang = isset($this->infos_taxon[$nn_sup]) ? $this->infos_taxon[$nn_sup]['rang'] : 179 ;
while ($rang >= 180) {
if (!empty($nn_sup)) {
if (isset($liste["$nn_sup($rang)"])){
$liste["$nn_sup($rang)"] .= ", $nn";
}else {
$liste["$nn_sup($rang)"] = "$nn";
}
$nn_sup = isset($this->infos_taxon[$nn_sup]) ? $this->infos_taxon[$nn_sup]['nn_sup'] : '' ;
$rang = isset($this->infos_taxon[$nn_sup]) ? $this->infos_taxon[$nn_sup]['rang'] : 179 ;
}else {
break;
}
}
}
}
$log = "un ascendant (pas forcement l'ascendant directement au dessus) : les descendants contenus dans baseflor \n";
foreach ($liste as $cle => $inferieur){
$log .= "$cle : $inferieur \n";
}
file_put_contents($fichier, $log);
}
public function testEcologieAscendantsDeBaseflor(){
$this->recupererDonneesInitiales();
$this->consulterInfosTaxons();
$fichier = dirname(__FILE__).'/log/verifTaxonsSupEcolo.log';
$liste = array();
foreach ($this->donnees_initiales as $nn => $data) {
$nn_sup = isset($this->infos_taxon[$nn]) ? $this->infos_taxon[$nn]['nn_sup'] : '' ;
if (!empty($nn_sup) && !isset($donnees_initiales[$nn_sup])){
$rang = isset($this->infos_taxon[$nn_sup]) ? $this->infos_taxon[$nn_sup]['rang'] : 179 ;
while ($rang >= 180) {
if (!empty($nn_sup)) {
$ecolo = array_values($data);
list($l,$t,$c,$ha,$he,$r,$n,$s,$tx,$mo) = $ecolo;
if (isset($liste["$nn_sup($rang)"])){
$liste["$nn_sup($rang)"] .= ",[{$l['min']}, {$t['min']}, {$c['min']},"
."{$ha['min']}, {$he['min']}, {$r['min']}, {$n['min']}, {$s['min']},"
."{$tx['min']}, {$mo['min']}]";
}else {
$liste["$nn_sup($rang)"] = "[{$l['min']}, {$t['min']}, {$c['min']},"
."{$ha['min']}, {$he['min']}, {$r['min']}, {$n['min']}, {$s['min']},"
."{$tx['min']}, {$mo['min']}]";
}
$nn_sup = isset($this->infos_taxon[$nn_sup]) ? $this->infos_taxon[$nn_sup]['nn_sup'] : '' ;
$rang = isset($this->infos_taxon[$nn_sup]) ? $this->infos_taxon[$nn_sup]['rang'] : 179 ;
}else {
break;
}
}
}
}
$log = "nn ascendant (pas forcement l'ascendant directement au dessus) :"
." valeurs descendants contenus dans baseflor \n"
."Pour le calcul des valeurs min et max de gauche, les valeurs de droite sont utilisées. \n";
foreach ($liste as $cle => $inferieurs){
$log .= "$cle : $inferieurs \n";
}
file_put_contents($fichier, $log);
}
 
}
/tags/v5.7-arrayanal/scripts/modules/baseflor/BaseflorVerif.php
New file
0,0 → 1,149
<?php
 
class BaseflorVerif extends VerificateurDonnees {
 
private $type_bio = array();
private $ss_type_bio = array();
private $signes_seuls = array();// basés sur valeurs trouvées (--> pas de légende !)
private $signes_nn_seuls = array();// basés sur valeurs trouvées (--> pas de légende !)
private $intervalles = array();
private $motifs = array();
 
//obligatoire
public function definirTraitementsColonnes() {
$this->initialiserParametresVerif() ;
if (( $this->colonne_num > 0 && $this->colonne_num < 15 )
|| $this->colonne_num == 16
|| ($this->colonne_num > 18 && $this->colonne_num < 23)
|| $this->colonne_num > 39) {
$this->verifierColonne();
} elseif ($this->colonne_num == 15) {
$this->verifierTypeBio();
} elseif ($this->colonne_num >= 23 && $this->colonne_num <= 32) {
$this->verifierIntervalles($this->colonne_valeur);
} elseif ($this->colonne_num >= 33 && $this->colonne_num < 41) {
$this->verifierValeursIndic();
}
}
private function initialiserParametresVerif() {
$this->type_bio = $this->getParametreTableau('Parametres.typesBio');
$this->ss_type_bio = $this->getParametreTableau('Parametres.sousTypesBio');
$this->signes_seuls = $this->getParametreTableau('Parametres.signesSeuls');
$this->signes_nn_seuls = $this->getParametreTableau('Parametres.signesNonSeuls');
$this->intervalles = $this->inverserTableau($this->getParametreTableau('Parametres.intervalles'));
$this->motifs = $this->inverserTableau($this->getParametreTableau('Parametres.motifs'));
}
//++---------------------------------traitements des colonnes baseflor------------------------------------++
private function verifierColonne(){
$motif = $this->motifs[$this->colonne_num];
if (preg_match($motif, $this->colonne_valeur) == 0 && $this->verifierSiVide() == false){
$this->erreurs_ligne[$this->colonne_num] = $this->colonne_valeur;
}
}
 
private function verifierSiVide(){
$vide = ($this->colonne_valeur == '') ? true : false;
return $vide;
}
 
private function verifierTypeBio(){
if (preg_match("/(.+)\((.+)\)$/", $this->colonne_valeur, $retour) == 1) {
$this->verifierTypeEtSsType($retour[1]);
$this->verifierTypeEtSsType($retour[2]);
} else {
$this->verifierTypeEtSsType($this->colonne_valeur);
}
}
 
private function verifierTypeEtSsType($chaine_a_verif){
if (preg_match("/^([a-zA-Zé]+)\-(.+)$|^([a-zA-Zé]+[^\-])$/", $chaine_a_verif, $retour) == 1) {
$type = (isset($retour[3])) ? $retour[3] : $retour[1];
$this->verifierType($type);
 
$sousType = $retour[2];
$this->verifierSousType($sousType);
}
}
 
private function verifierType($type) {
if (in_array($type, $this->type_bio) == false) {
$this->erreurs_ligne[$this->colonne_num] = $this->colonne_valeur;
}
}
 
private function verifierSousType($sousType) {
if ($sousType != ''){
$ss_type = explode('-', $sousType);
foreach ($ss_type as $sst) {
if (in_array($sst, $this->ss_type_bio) == false) {
$this->erreurs_ligne[$this->colonne_num] = $this->colonne_valeur;
}
}
}
}
 
private function verifierIntervalles($valeur){
if ($valeur != '') {
list($min, $max) = explode('-', $this->intervalles[$this->colonne_num]);
if ($valeur < $min || $valeur > $max){
$this->erreurs_ligne[$this->colonne_num] = $this->colonne_valeur;
}
}
}
 
private function verifierValeursIndic(){
if (preg_match("/^([^0-9])*([0-9]+)([^0-9])*$/", $this->colonne_valeur, $retour) == 1){
$this->verifierIntervalles($retour[2]);
if (isset($retour[3]) && in_array($retour[3], $this->signes_nn_seuls) == false){
$this->erreurs_ligne[$this->colonne_num] = $this->colonne_valeur;
}
if ($retour[1] != '-' && $retour[1] != ''){
$this->erreurs_ligne[$this->colonne_num] = $this->colonne_valeur;
}
} elseif (in_array( $this->colonne_valeur, $this->signes_seuls) == false && $this->verifierSiVide() == false) {
$this->erreurs_ligne[$this->colonne_num] = $this->colonne_valeur;
}
}
/*--------------------------------------------OUtils-------------------------------------------*/
private function getParametreTableau($cle) {
$tableau = array();
$parametre = Config::get($cle);
if (empty($parametre) === false) {
$tableauPartiel = explode(',', $parametre);
$tableauPartiel = array_map('trim', $tableauPartiel);
foreach ($tableauPartiel as $champ) {
if (strpos($champ, '=') !== false && strlen($champ) >= 3) {
list($cle, $val) = explode('=', $champ);
$tableau[trim($cle)] = trim($val);
} else {
$tableau[] = trim($champ);
}
}
}
return $tableau;
}
 
private function inverserTableau($tableau) {
$inverse = array();
foreach ($tableau as $cle => $valeurs) {
$valeurs = explode(';', $valeurs);
foreach ($valeurs as $valeur) {
$inverse[$valeur] = $cle;
}
}
return $inverse;
}
}
 
?>
/tags/v5.7-arrayanal/scripts/modules/baseflor/log
New file
Property changes:
Added: svn:ignore
+test
/tags/v5.7-arrayanal/scripts/modules/baseflor/Baseflor.php
New file
0,0 → 1,313
<?php
/** Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M ~/web/eflore-projets/scripts/cli.php baseflor -a chargerTous
*/
class Baseflor extends EfloreScript {
 
private $table = null;
 
 
public function executer() {
try {
$this->initialiserProjet('baseflor');
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'chargerMetadonnees':
$this->chargerMetadonnees();
break;
case 'chargerOntologies' :
$this->chargerOntologies();
break;
case 'verifierFichier' :
$this->verifierFichier();
break;
case 'chargerDonnees' :
$this->chargerDonnees();
break;
case 'genererChamps' :
$this->genererChamps();
break;
case 'chargerTous':
$this->chargerStructureSql();
$this->chargerMetadonnees();
$this->chargerOntologies();
$this->chargerDonnees();
$this->genererChamps();
$this->insererDonneesBaseflorRangSupEcolo();
$this->insererDonneesIndex();
break;
case 'insererDonneesRangSup' :
$this->insererDonneesBaseflorRangSupEcolo();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
case 'voirRangSup' :
$this->voirRangSup();
break;
case 'voirRangSupEcologie' :
$this->voirRangSupEcologie();
break;
case 'insererDonneesIndex' :
$this->insererDonneesIndex();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
 
//-- traitement de la table baseflorRangSupInsertion --//
 
private function getClasseBaseflorRangSupInsertion() {
$conteneur = new Conteneur();
require_once dirname(__FILE__)."/BaseflorRangSupInsertion.php";
$rangSupInsert = new BaseflorRangSupInsertion($conteneur, $this->getBdd());
return $rangSupInsert;
}
 
private function insererDonneesBaseflorRangSupEcolo(){
$rangSupInsert = $this->getClasseBaseflorRangSupInsertion();
$rangSupInsert->insererDonnees();
}
 
private function voirRangSup(){
$rangSupInsert = $this->getClasseBaseflorRangSupInsertion();
$rangSupInsert->testAscendantsDeBaseflor();
}
 
private function voirRangSupEcologie(){
$rangSupInsert = $this->getClasseBaseflorRangSupInsertion();
$rangSupInsert->testEcologieAscendantsDeBaseflor();
}
 
 
//-- traitement de la table baseflorIndex --//
 
private function getClasseBaseflorIndex() {
$conteneur = new Conteneur();
require_once dirname(__FILE__)."/BaseflorIndex.php";
$Index = new BaseflorIndex($conteneur, $this->getBdd());
return $Index;
}
 
private function insererDonneesIndex(){
$Index= $this->getClasseBaseflorIndex();
$Index->insererDonnees();
}
 
 
//-- traitement de la table generer champs --//
 
private function genererChamps(){
$this->initialiserGenerationChamps();
$this->ajouterChamps();
$this->analyserChampsExistant();
}
 
private function initialiserGenerationChamps() {
$this->table = Config::get('tables.donnees');
}
 
private function ajouterChamps() {
$this->preparerTablePrChpsBDNT();
$this->preparerTablePrChpsNumTaxon();
$this->preparerTablePrChpsNumNomen();
}
 
private function preparerTablePrChpsBDNT() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'BDNT' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD BDNT VARCHAR( 6 ) '.
'CHARACTER SET utf8 COLLATE utf8_general_ci '.
'NOT NULL AFTER catminat_code ';
$this->getBdd()->requeter($requete);
}
}
 
private function preparerTablePrChpsNumTaxon() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'num_taxon' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD num_taxon INT( 10 ) NOT NULL '.
'AFTER catminat_code';
$this->getBdd()->requeter($requete);
}
}
 
private function preparerTablePrChpsNumNomen() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'num_nomen' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD num_nomen INT( 10 ) NOT NULL '.
'AFTER catminat_code';
$this->getBdd()->requeter($requete);
}
}
 
private function analyserChampsExistant() {
$resultats = $this->recupererTuplesNumsOriginels();
foreach ($resultats as $chps) {
$cle = $chps['cle'];
$nno = $chps['num_nomen_originel'];
$nto = $chps['num_taxon_originel'];
 
$valeurs = array();
$valeurs["BDNT"] = $this->genererChpsBDNT($nno, $nto);
$valeurs["num_taxon"] = $this->genererChpsNumTaxon($nto);
$valeurs["num_nomen"] = $this->genererChpsNumNomen($nno);
 
$this->remplirChamps($cle, $valeurs);
 
$this->afficherAvancement("Insertion des valeurs dans la base en cours");
}
echo "\n";
}
 
private function recupererTuplesNumsOriginels(){
$requete = "SELECT cle, num_taxon_originel, num_nomen_originel FROM {$this->table} ";
$resultat = $this->getBdd()->recupererTous($requete);
return $resultat;
}
 
private function genererChpsBDNT($nno, $nto) {
$bdnt = '';
if (preg_match("/^([AB])[0-9]+$/", $nno, $retour) || preg_match("/^([AB])[0-9]+$/", $nto, $retour)){
if ($retour[1]=='A') {
$bdnt = "BDAFX";
} else {
$bdnt = "BDBFX";
}
} elseif (($nno == 'nc') && ($nto == 'nc')) {
$bdnt = "nc";
} else {
$bdnt = "BDTFX";
}
return $bdnt;
}
 
private function genererChpsNumTaxon($nto){
$num_taxon = '';
if (preg_match("/^[AB]([0-9]+)$/", $nto, $retour)) {
$num_taxon = intval($retour[1]);
} elseif($nto == 'nc') {
$num_taxon = 0;
} else {
$num_taxon = intval($nto);
}
return $num_taxon;
}
 
private function genererChpsNumNomen($nno) {
$num_nomen = '';
if (preg_match("/^[AB]([0-9]+)$/", $nno, $retour)) {
$num_nomen = intval($retour[1]);
} elseif ($nno == 'nc') {
$num_nomen = 0;
} else {
$num_nomen = intval($nno);
}
return $num_nomen;
}
 
private function remplirChamps($cle, $valeurs) {
foreach ($valeurs as $nomChamp => $valeurChamp) {
$valeurChamp = $this->getBdd()->proteger($valeurChamp);
$requete = "UPDATE {$this->table} SET $nomChamp = $valeurChamp WHERE cle = $cle ";
$resultat = $this->getBdd()->requeter($requete);
if ($resultat === false) {
throw new Exception("Erreur d'insertion pour le tuple clé = $cle");
}
}
}
 
//+------------------------------------------------------------------------------------------------------+
// chargements, suppression, exécution
 
protected function chargerMetadonnees() {
$contenuSql = $this->recupererContenu(Config::get('chemins.metadonnees'));
$this->executerScriptSql($contenuSql);
}
 
private function chargerOntologies() {
$chemin = Config::get('chemins.ontologies');
$table = Config::get('tables.ontologies');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' "
;
$this->getBdd()->requeter($requete);
}
 
protected function chargerStructureSql() {
$contenuSql = $this->recupererContenu(Config::get('chemins.structureSql'));
$this->executerScriptSql($contenuSql);
}
 
protected function executerScriptSql($sql) {
$requetes = Outils::extraireRequetes($sql);
foreach ($requetes as $requete) {
$this->getBdd()->requeter($requete);
}
}
 
private function chargerDonnees() {
$nb_err = $this->verifierFichier();
if ($nb_err > 0) {
$e = "Je ne peux pas charger les données car le fichier comporte des erreurs.".
"Voir le fichier baseflor_verif.txt\n";
throw new Exception($e);
}
 
$table = Config::get('tables.donnees');
$requete = "LOAD DATA INFILE '".Config::get('chemins.donnees')."' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\'";
$this->getBdd()->requeter($requete);
}
 
private function supprimerTous() {
// TODO : rajouter une boucle utilisant un parametre de config stockant toutes les versions pour supprimer les tables
$requete = "DROP TABLE IF EXISTS baseflor_meta, baseflor_ontologies, ".
" baseflor_v2012_03_19, ".
" baseflor_v2012_05_08, baseflor_rang_sup_ecologie_v2012_05_08, baseflor_index_v2012_05_08, ".
" baseflor_v2012_12_31, baseflor_rang_sup_ecologie_v2012_12_31, baseflor_index_v2012_12_31, ".
" baseflor_v2013_07_04, baseflor_rang_sup_ecologie_v2013_07_04, baseflor_index_v2013_07_04";
$this->getBdd()->requeter($requete);
}
 
//++------------------------------------verifierFichier------------------------------------------++//
 
private function getClasseBaseflorVerif() {
$conteneur = new Conteneur();
require_once dirname(__FILE__)."/BaseflorVerif.php";
$verif = new BaseflorVerif($conteneur,'baseflor');
return $verif;
}
 
private function verifierFichier() {
$verif = $this->getClasseBaseflorVerif();
$nb_erreurs = $verif->verifierFichier(Config::get('chemins.donnees'));
return $nb_erreurs;
}
 
}
?>
/tags/v5.7-arrayanal/scripts/modules/osm/OrdonneurDeChemins.php
New file
0,0 → 1,162
<?php
/**
* Traitement de l'ordre :
*
* Fonction qui rajoute l'ordre et le sens de chaque way d'une relation dans la table `osm_relation_a_chemins`
*
* Exemple de lancement du script :
* /opt/lampp/bin/php -d memory_limit=8000M cli.php osm -a ordre -m manuel
*
*/
class OrdonneurDeChemins {
private $conteneur;
private $bdd;
private $messages;
private $mode;
 
private $infosRel = array();
private $infosNoeuds = array();
private $idRelation = null;
private $idChemin = null;
private $idNoeud = null;
private $ordre = 0;
 
public function __construct($conteneur) {
$this->conteneur = $conteneur;
$this->bdd = $this->conteneur->getBdd();
$this->messages = $this->conteneur->getMessages();
$this->mode = $this->conteneur->getParametre('m');
}
 
public function executer() {
$relations = $this->getToutesRelationsAChemins();
if ($this->mode == 'manuel') {
$this->messages->traiterInfo("Nombre de relations : %s", array(count($relations)));
}
foreach ($relations as $relation) {
// Traitement de la relation courante
$this->idRelation = $relation['id_relation'];
 
$this->chargerDonneesRelationActuelle();
 
// Selection du premier chemin comme chemin actuel
$this->idChemin = $this->getIdPremierChemin();
$this->mettreAJourChemin('directe', __LINE__);
 
// Selection du dernier noeud comme noeud actuel
$idDernierNoeud = $this->getIdDernierNoeud();
if ($idDernierNoeud) {
$this->idNoeud = $idDernierNoeud;
$this->ordonnerChemins();
}
 
// Affichage de l'avancement
if ($this->mode == 'manuel') {
$this->messages->afficherAvancement("Ordone les chemins de la relation : ", 1);
}
}
}
 
private function getToutesRelationsAChemins() {
$requete = 'SELECT DISTINCT id_relation '.
'FROM osm_relation_a_chemins '.
' -- '.__FILE__.' : '.__LINE__;
$relations = $this->bdd->recupererTous($requete);
return $relations;
}
 
private function chargerDonneesRelationActuelle() {
$requete = 'SELECT cn.id_chemin, cn.id_noeud, cn.ordre '.
'FROM osm_relation_a_chemins AS rc '.
' INNER JOIN osm_chemin_a_noeuds AS cn ON (rc.id_chemin = cn.id_chemin) '.
"WHERE rc.id_relation = {$this->idRelation} ".
"ORDER BY cn.ordre ASC ".
' -- '.__FILE__.' : '.__LINE__;
$infos = $this->bdd->recupererTous($requete);
foreach ($infos as $info) {
$this->infosRel[$info['id_chemin']][$info['id_noeud']] = $info['ordre'];
if (! isset($this->infosNoeuds[$info['id_noeud']][$info['id_chemin']])) {
$this->infosNoeuds[$info['id_noeud']][$info['id_chemin']] = 1;
} else {
$this->infosNoeuds[$info['id_noeud']][$info['id_chemin']]++;
}
}
//print_r($this->infosNoeuds);exit();
$this->ordre = 0;
}
 
private function getIdPremierChemin() {
$idChemin = null;
if (count($this->infosRel) > 0) {
reset($this->infosRel);
$idChemin = key($this->infosRel);
}
return $idChemin;
}
 
private function mettreAJourChemin($sens, $ligne, $fichier = __FILE__) {
$ordre = $this->ordre++;
$requete = 'UPDATE osm_relation_a_chemins '.
"SET ordre = '$ordre', sens = '$sens' ".
"WHERE id_relation = {$this->idRelation} ".
"AND id_chemin = {$this->idChemin} ".
" -- $fichier : $ligne";
$retour = $this->bdd->requeter($requete);
return $retour;
}
 
private function getIdDernierNoeud() {
$idNoeud = false;
if (count($this->infosRel[$this->idChemin]) > 0) {
end($this->infosRel[$this->idChemin]);
$idNoeud = key($this->infosRel[$this->idChemin]);
}
return $idNoeud;
}
 
private function ordonnerChemins() {
foreach ($this->infosRel as $chemin) {
// Selection du chemin qui possède le dernier noeud du précédent chemin et écarter l'actuel
$idCheminSuivant = $this->getIdCheminSuivant();
if ($idCheminSuivant) {
$this->idChemin = $idCheminSuivant;
$idPremierNoeud = $this->getIdPremierNoeud();
$idDernierNoeud = $this->getIdDernierNoeud();
$sens = $this->getSens($idPremierNoeud);
$this->mettreAJourChemin($sens, __LINE__);
$this->idNoeud = ($sens == 'directe') ? $idDernierNoeud : $idPremierNoeud;
}
}
}
 
private function getIdCheminSuivant() {
$idCheminSuivant = false;
if (isset($this->infosNoeuds[$this->idNoeud])) {
$cheminsIds = array_keys($this->infosNoeuds[$this->idNoeud]);
foreach ($cheminsIds as $idChemin) {
if ($idChemin != $this->idChemin) {
$idCheminSuivant = $idChemin;
break;
}
}
} else {
$msg = "Impossible de trouver le chemin suivant pour la relation : %s, le chemin %s et le noeud %s";
$this->messages->traiterAvertissement($msg, array($this->idRelation, $this->idChemin, $this->idNoeud));
}
return $idCheminSuivant;
}
 
private function getSens($idPremierNoeud) {
$sens = ( strcmp($idPremierNoeud, $this->idNoeud ) == 0 ) ? 'directe' : 'indirecte';
return $sens;
}
 
private function getIdPremierNoeud() {
$idNoeud = false;
if (count($this->infosRel[$this->idChemin]) > 0) {
reset($this->infosRel[$this->idChemin]);
$idNoeud = key($this->infosRel[$this->idChemin]);
}
return $idNoeud;
}
}
/tags/v5.7-arrayanal/scripts/modules/osm/config.ini
New file
0,0 → 1,9
; Ajouter les nouvelles version à la suite dans versions et versionsDonnees.
version = "1.0"
dossierSql = "{ref:dossierDonneesEflore}osm/"
 
[fichiers]
structureSql = "osm.sql"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:version}/{ref:fichiers.structureSql}"
/tags/v5.7-arrayanal/scripts/modules/osm/MiseAJour.php
New file
0,0 → 1,417
<?php
/**
* Permet de mettre à jour les contours à partir d'un fichier de diff.
*
* Exemple de lancement du script :
* /opt/lampp/bin/php -d memory_limit=3500M cli.php osm -a maj -f fichier_osm_change -e fichier_osm_nouveau
*/
class MiseAJour {
private $conteneur;
private $bdd;
private $messages;
private $mode;
 
private $communes = array();
private $relations_communes = array();
private $relation_a_chemins = array();
private $chemin_a_noeuds = array();
private $noeuds = array();
private $pas = 10000;
private $pas_commune = 1000;
private $elementType = '';
 
public function __construct($conteneur) {
$this->conteneur = $conteneur;
$this->bdd = $this->conteneur->getBdd();
$this->messages = $this->conteneur->getMessages();
$this->mode = $this->conteneur->getParametre('m');
}
 
/**
* Fonction qui parcourt tous les ways les noeuds de chaque relation en prenant en considération l'ordre et
* le sens de chaque ways concaténés ensemble (séparés par des virgules). Update du champ polygone de chaque
* relation dans la table `osm_relations`
*/
public function executer() {
// Lancement de l'action demandée
$cmd = $this->conteneur->getParametre('a');
switch ($cmd) {
case 'maj' :
$this->mettreAjour();
break;
default :
$msgTpl = "Erreur : la commande '%s' n'est pas prise en compte par la classe %s !";
$msg = sprintf($msgTpl, $cmd, get_class($this));
throw new Exception($msg);
}
print "\n";// Pour ramener à la ligne en fin de script
}
 
/**
* Fonction permettant de traiter et d'analyser le fichier de différence et de mettre à jour la base de données
* en tenant compte des trois cas:Suppression, Création ,modification
*/
private function mettreAjour() {
$lecteur = $this->getLecteurXml();
while ($lecteur->read()) {
if ($lecteur->nodeType == XMLREADER::ELEMENT) {
$this->elementType = $lecteur->localName;
$this->analyserElementXml($lecteur->localName, $lecteur->expand());
}
 
if ($this->mode == 'manuel') {
$this->messages->afficherAvancement("Analyse de la ligne du fichier de diff OSM : ", 1);
}
}
}
 
private function getLecteurXml() {
$fichierOsm = $this->conteneur->getParametre('f');
$lecteur = new XMLReader();
$ouvertureXmlOk = $lecteur->open($fichierOsm);
if ($ouvertureXmlOk === false) {
$msgTpl = "Impossible d'ouvrir le fichier osm : %s";
$msg = sprintf($msgTpl, $this->conteneur->getParametre('f'));
new Exception($msg);
}
return $lecteur;
}
 
private function analyserElementXml($noeudDom) {
$relations = $noeudDom->getElementsByTagName('relation');
if ($relations->length > 0) {
foreach ($relations as $relation) {
$this->analyserRelation($relation);
$this->traiterRelations();
}
}
 
$ways = $creations->getElementsByTagName('way');
if ($ways->length > 0) {
foreach ($ways as $way) {
$this->analyserWay($way);
$this->traiterCheminANoeuds();
}
}
 
$noeuds = $creations->getElementsByTagName('node');
if ($noeuds->length > 0) {
foreach ($noeuds as $noeud) {
$this->analyserNode($noeud);
$this->traiterNoeuds();
}
}
 
$this->traiterElementsOrphelins();
}
 
private function traiterRelations() {
if (count($this->relation_a_chemins) > $this->pas) {
switch ($this->elementType) {
case 'create' :
$this->insererRelationAChemins();
break;
case 'modify' :
$this->modifierRelationAChemins();
break;
case 'delete' :
$this->supprimerRelationAChemins();
break;
}
}
if (count($this->relations_communes) > $this->pas_commune) {
switch ($this->elementType) {
case 'create' :
$this->insererRelationsCommunes();
break;
case 'modify' :
$this->modifierRelationsCommunes();
break;
case 'delete' :
$this->supprimerRelationsCommunes();
break;
}
}
}
 
private function traiterChemins() {
if (count($this->chemin_a_noeuds) > $this->pas) {
switch ($this->elementType) {
case 'create' :
$this->insererCheminANoeuds();
break;
case 'modify' :
$this->modifierCheminANoeuds();
break;
case 'delete' :
$this->supprimerCheminANoeuds();
break;
}
}
}
 
private function traiterNoeuds() {
if (count($this->noeuds) > $this->pas) {
switch ($this->elementType) {
case 'create' :
$this->insererNoeuds();
break;
case 'modify' :
$this->modifierNoeuds();
break;
case 'delete' :
$this->supprimerNoeuds();
break;
}
}
}
 
private function traiterElementsOrphelins() {
switch ($this->elementType) {
case 'create' :
$this->insererRelationsCommunes();
$this->insererRelationAChemins();
$this->insererCheminANoeuds();
$this->insererNoeuds();
break;
case 'modify' :
$this->modifierRelationsCommunes();
$this->modifierRelationAChemins();
$this->modifierCheminANoeuds();
$this->modifierNoeuds();
break;
case 'delete' :
$this->supprimerRelationsCommunes();
$this->supprimerRelationAChemins();
$this->supprimerCheminANoeuds();
$this->supprimerNoeuds();
break;
}
}
 
/**
* Récupère l'id commune, nom commune et le code INSEE et remplie la table `osm_relations`
*/
private function analyserRelation($relation) {
$relation_id = $relation->getAttribute('id');
$chemins = $relation->getElementsByTagName('member');
foreach ($chemins as $chemin) {
if ($chemin->getAttribute('type') == 'way') { //écarter le noeud centrale
$chemin_id = $chemin->getAttribute('ref');
$role = $chemin->getAttribute('role');//role: null, inner, outer, exclave et enclave.
$this->relation_a_chemins[] = array($relation_id, $chemin_id, $role);
}
}
 
$tags = $relation->getElementsByTagName('tag');
if ($tags->length > 0) {
$this->analyserTags($relation_id, $tags);
}
}
 
private function analyserTags($relation_id, $tags) {
$commune_nom = null;
$commune_insee = null;
foreach ($tags as $tag) {
$tag_cle = $tag->getAttribute('k');
$tag_val = $tag->getAttribute('v');
switch ($tag_cle) {
case 'name' :
$commune_nom = $tag_val;
break;
case 'ref:INSEE' :
$commune_insee = $tag_val;
break;
}
if (!is_null($commune_nom) && !is_null($commune_insee)) {
$this->relations_communes[] = array($relation_id, $commune_nom, $commune_insee);
if (!isset($this->communes[$commune_insee])) {
$this->communes[$commune_insee] = $relation_id;
} else {
$e = "La relation #%s contient déjà le tag ref:INSEE avec la valeur %s.".
"Veuillez corriger la carte OSM.";
$this->traiterErreur($e, array($this->communes[$commune_insee], $commune_insee, $relation_id));
}
break;
}
}
}
 
/**
* Récupère l'id_way et tous les id_node de chaque way et remplie la table `osm_chemin_a_noeuds`
*/
private function analyserWay($way) {
$chemin_id = $way->getAttribute('id');
$noeuds = $way->getElementsByTagName('nd');
$ordre = 0;
foreach ($noeuds as $noeud) {
$noeud_id = $noeud->getAttribute('ref');
$this->chemin_a_noeuds[] = array($chemin_id, $noeud_id, ++$ordre);
}
}
 
/**
* Fonction qui récupère tous les l'id_node et les valeurs(Lat/Lon) correspondantes et remplie la table `osm_noeuds`
*/
private function analyserNode($node) {
$this->noeuds[] = array(
$node->getAttribute('id'),
$node->getAttribute('lat'),
$node->getAttribute('lon')
);
}
 
//Insertion des relations
private function insererRelationsCommunes() {
$requete = 'INSERT INTO osm_relations (id_relation, nom, code_insee) '.
'VALUES '.$this->creerValuesMultiple($this->relations_communes).
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
$this->relations_communes = array();
}
 
//Insertion des relations à chemins
private function insererRelationAChemins() {
$requete = 'INSERT INTO osm_relation_a_chemins (id_relation, id_chemin, role) '.
'VALUES '.$this->creerValuesMultiple($this->relation_a_chemins).
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
$this->relation_a_chemins = array();
}
 
//Insertion des chemins à noeuds
private function insererCheminANoeuds() {
$requete = 'INSERT INTO osm_chemin_a_noeuds (id_chemin, id_noeud, ordre) '.
'VALUES '.$this->creerValuesMultiple($this->chemin_a_noeuds).
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
$this->chemin_a_noeuds = array();
}
 
//Insertion des noeuds
private function insererNoeuds() {
$requete = 'INSERT INTO osm_noeuds (id_noeud, lat, `long`) '.
'VALUES '.$this->creerValuesMultiple($this->noeuds).
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
$this->noeuds = array();
}
 
//Update des relations
private function modifierRelationsCommunes() {
foreach ($this->relations_communes as $donnee) {
$infosP = $this->bdd->proteger($donnee);
$requete = 'UPDATE osm_relations '.
"SET id_relation = $infosP[0], nom = $infosP[1], code_insee = $infosP[2] ".
"WHERE id_relation = $infosP[0] ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
$this->relations_communes = array();
}
 
/*
*Update des relations à chemins en supprimant l'ancienne relation et tous ses chemins
*de la table osm_relation_a_chemins et insérer la nouvelle
*/
private function modifierRelationAChemins() {
$this->supprimerRelationAChemins();
foreach ($this->relation_a_chemins as $donnee) {
$infosP = $this->bdd->proteger($donnee);
$requete = 'INSERT INTO osm_relation_a_chemins (id_relation, id_chemin, role) '.
"VALUES ($infosP[0], $infosP[1], $infosP[2]) ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
$this->relation_a_chemins = array();
}
 
/*
*Update des chemins à noeuds en supprimant l'ancien chemin et tous ses noeuds
*de la table osm_chemins_a_noeuds et insérer le nouveau
*/
private function modifierCheminANoeuds() {
$this->supprimerCheminANoeuds();
foreach ($this->chemin_a_noeuds as $donnee) {
$infosP = $this->bdd->proteger($donnee);
$requete = 'INSERT INTO osm_chemin_a_noeuds (id_chemin, id_noeud, ordre) '.
"VALUES ($infosP[0], $infosP[1], $infosP[2]) ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
$this->chemin_a_noeuds = array();
}
 
//Update des noeuds
private function modifierNoeuds() {
foreach ($this->noeuds as $donnee) {
$infosP = $this->bdd->proteger($donnee);
$requete = 'UPDATE osm_noeuds '.
"SET id_noeud = $infosP[0], lat = $infosP[1], `long` = $infosP[2] ".
"WHERE id_noeud = $infosP[0] ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
$this->noeuds = array();
}
 
//Suppressions des relations
private function supprimerRelationsCommunes() {
$idsIn = $this->getIds($this->relations_communes);
$this->relations_communes = array();
$requete = 'DELETE FROM osm_relations '.
"WHERE id_relation IN ($idsIn) ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
 
//Suppressions des relations à chemins
private function supprimerRelationAChemins() {
$idsIn = $this->getIds($this->relation_a_chemins);
$this->relation_a_chemins = array();
$requete = 'DELETE FROM osm_relation_a_chemins '.
"WHERE id_relation IN ($idsIn) ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
 
//Suppressions des chemins à noeuds
private function supprimerCheminANoeuds() {
$idsIn = $this->getIds($this->chemin_a_noeuds);
$this->chemin_a_noeuds = array();
$requete = 'DELETE FROM osm_chemin_a_noeuds '.
"WHERE id_chemin IN ($idsIn) ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
 
//Suppressions des chemins à noeuds
private function supprimerNoeuds() {
$idsIn = $this->getIds($this->noeuds);
$this->noeuds = array();
$requete = 'DELETE FROM osm_noeuds '.
"WHERE id_noeud IN ($idsIn) ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
 
private function getIds(&$tableau) {
$ids = array();
foreach ($tableau as $info) {
$ids[] = $this->bdd->proteger($info[0]);
}
$idsSansDoublon = array_unique($ids);
$idsIn = implode(',', $idsSansDoublon);
return $idsIn;
}
 
private function creerValuesMultiple($donnees) {
$values = array();
foreach ($donnees as $infos) {
$infosP = $this->bdd->proteger($infos);
$values[] = implode(',', $infosP);
}
$valuesClause = '('.implode('),(', $values).')';
return $valuesClause;
}
}
/tags/v5.7-arrayanal/scripts/modules/osm/Osm.php
New file
0,0 → 1,104
<?php
//declare(encoding='UTF-8');
/**
* Exemple de lancement du script : :
* 1. Création de la base de données :
* /opt/lampp/bin/php cli.php osm -a chargerStructureSql -m manuel -v 3
*
* 2. Analyse du fichir OSM :
* /opt/lampp/bin/php cli.php osm -a analyser -f "../donnees/osm/fr_communes_new.osm" -m manuel -v 3
*
* 3. Traitement de l'ordre :
* /opt/lampp/bin/php cli.php osm -a ordre -m manuel -v 3
*
* 4. Remplissage des polygones :
* /opt/lampp/bin/php cli.php osm -a polygone -m manuel -v 3
*
* Définition des centroïdes pour les polygones déjà complets:
* /opt/lampp/bin/php cli.php osm -a centre -m manuel -v 3
*
* 5. Remise de l'ordre à zéro :
* /opt/lampp/bin/php cli.php osm -a zero -m manuel -v 3
*
* 6. Traitement de l'ordre des polygones incomplets :
* /opt/lampp/bin/php cli.php osm -a ordonnerPolygoneInc -m manuel -v 3
*
* 7. Remplissage des polygones incomplets :
* /opt/lampp/bin/php cli.php osm -a remplirPolygoneInc -m manuel -v 3
*
* 8. Renommage des polygones incomplets :
* /opt/lampp/bin/php cli.php osm -a renommer -m manuel -v 3
*
* 9. Définition des centroïdes :
* /opt/lampp/bin/php cli.php osm -a centre -m manuel -v 3
*
* @category php 5.4
* @package DEL
* @subpackage Scripts
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
* @copyright Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
* @license CeCILL v2 http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt
* @license GNU-GPL http://www.gnu.org/licenses/gpl.html
*/
// TODO : Améliorer la gestion de l'ordre des chemins pour éviter de prendre en compte des chemins inexistants
class Osm extends EfloreScript {
 
const PROJET_NOM = 'osm';
 
protected $parametres_autorises = array(
'-f' => array(true, null, 'Chemin du fichier osm à analyser'),
'-m' => array(false, 'auto', 'Mode «auto» ou «manuel». En manuel, les compteurs dans les boucles sont affichés.'));
 
public function executer() {
try {
$this->initialiserProjet(self::PROJET_NOM);
 
// Lancement de l'action demandée
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'analyser' :
$script = $this->chargerClasse('ParseurOsm');
$script->executer();
break;
case 'ordre' :
$script = $this->chargerClasse('OrdonneurDeChemins');
$script->executer();
break;
case 'polygone' :
case 'centre' :
case 'zero' :
$script = $this->chargerClasse('PolygoneCreateur');
$script->executer();
break;
case 'ordonnerPolygoneInc' :
case 'remplirPolygoneInc' :
case 'renommer' :
$script = $this->chargerClasse('PolygoneReparateur');
$script->executer();
break;
case 'maj' :
$script = $this->chargerClasse('MiseAJour');
$script->executer();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
print "\n";// Pour ramener à la ligne en fin de script
}
 
protected function initialiserProjet($projetNom) {
$this->projetNom = $projetNom;
}
 
private function chargerClasse($classe) {
require_once $classe.'.php';
$conteneur = new Conteneur($this->parametres);
return new $classe($conteneur);
}
}
/tags/v5.7-arrayanal/scripts/modules/osm/ParseurOsm.php
New file
0,0 → 1,244
<?php
/**
* Exemple de lancement du script :
*
* Analyse du fichir OSM :
* /opt/lampp/bin/php cli.php osm -a analyser -f "../donnees/osm/france_communes_new.osm" -m manuel
*
*/
class ParseurOsm {
 
private $conteneur;
private $bdd;
private $messages;
private $mode;
 
private $communes = array();
private $relations_communes = array();
private $relation_a_chemins = array();
private $chemin_a_noeuds = array();
private $noeuds = array();
private $pas = 10000;
private $pas_commune = 1000;
 
public function __construct($conteneur) {
$this->conteneur = $conteneur;
$this->bdd = $this->conteneur->getBdd();
$this->messages = $this->conteneur->getMessages();
$this->mode = $this->conteneur->getParametre('m');
}
 
public function executer() {
// Lancement de l'action demandée
$cmd = $this->conteneur->getParametre('a');
switch ($cmd) {
case 'analyser' :
$this->lireFichierOsm();
break;
case 'polygone' :
$this->remplirPolygone();
break;
case 'zero' :
$this->remettreOrdreAZero();
break;
default :
$this->messages->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
}
}
 
/**
* Lit le fichier OSM et lance l'analyse des noeuds xml en fonction de leur type.
*/
private function lireFichierOsm() {
$lecteur = $this->getLecteurXml();
while ($lecteur->read()) {
if ($lecteur->nodeType == XMLREADER::ELEMENT) {
$this->analyserElementXml($lecteur->localName, $lecteur->expand());
}
if ($this->mode == 'manuel') {
$this->messages->afficherAvancement("Analyse de la ligne du fichier OSM : ", 1);
}
}
$this->insererElementsOrphelins();
}
 
private function analyserElementXml($elementNom, $noeudDom) {
switch ($elementNom) {
case 'relation' :
$this->analyserRelation($noeudDom);
break;
case 'way' :
$this->analyserWay($noeudDom);
break;
case 'node' :
$this->analyserNode($noeudDom);
break;
}
}
 
private function insererElementsOrphelins() {
$this->insererRelationsCommunes();
$this->insererRelationAChemins();
$this->insererCheminANoeuds();
$this->insererNoeuds();
}
 
private function getLecteurXml() {
$fichierOsm = $this->conteneur->getParametre('f');
$lecteur = new XMLReader();
$ouvertureXmlOk = $lecteur->open($fichierOsm);
if ($ouvertureXmlOk === false) {
$msgTpl = "Impossible d'ouvrir le fichier osm : %s";
$msg = sprintf($msgTpl, $this->conteneur->getParametre('f'));
new Exception($msg);
}
return $lecteur;
}
 
/**
* Récupère l'id commune, nom commune et le code INSEE et remplie la table `CommuneOSM`
*/
private function analyserRelation($relation) {
$idRelation = $relation->getAttribute('id');
 
$chemins = $relation->getElementsByTagName('member');
$this->analyserChemins($idRelation, $chemins);
if (count($this->relation_a_chemins) > $this->pas) {
$this->insererRelationAChemins();
}
 
$tags = $relation->getElementsByTagName('tag');
$this->analyserTags($idRelation, $tags);
if (count($this->relations_communes) > $this->pas_commune) {
$this->insererRelationsCommunes();
}
}
 
private function analyserChemins($relation_id, $chemins) {
foreach ($chemins as $chemin) {
if ($chemin->getAttribute('type') == 'way') { //écarter le noeud centrale
$chemin_id = $chemin->getAttribute('ref');
$role = $chemin->getAttribute('role');//role: null, inner, outer, exclave et enclave.
$this->relation_a_chemins[] = array($relation_id, $chemin_id, $role);
}
}
}
 
private function analyserTags($relation_id, $tags) {
$commune_nom = null;
$commune_insee = null;
foreach ($tags as $tag) {
$tag_cle = $tag->getAttribute('k');
$tag_val = $tag->getAttribute('v');
 
switch ($tag_cle) {
case 'name' :
$commune_nom = $tag_val;
break;
case 'ref:INSEE' :
$commune_insee = $tag_val;
break;
}
 
if (!is_null($commune_nom) && !is_null($commune_insee)) {
 
if (!isset($this->relations_communes[$relation_id])) {
$this->relations_communes[$relation_id] = array($relation_id, $commune_nom, $commune_insee);
} else {
$e = "La relation #%s possédant le tag ref:INSEE «%s» est déjà prise en compte.";
$this->messages->traiterErreur($e, array($relation_id, $commune_insee));
}
 
if (!isset($this->communes[$commune_insee])) {
$this->communes[$commune_insee] = $relation_id;
} else {
$e = "La relation #%s contient déjà le tag ref:INSEE avec la valeur %s.".
"Veuillez corriger la carte OSM.";
$this->messages->traiterErreur($e, array($this->communes[$commune_insee], $commune_insee, $relation_id));
}
break;// Stoppe le foreach car nous avons les infos nécessaires
}
}
}
 
/**
* Récupère l'id_way et tous les id_node de chaque way et remplie la table `osm_chemin_a_noeuds`
*/
private function analyserWay($way) {
$chemin_id = $way->getAttribute('id');
$ordre = 1;
$noeuds = $way->getElementsByTagName('nd');
foreach ($noeuds as $noeud) {
$noeud_id = $noeud->getAttribute('ref');
$this->chemin_a_noeuds[] = array($chemin_id, $noeud_id, $ordre++);
}
 
if (count($this->chemin_a_noeuds) > $this->pas) {
$this->insererCheminANoeuds();
}
}
 
/**
* Fonction qui récupère tous les l'id_node et les valeurs(Lat/Lon) correspondantes et remplie la table `osm_noeuds`
*/
private function analyserNode($node) {
$noeud_id = $node->getAttribute('id');
$lat = $node->getAttribute('lat');
$lon = $node->getAttribute('lon');
$this->noeuds[] = array($noeud_id, $lat, $lon);
 
if (count($this->noeuds) > $this->pas) {
$this->insererNoeuds();
}
}
 
private function insererRelationsCommunes() {
if (count($this->relations_communes) > 0) {
$requete = 'INSERT INTO osm_relations (id_relation, nom, code_insee) '.
'VALUES '.$this->creerValuesMultiple($this->relations_communes).
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
$this->relations_communes = array();
}
 
private function insererRelationAChemins() {
if (count($this->relation_a_chemins) > 0) {
$requete = 'INSERT INTO osm_relation_a_chemins (id_relation, id_chemin, role) '.
'VALUES '.$this->creerValuesMultiple($this->relation_a_chemins).
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
$this->relation_a_chemins = array();
}
 
private function insererCheminANoeuds() {
if (count($this->chemin_a_noeuds) > 0) {
$requete = 'INSERT INTO osm_chemin_a_noeuds (id_chemin, id_noeud, ordre) '.
'VALUES '.$this->creerValuesMultiple($this->chemin_a_noeuds).
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
$this->chemin_a_noeuds = array();
}
 
private function insererNoeuds() {
if (count($this->noeuds) > 0) {
$requete = 'INSERT INTO osm_noeuds (id_noeud, lat, `long`) '.
'VALUES '.$this->creerValuesMultiple($this->noeuds).
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
$this->noeuds = array();
}
 
private function creerValuesMultiple($donnees) {
$values = array();
foreach ($donnees as $infos) {
$infosP = $this->bdd->proteger($infos);
$values[] = implode(',', $infosP);
}
$valuesClause = '('.implode('),(', $values).')';
return $valuesClause;
}
}
/tags/v5.7-arrayanal/scripts/modules/osm/shell/extract-poly
New file
0,0 → 1,29
#!/bin/bash
# Utilisation : ./extract-poly fr-p.osm.pbf fr-14
# Paramètres : .
# - 1 : nom du fichier .pbf dont on veut extraire une portion avec un fichier .poly
# - 2 : nom du fichier .poly sans extenssion (l'extrait aura le même nom avec l'extenssion .pbf)
#
if [ -f config.cfg ] ; then
source config.cfg
echo $DATE;
else
echo "Veuillez paramétrer le script en renommant le fichier 'config.defaut.cfg' en 'config.cfg'."
exit;
fi
 
FICHIER_OSM=$1
FICHIER=$2
 
echo "Export de l'emplacement du binaire Java dans la variable d'environnement JAVACMD";
export JAVACMD="$CHEMIN_JAVA"
 
echo "Export de l'emplacement du dossier tmp pour Osmosis"
export JAVACMD_OPTIONS="-Djava.io.tmpdir=$OSMOSIS_DOSSIER_TMP -Xmx4G"
 
echo "Filtrage du fichier en cours ...";
$CHEMIN_OSMOSIS \
-v \
--read-pbf-fast "$DOSSIER_OSM/$FICHIER_OSM" workers=6 \
--bounding-polygon file="$DOSSIER_OSM/$FICHIER.poly" \
--write-pbf file="$DOSSIER_OSM/$FICHIER.pbf"
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/v5.7-arrayanal/scripts/modules/osm/shell/extract-communes
New file
0,0 → 1,34
#!/bin/bash
# Utilisation : ./extract-communes fr-14
# Paramètres : .
# - 1 : nom du fichier .pbf dont on veut extraire les communes (sans extenssion)
# Sortie : nom du fichier .pbf suffixé par "_new" et avec l'extenssion .osm
#
ageEnSeconde(){ expr `date +%s` - `stat -c %Y $1`; };
 
if [ -f config.cfg ] ; then
source config.cfg
echo $DATE;
else
echo "Veuillez paramétrer le script en renommant le fichier 'config.defaut.cfg' en 'config.cfg'."
exit;
fi
 
FICHIER=$1
 
echo "Export de l'emplacement du binaire Java dans la variable d'environnement JAVACMD";
export JAVACMD="$CHEMIN_JAVA"
 
echo "Export de l'emplacement du dossier tmp pour Osmosis"
export JAVACMD_OPTIONS="-Djava.io.tmpdir=$OSMOSIS_DOSSIER_TMP -Xmx4G"
 
echo "Filtrage du fichier en cours ...";
$CHEMIN_OSMOSIS \
-v \
--read-pbf-fast "$DOSSIER_OSM/$FICHIER.pbf" workers=6 \
--tf accept-relations admin_level=8 \
--tf accept-relations type=boundary \
--tf accept-relations ref:INSEE=* \
--used-way \
--used-node \
--wx "$DOSSIER_OSM/${FICHIER}_new.osm"
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/v5.7-arrayanal/scripts/modules/osm/shell/carto-osm-service
New file
0,0 → 1,41
#!/bin/sh
#/etc/rc.d/init.d/
#
# Jean-Pascal MILCENT & Mohcen BENMOUNAH [19 juillet 2011]
# Service de lancement des scripts d'integration des donnees OSM pour le service de Geocadage Inverse
#
case "$1" in
 
start)
 
echo "Demarrage de carto-osm-cron :"
nohup /usr/local/sbin/carto-osm-cron 1>/dev/null 2>/dev/null &
 
;;
 
stop)
 
echo "Arret de carto-osm-cron"
PID=`ps -eaf | grep carto-osm-cron | grep -v grep | tr -s ' ' | cut -d' ' -f2 | head -n1`
kill -9 ${PID}
 
;;
 
status)
 
echo -n "Voici les PID du processus carto-osm-cron :"
PID=`ps -eaf | grep carto-osm-cron | grep -v grep | tr -s ' ' | cut -d' ' -f2 | head -n1`
echo ${PID}
 
;;
 
 
*)
 
echo "Usage: {start|stop|status}"
 
exit 1
 
;;
 
esac
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/v5.7-arrayanal/scripts/modules/osm/shell/carto-osm-cron
New file
0,0 → 1,30
#!/bin/bash
#
# Mohcen BENMOUNAH & Jean-Pascal MILCENT [19 juillet 2011]
# /etc/init.d/carto-osm : demarage/arrete/etat du cron de l'integration des donnees OSM pour le Geocodage Inverse (carto-osm)
# Lancement toutes les semaines le samedi matin après 3h00
 
while true
do
JOUR=$(date "+%u")
# Si nous sommes samedi (=6)
if [ $JOUR -eq 6 ] ; then
HEURE=$(date "+%H")
# Si nous sommes à 3 heures du matin
if [ $HEURE -eq 3 ] ; then
logger "carto-osm-maj : lancement script"
sudo -u telabotap /usr/local/sbin/carto-osm-maj
logger "carto-osm-maj : arret script"
# Nous retenterons de vérifier jour et heure dans 6 jours
sleep 6d
else
# Tentative toutes les heures
logger "carto-osm-maj : tentative heure $HEURE"
sleep 1h
fi
else
# Tentative tous les jours
logger "carto-osm-maj : tentative jour $JOUR"
sleep 1d
fi
done
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/v5.7-arrayanal/scripts/modules/osm/shell/carto-osm-maj
New file
0,0 → 1,91
#!/bin/bash
#
# Script de lancement de l'integration des donnees OSM pour le geocodage inverse
# Mohcen BENMOUNAH & Jean-Pascal MILCENT [19 juillet 2011]
#
ageEnSeconde(){ expr `date +%s` - `stat -c %Y $1`; };
 
if [ -f config.cfg ] ; then
source config.cfg
echo $DATE;
else
echo "Veuillez paramétrer le script en renommant le fichier 'config.defaut.cfg' en 'config.cfg'."
exit;
fi
 
echo "Export de l'emplacement du binaire Java dans la variable d'environnement JAVACMD";
export JAVACMD="$CHEMIN_JAVA"
 
echo "Export de l'emplacement du dossier tmp pour Osmosis"
export JAVACMD_OPTIONS="-Djava.io.tmpdir=$OSMOSIS_DOSSIER_TMP -Xmx4G"
 
if [ ! -f "$DOSSIER_OSM/$FICHIER_OSM" ] || [ `ageEnSeconde "$DOSSIER_OSM/$FICHIER_OSM"` -gt 86000 ] ; then
echo "Téléchargement du nouveau fichier PBF ...";
wget $URL_FICHIER_OSM -O "$DOSSIER_OSM/$FICHIER_OSM"
else
echo "Fichier $FICHIER_OSM existant à moins d'un jour.";
fi
 
if [ ! -f "$DOSSIER_OSM/$FICHIER_ZG_NEW" ] || [ `ageEnSeconde "$DOSSIER_OSM/$FICHIER_ZG_NEW"` -gt 86000 ] ; then
echo "Filtrage du fichier en cours ...";
$CHEMIN_OSMOSIS \
-v \
--read-pbf-fast "$DOSSIER_OSM/$FICHIER_OSM" workers=6 \
--tf accept-relations admin_level=8 \
--tf accept-relations type=boundary \
--tf accept-relations ref:INSEE=* \
--used-way \
--used-node \
--wx "$DOSSIER_OSM/$FICHIER_ZG_NEW"
fi
 
HEURE_DEBUT=`date +"%F %X"`;
echo "Début éxecution scripts php : $HEURE_DEBUT";
 
if [ ! -f "$DOSSIER_OSM/$FICHIER_ZG_OLD" ] ; then
echo "Création des tables osm en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a chargerStructureSql -v $VERBOSITE > $FICHIER_LOG
 
echo "Analyse du fichier osm en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a analyser -v $VERBOSITE -f "$DOSSIER_OSM/$FICHIER_ZG_NEW" >> $FICHIER_LOG
else
echo "Suppression du fichier DIFF existant en cours ...";
rm -f "$DOSSIER_OSM/$FICHIER_ZG_DIFF"
 
echo "Déduction de la différence en cours ...";
$CHEMIN_OSMOSIS\
--read-xml file="$DOSSIER_OSM/$FICHIER_ZG_NEW" \
--read-xml file="$DOSSIER_OSM/$FICHIER_ZG_OLD" \
--derive-change \
--write-xml-change file="$DOSSIER_OSM/$FICHIER_ZG_DIFF"
 
echo "Début de la mise à jour de base ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php mise_a_jour -a MAJ -f "$DOSSIER_OSM/$FICHIER_ZG_DIFF" > $FICHIER_LOG
fi
 
echo "Renommage du fichier NEW en OLD en cours ...";
mv "$DOSSIER_OSM/$FICHIER_ZG_NEW" "$DOSSIER_OSM/$FICHIER_ZG_OLD" >> $FICHIER_LOG
 
echo "Traitement de l'ordre en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a ordre -v $VERBOSITE >> $FICHIER_LOG
 
echo "Remplissage des polygones en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a polygone -v $VERBOSITE >> $FICHIER_LOG
 
echo "Remise de l'ordre à zéro en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a zero -v $VERBOSITE >> $FICHIER_LOG
 
echo "Traitement de l'ordre des polygones incomplets en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a ordonnerPolygoneInc -v $VERBOSITE >> $FICHIER_LOG
 
echo "Remplissage des polygones incomplets en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a remplirPolygoneInc -v $VERBOSITE >> $FICHIER_LOG
 
echo "Renommage des polygones incomplets en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a renommer -v $VERBOSITE >> $FICHIER_LOG
 
echo "Definition des centroïdes en cours ...";
$CHEMIN_PHP -d memory_limit=$MEMORY_LIMIT_PHP $CHEMIN_SCRIPT/cli.php osm -a centre -v $VERBOSITE >> $FICHIER_LOG
 
HEURE_FIN=`date +"%F %X"`;
echo "Fin éxecution scripts php : $HEURE_FIN";
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/v5.7-arrayanal/scripts/modules/osm/shell/config.defaut.cfg
New file
0,0 → 1,26
# Binaires
CHEMIN_JAVA="/usr/local/jre/bin/java"
CHEMIN_PHP="/usr/local/php/5.5/bin/php"
CHEMIN_SCRIPT="/home/apitela/www/scripts/eflore"
 
# Dossiers, fichiers & urls
# Pour tester : http://download.geofabrik.de/europe/france/languedoc-roussillon-latest.osm.pbf
URL_FICHIER_OSM="http://download.geofabrik.de/europe/france-latest.osm.pbf"
DOSSIER_OSM="/home/jpm/web/eflore/eflore-projets/donnees/osm"
FICHIER_OSM="fr.osm.pbf"
FICHIER_ZG_NEW="fr_communes_new.osm"
FICHIER_ZG_OLD="fr_communes_old.osm"
FICHIER_ZG_DIFF="fr_communes_diff.osm"
 
# Osmosis
CHEMIN_OSMOSIS="/usr/local/sbin/osmosis-0.43.1/bin"
OSMOSIS_DOSSIER_TMP="$DOSSIER_OSM/tmp"
 
# Logs
VERBOSITE=3
DATE=`date +"%F"`
CHEMIN_LOG="$DOSSIER_OSM/logs"
FICHIER_LOG="$CHEMIN_LOG/analyse_${DATE}.log"
 
# Paramètres PHP
MEMORY_LIMIT_PHP="8000M"
/tags/v5.7-arrayanal/scripts/modules/osm/shell
New file
Property changes:
Added: svn:ignore
+config.cfg
/tags/v5.7-arrayanal/scripts/modules/osm/PolygoneCreateur.php
New file
0,0 → 1,143
<?php
/**
* Traitement de l'ordre :
*
* Fonction qui rajoute l'ordre et le sens de chaque way d'une relation dans la table `osm_relation_a_chemins`
*
* Exemple de lancement du script :
* /opt/lampp/bin/php -d memory_limit=8000M cli.php osm -a ordre -m manuel
*
*/
class PolygoneCreateur {
private $conteneur;
private $bdd;
private $messages;
private $mode;
 
public function __construct($conteneur) {
$this->conteneur = $conteneur;
$this->bdd = $this->conteneur->getBdd();
$this->messages = $this->conteneur->getMessages();
$this->mode = $this->conteneur->getParametre('m');
}
 
/**
* Fonction qui parcourt tous les ways les noeuds de chaque relation en prenant en considération l'ordre et
* le sens de chaque ways concaténés ensemble (séparés par des virgules). Update du champ polygone de chaque
* relation dans la table `osm_relations`
*/
public function executer() {
// Lancement de l'action demandée
$cmd = $this->conteneur->getParametre('a');
switch ($cmd) {
case 'polygone' :
$this->genererPolygones();
break;
case 'centre' :
$this->mettreAJourCentroide();
break;
case 'zero' :
$this->remettreOrdreAZero();
break;
default :
$msgTpl = "Erreur : la commande '%s' n'est pas prise en compte par la classe %s !";
$msg = sprintf($msgTpl, $cmd, get_class($this));
throw new Exception($msg);
}
print "\n";// Pour ramener à la ligne en fin de script
}
 
private function genererPolygones() {
$relations = $this->getRelations();
foreach ($relations as $relation) {
$chemins = $this->getChemins($relation['id_relation']);
$noeuds = array();
foreach ($chemins as $chemin) {
$noeuds = array_merge($noeuds, $this->getNoeuds($chemin['id_chemin'], $chemin['sens']));
}
$this->creerPolygone($relation, $noeuds);
 
if ($this->mode == 'manuel') {
$this->messages->afficherAvancement("Création du polygone pour la relation : ", 1);
}
}
}
 
private function getRelations() {
$requete = 'SELECT id_relation, nom, code_insee '.
'FROM osm_relations '.
' -- '.__FILE__.' : '.__LINE__;
$relations = $this->bdd->recupererTous($requete);
return $relations;
}
 
private function getChemins($idRelation) {
$requete = 'SELECT id_chemin, sens '.
'FROM osm_relation_a_chemins '.
"WHERE id_relation = $idRelation ".
'ORDER BY ordre '.
' -- '.__FILE__.' : '.__LINE__;
$chemins = $this->bdd->recupererTous($requete);
return $chemins;
}
 
private function getNoeuds($idChemin, $sens) {
$tri = ($sens == 'directe') ? 'ASC' : 'DESC';
$requete = 'SELECT NLL.id_noeud, NLL.lat, NLL.`long` '.
'FROM osm_chemin_a_noeuds AS WN '.
' INNER JOIN osm_noeuds AS NLL ON (WN.id_noeud = NLL.id_noeud) '.
"WHERE WN.id_chemin = $idChemin ".
"ORDER BY WN.ordre $tri ".
' -- '.__FILE__.' : '.__LINE__;
$noeuds = $this->bdd->recupererTous($requete);
$latLng = array();
foreach ($noeuds as $noeud) {
$latLng[] = $noeud['lat'].' '.$noeud['long'];
}
return $latLng;
}
 
private function creerPolygone($relation, $noeuds) {
$polygone = implode(', ', $noeuds);
$idRelation = $relation['id_relation'];
$nomCommuneP = $this->bdd->proteger($relation['nom']);
$InseeP = $this->bdd->proteger($relation['code_insee']);
$note = ($noeuds[0] == $noeuds[count($noeuds) - 1]) ? 'Polygone complet' : 'Polygone incomplet';
 
$requete = 'REPLACE INTO osm_communes (id_relation, nom, code_insee, polygone, notes ) '.
"VALUES ($idRelation, $nomCommuneP, $InseeP, ".
"POLYFROMTEXT('MULTIPOLYGON ((($polygone)))'), '$note') ".
' -- '.__FILE__.' : '.__LINE__;
unset($polygone);
 
$this->bdd->requeter($requete);
}
 
/**
* Pour chaque commune, renseigne le champe "centre" avec un point centroïde du polygone (si non null).
*/
private function mettreAJourCentroide() {
$requete = 'UPDATE osm_communes '.
'SET centre = CENTROID(polygone) '.
"WHERE polygone IS NOT NULL ".
' -- '.__FILE__.' : '.__LINE__;
$retour = $this->bdd->requeter($requete);
$this->messages->traiterInfo("Nombre de centroïde mis à jour : ".$retour->rowCount());
}
 
/**
* Pour chaque commune, remet à zéro l'ordre des chemins si le polygone est incomplet.
*/
private function remettreOrdreAZero() {
$sousRequeteRelations = 'SELECT DISTINCT id_relation '.
'FROM osm_communes '.
"WHERE notes = 'Polygone incomplet' ";
 
$requete = 'UPDATE osm_relation_a_chemins '.
'SET ordre = NULL '.
"WHERE id_relation IN ($sousRequeteRelations) ".
' -- '.__FILE__.' : '.__LINE__;
$retour = $this->bdd->requeter($requete);
$this->messages->traiterInfo("Nombre de chemins remis à zéro : ".$retour->rowCount());
}
}
/tags/v5.7-arrayanal/scripts/modules/osm/PolygoneReparateur.php
New file
0,0 → 1,300
<?php
/**
* Réparation des polygones incomplets :
*
* Exemple de lancement du script :
* /opt/lampp/bin/php -d memory_limit=8000M cli.php osm -a ordonnerPolygoneInc -m manuel -v 3
*
* /opt/lampp/bin/php -d memory_limit=8000M cli.php osm -a remplirPolygoneInc -m manuel -v 3
*
* /opt/lampp/bin/php -d memory_limit=8000M cli.php osm -a renommer -m manuel -v 3
*
*/
class PolygoneReparateur {
private $conteneur;
private $bdd;
private $messages;
private $mode;
 
public function __construct($conteneur) {
$this->conteneur = $conteneur;
$this->bdd = $this->conteneur->getBdd();
$this->messages = $this->conteneur->getMessages();
$this->mode = $this->conteneur->getParametre('m');
}
 
/**
* Fonction qui parcourt tous les ways les noeuds de chaque relation en prenant en considération l'ordre et
* le sens de chaque ways concaténés ensemble (séparés par des virgules). Update du champ polygone de chaque
* relation dans la table `osm_relations`
*/
public function executer() {
// Lancement de l'action demandée
$cmd = $this->conteneur->getParametre('a');
switch ($cmd) {
case 'ordonnerPolygoneInc' :
$this->ordonnerRelationsAuPolygoneIncomplet();
break;
case 'remplirPolygoneInc' :
$this->remplirRelationsAuPolygoneIncomplet();
break;
case 'renommer' :
$this->renommerEnPolygoneIncomplet();
break;
default :
$msgTpl = "Erreur : la commande '%s' n'est pas prise en compte par la classe %s !";
$msg = sprintf($msgTpl, $cmd, get_class($this));
throw new Exception($msg);
}
print "\n";// Pour ramener à la ligne en fin de script
}
 
/**
* Fonction qui récupère les relations des polygones incomplets et appelle pour chaque relation la fonction
* ordonnerPolygoneIncomplet($ordre,$tour,$idRelation,$nombrePolygone)
*/
private function ordonnerRelationsAuPolygoneIncomplet() {
$relations = $this->getRelationsAuPolygoneIncomplet();
foreach ($relations as $relation) {
$idRelation = $relation['id_relation'];
$this->ordonnerCheminsMultiPolygone($idRelation);
 
if ($this->mode == 'manuel') {
$this->messages->afficherAvancement("Réparation du polygone incomplet : ", 1);
}
}
}
 
/**
* Fonction récursive qui exécute la même tâche que la fonction ordonnerWays() pour chaque polygone d'un
* multipolygone et remplie le champ NbPoly dans la table `osm_relation_a_chemins` qui correspond au nombre de polygone fermé
* dans le multipolygone
*/
private function ordonnerCheminsMultiPolygone($idRelation, $numPolygone = 1, $ordre = 1, $tour = 1) {
$chemins = $this->getChemins($idRelation);
$nbreCheminsTotal = count($chemins);
 
// premier élément du tableau
$idPremierChemin = $chemins[0]['id_chemin'];
$idChemin = $idPremierChemin;
 
$this->mettreAJourChemin($idRelation, $idPremierChemin, $ordre, 'directe', $numPolygone);
//selection dernier noeud
$nodes = $this->getNoeuds($idPremierChemin);
$nombreNodes = count($nodes);
$premierNoeud = $nodes[0]['id_noeud'];
$dernierNoeud = $nodes[$nombreNodes - 1]['id_noeud'];
$noeudActuel = $dernierNoeud;
 
//Condition pour laquelle la boucle while continue à tourner; tant que le premier noeud du polygone n'est
//égale au dernier et tant qu'il reste des ways à gérer
while (($premierNoeud != $noeudActuel) && (($ordre % 1000) < $nbreCheminsTotal)) {
//select le way qui possède le dernier noeud du précédent way et écarter l'actuel
$ordre++;
 
$chemins = $this->getCheminsAOrdonner($idRelation, $idChemin, $noeudActuel);
if (isset($chemins[0])) {
$idChemin = $chemins[0]['id_chemin'];
$nodes = $this->getNoeuds($idChemin);
$nombreNodes = count($nodes);
if (strcmp($nodes[0]['id_noeud'], $noeudActuel ) == 0) {
$sens = 'directe';
$noeudActuel = $nodes[$nombreNodes-1]['id_noeud'];
} else {
$sens = 'indirecte';
$noeudActuel = $nodes[0]['id_noeud'];
}
$this->mettreAJourChemin($idRelation, $idChemin, $ordre, $sens, $numPolygone);
}
}
$ordre = 1000 * $tour; //différencier chaque polygone: pour chaque polygone on a un multiple de mille
if ($this->getNombreChemins($idRelation) != 0) {
//appelle de la méthode récursivement
$this->ordonnerCheminsMultiPolygone($idRelation, ++$numPolygone, $ordre, ++$tour);
}
}
 
private function getRelationsAuPolygoneIncomplet() {
$requete = 'SELECT id_relation '.
'FROM osm_communes '.
"WHERE notes = 'Polygone incomplet' ".
' -- '.__FILE__.' : '.__LINE__;
$relations = $this->bdd->recupererTous($requete);
return $relations;
}
 
private function getChemins($idRelation) {
$requete = 'SELECT id_chemin '.
'FROM osm_relation_a_chemins '.
"WHERE id_relation = $idRelation ".
"AND ordre IS NULL ".
' -- '.__FILE__.' : '.__LINE__;
$chemins = $this->bdd->recupererTous($requete);
return $chemins;
}
/**
* Select des ways qui n'ont pas été ordonnés: on obtient à chaque itération les ways qui restent à ordonner
*/
private function getCheminsAOrdonner($idRelation, $idChemin, $idNoeud) {
$requete = 'SELECT cn.id_chemin '.
'FROM osm_relation_a_chemins AS rc '.
' INNER JOIN osm_chemin_a_noeuds AS cn ON (rc.id_chemin = cn.id_chemin) '.
"WHERE cn.id_noeud = $idNoeud ".
"AND cn.id_chemin != $idChemin ".
"AND rc.id_relation = $idRelation ".
"AND rc.ordre IS NULL ".
' -- '.__FILE__.' : '.__LINE__;
$chemins = $this->bdd->recupererTous($requete);
return $chemins;
}
 
private function getNoeuds($idChemin) {
$requete = 'SELECT id_noeud '.
'FROM osm_chemin_a_noeuds '.
"WHERE id_chemin = $idChemin ".
'ORDER BY ordre '.
' -- '.__FILE__.' : '.__LINE__;
$noeuds = $this->bdd->recupererTous($requete);
return $noeuds;
}
 
private function getNombreChemins($idRelation) {
$requete = 'SELECT COUNT(id_chemin) AS nbre '.
'FROM osm_relation_a_chemins '.
"WHERE id_relation = $idRelation ".
'AND ordre = 0 '.
' -- '.__FILE__.' : '.__LINE__;
$infos = $this->bdd->recuperer($requete);
return $infos['nbre'];
}
 
private function mettreAJourChemin($idRelation, $idChemin, $ordre, $sens, $nbrePoly) {
$requete = 'UPDATE osm_relation_a_chemins '.
"SET ordre = '$ordre', sens = '$sens', num_poly = $nbrePoly ".
"WHERE id_relation = $idRelation ".
"AND id_chemin = $idChemin ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
 
/**
* Fonction qui récupère les relations des polygones incomplets et appelle pour chaque relation la fonction
* remplirPolygoneIncomplet($idRelation);
*/
private function remplirRelationsAuPolygoneIncomplet() {
$relations = $this->getRelationsAuPolygoneIncomplet();
foreach ($relations as $relation) {
$this->remplirPolygoneIncomplet($relation['id_relation']);
if ($this->mode == 'manuel') {
$this->messages->afficherAvancement("Création du polygone incomplet : ", 1);
}
}
}
 
/**
* Fonction qui exécute la même tâche que la fonction remplirPolygone() pour chaque polygone d'un multipolygone
* et renvoie un tableau MultiPolygone[] où chaque case contient un polygone fermé. Puis met à jour le polygone
* de la commune.
*/
private function remplirPolygoneIncomplet($idRelation) {
// Tableau multipolygone qui contient tous les polygones d'un multipolygone
$multiPolygone = array();
// Tableau roles qui contient les différents roles des chemins de la relation
$roles = array();
// Sélectionner le nombre de polygones qui existe dans un multipolygone
$nbPoly = $this->getNombrePoly($idRelation);
//boucle for qui parcourt chaque polygone du multipolygone
for ($numPoly = 1; $numPoly <= $nbPoly; $numPoly++) {
$polygone = array();
$chemins = $this->getCheminsParPolygone($idRelation, $numPoly);
foreach ($chemins as $chemin) {
$role = $chemin['role'];
$roles[$role] = (isset($roles[$role])) ? $roles[$role]++ : 1;
$noeuds = $this->getNoeudsPourCheminEtSens($chemin['id_chemin'], $chemin['sens']);
$polygone = array_merge($polygone, $noeuds);
}
$multiPolygone[] = implode(', ', $polygone);
}
$this->mettreAJourMultiPolygone($multiPolygone, $roles, $idRelation, $nbPoly);
}
 
private function getNombrePoly($idRelation) {
$requete = 'SELECT MAX(num_poly) AS num_poly '.
'FROM osm_relation_a_chemins '.
"WHERE id_relation = $idRelation ".
' -- '.__FILE__.' : '.__LINE__;
$resultat = $this->bdd->recuperer($requete);
return $resultat['num_poly'];
}
 
private function getCheminsParPolygone($idRelation, $numPoly) {
$requete = 'SELECT id_chemin, sens, role '.
'FROM osm_relation_a_chemins '.
"WHERE id_relation = $idRelation ".
"AND num_poly = $numPoly ".
'ORDER BY ordre '.
' -- '.__FILE__.' : '.__LINE__;
$chemins = $this->bdd->recupererTous($requete);
return $chemins;
}
 
private function getNoeudsPourCheminEtSens($idChemin, $sens) {
$tri = ($sens == 'directe') ? 'ASC' : 'DESC';
$requete = 'SELECT NLL.id_noeud, NLL.lat, NLL.`long` '.
'FROM osm_chemin_a_noeuds AS WN '.
' INNER JOIN osm_noeuds AS NLL ON (WN.id_noeud = NLL.id_noeud) '.
"WHERE WN.id_chemin = $idChemin ".
"ORDER BY WN.ordre $tri ".
' -- '.__FILE__.' : '.__LINE__;
$noeuds = $this->bdd->recupererTous($requete);
$latLng = array();
foreach ($noeuds as $noeud) {
$latLng[] = $noeud['lat'].' '.$noeud['long'];
}
return $latLng;
}
 
/**
* Remplie le champ polygone à partir du tableau MultiPolygone
*/
private function mettreAJourMultiPolygone($multiPolygone, $roles, $idRelation, $nbPoly) {
// Présence d'une enclave contenue dans cette entité administrative mais qui appartient à une autre entité administrative
if ((isset($roles['inner']) || isset($roles['enclave']))) {
if ($nbPoly == 2) {
$multiPoly = implode('),(', $multiPolygone);
} else {
$multiPoly = null;
$msgTpl = "La relation '%s' possède plus de 2 polygones de type enclaves.";
$this->messages->traiterErreur($msgTpl, array($idRelation));
}
} else {
// Tous les autres cas
$multiPoly = implode(')),((', $multiPolygone);
}
if (isset($multiPoly)) {
$this->mettreAJourCommune($idRelation, $multiPoly);
}
}
 
private function mettreAJourCommune($idRelation, $multiPoly) {
$requete = 'UPDATE osm_communes '.
"SET polygone = MPOLYFROMTEXT('MULTIPOLYGON((($multiPoly)))'), ".
"notes = 'Polygone complet' ".
"WHERE id_relation = $idRelation ".
' -- '.__FILE__.' : '.__LINE__;
$this->bdd->requeter($requete);
}
 
/**
* Renomme la note des polygones vides d'un polygone complet en polygone incomplet
*/
private function renommerEnPolygoneIncomplet() {
$requete = 'UPDATE osm_communes '.
"SET notes = 'Polygone incomplet' ".
"WHERE ASTEXT(polygone) IS NULL ".
' -- '.__FILE__.' : '.__LINE__;
 
$retour = $this->bdd->requeter($requete);
$this->messages->traiterInfo("Nombre de polygones définis à incomplet : ".$retour->rowCount());
}
}
/tags/v5.7-arrayanal/scripts/modules/osm
New file
Property changes:
Added: svn:ignore
+.config.ini.swp
/tags/v5.7-arrayanal/scripts/modules/chorodep/chorodep.ini
New file
0,0 → 1,40
; Ajouter les nouvelles version à la suite dans versions et versionsDonnees.
versions = "2011_04,2012_01,2013_07,2013_08,2013_11"
versionsDonnees="2011-04-05,2012-01-01,2013-07-22,2013-08-05,2013-11-13"
dossierTsv = "{ref:dossierDonneesEflore}chorodep/{ref:versionDonnees}/"
dossierTsvTpl = "{ref:dossierDonneesEflore}chorodep/%s/"
dossierSql = "{ref:dossierDonneesEflore}chorodep/"
chorodepChamps2011_04 = "rang, catminat, num_tax, num_nom, nom_sci, `01`, `02`, `03`, `04`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `67`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `79`, `24`, `25`, `26`, `91`, `27`, `28`, `29`, `30`, `32`, `33`, `31`, `43`, `52`, `05`, `70`, `74`, `65`, `87`, `68`, `92`, `34`, `35`, `36`, `37`, `38`, `39`, `40`, `42`, `44`, `45`, `41`, `46`, `47`, `48`, `49`, `50`, `51`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `60`, `61`, `75`, `62`, `63`, `66`, `64`, `69`, `71`, `72`, `73`, `77`, `76`, `93`, `80`, `81`, `82`, `90`, `94`, `95`, `83`, `84`, `85`, `86`, `88`, `89`, `78`, freq_abs, freq_rel, rare_nat";
chorodepChamps2012_01 = "rang, catminat, num_tax, num_nom, nom_sci, `01`, `02`, `03`, `04`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `67`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `79`, `24`, `25`, `26`, `91`, `27`, `28`, `29`, `30`, `32`, `33`, `31`, `43`, `52`, `05`, `70`, `74`, `65`, `87`, `68`, `92`, `34`, `35`, `36`, `37`, `38`, `39`, `40`, `42`, `44`, `45`, `41`, `46`, `47`, `48`, `49`, `50`, `51`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `60`, `61`, `75`, `62`, `63`, `66`, `64`, `69`, `71`, `72`, `73`, `77`, `76`, `93`, `80`, `81`, `82`, `90`, `94`, `95`, `83`, `84`, `85`, `86`, `88`, `89`, `78`, freq_abs, freq_rel, rare_nat";
chorodepChamps2013_07 = "rang, catminat,syntaxons, num_tax, num_nom, nom_sci, `01`, `02`, `03`, `04`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `67`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `79`, `24`, `25`, `26`, `91`, `27`, `28`, `29`, `30`, `32`, `33`, `31`, `43`, `52`, `05`, `70`, `74`, `65`, `87`, `68`, `92`, `34`, `35`, `36`, `37`, `38`, `39`, `40`, `42`, `44`, `45`, `41`, `46`, `47`, `48`, `49`, `50`, `51`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `60`, `61`, `75`, `62`, `63`, `66`, `64`, `69`, `71`, `72`, `73`, `77`, `76`, `93`, `80`, `81`, `82`, `90`, `94`, `95`, `83`, `84`, `85`, `86`, `88`, `89`, `78`, freq_abs, freq_rel, rare_nat";
chorodepChamps2013_08 = "rang, catminat,indication_phytosocio_caracteristique, num_tax, num_nom, nom_sci, chorologie, `01`, `02`, `03`, `04`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `67`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `79`, `24`, `25`, `26`, `91`, `27`, `28`, `29`, `30`, `32`, `33`, `31`, `43`, `52`, `05`, `70`, `74`, `65`, `87`, `68`, `92`, `34`, `35`, `36`, `37`, `38`, `39`, `40`, `42`, `44`, `45`, `41`, `46`, `47`, `48`, `49`, `50`, `51`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `60`, `61`, `75`, `62`, `63`, `66`, `64`, `69`, `71`, `72`, `73`, `77`, `76`, `93`, `80`, `81`, `82`, `90`, `94`, `95`, `83`, `84`, `85`, `86`, `88`, `89`, `78`, freq_abs, freq_rel, rare_nat";
chorodepChamps2013_11 = "rang, catminat,indication_phytosocio_caracteristique, num_tax, num_nom, nom_sci, chorologie, `01`, `02`, `03`, `04`, `06`, `07`, `08`, `09`, `10`, `11`, `12`, `67`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`, `22`, `23`, `79`, `24`, `25`, `26`, `91`, `27`, `28`, `29`, `30`, `32`, `33`, `31`, `43`, `52`, `05`, `70`, `74`, `65`, `87`, `68`, `92`, `34`, `35`, `36`, `37`, `38`, `39`, `40`, `42`, `44`, `45`, `41`, `46`, `47`, `48`, `49`, `50`, `51`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `60`, `61`, `75`, `62`, `63`, `66`, `64`, `69`, `71`, `72`, `73`, `77`, `76`, `93`, `80`, `81`, `82`, `90`, `94`, `95`, `83`, `84`, `85`, `86`, `88`, `89`, `78`, freq_abs, freq_rel, rare_nat";
 
 
[tables]
chorodepMeta = "chorodep_meta"
chorodepContributeurs = "chorodep_contributeurs"
chorodepSources = "chorodep_sources"
chorodepOntologies = "chorodep_ontologies"
chorodep = "chorodep_v{ref:version}"
chorodepTpl = "chorodep_v%s"
 
[fichiers]
structureSql = "chorodep.sql"
structureSqlVersion = "chorodep_v{ref:versionDonnees}.sql"
structureSqlVersionTpl = "chorodep_v%s.sql"
chorodepContributeurs = "chorodep_contributeurs.tsv"
chorodepSources = "chorodep_sources.tsv"
chorodepOntologies = "chorodep_ontologies.tsv"
chorodep = "chorodep_v{ref:versionDonnees}.tsv"
chorodepTpl = "chorodep_v%s.tsv"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
structureSqlVersion = "{ref:dossierTsv}{ref:fichiers.structureSqlVersion}"
structureSqlVersionTpl = "{ref:dossierTsvTpl}{ref:fichiers.structureSqlVersionTpl}"
chorodepContributeurs = "{ref:dossierSql}{ref:fichiers.chorodepContributeurs}"
chorodepSources = "{ref:dossierSql}{ref:fichiers.chorodepSources}"
chorodepOntologies = "{ref:dossierSql}{ref:fichiers.chorodepOntologies}"
chorodep = "{ref:dossierTsv}{ref:fichiers.chorodep}"
chorodepTpl = "{ref:dossierTsvTpl}{ref:fichiers.chorodepTpl}"
/tags/v5.7-arrayanal/scripts/modules/chorodep/Chorodep.php
New file
0,0 → 1,629
<?php
// /opt/lampp/bin/php cli.php chorodep -a chargerVersions
class Chorodep extends EfloreScript {
protected $nbre_dep = 0;
private $type_donnee = '';
protected $aso_num_nomenc = array();
protected $nbre_ligne = 0;
protected $nbre_plte_presente = 0;
protected $nbre_plte_a_confirmer = 0;
protected $nbre_plte_douteux = 0;
protected $nbre_plte_erreur = 0;
protected $nbre_plte_disparue = 0;
protected $nbre_plte_erreur_a_confirmer = 0;
protected $nc_autres_valeur_champ = 0;
protected $nc_nbre_plte_presente = 0;
protected $nc_nbre_plte_a_confirmer = 0;
protected $nc_nbre_plte_douteux = 0;
protected $nc_nbre_plte_disparue = 0;
protected $nc_nbre_plte_erreur = 0;
protected $nc_nbre_plte_erreur_a_confirmer = 0;
 
protected $aso_totaux_dep = array();
private $fichier_verif = './chorodep_verif.html';
 
public function executer() {
try {
$this->initialiserProjet('chorodep');
 
// Lancement de l'action demandée
$cmd = $this->getParametre('a');
switch ($cmd) {
 
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerVersions();
$this->chargerChorodepContributeurs();
$this->chargerChorodepSources();
$this->chargerChorodepOntologies();
break;
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'chargerVersions' :
$this->chargerVersions();
break;
case 'chargerChorodep' :
$this->chargerChorodepContributeurs();
$this->chargerChorodepSources();
$this->chargerChorodepOntologies();
break;
case 'verifierDonnees' :
$this->initialiserTraitement();
$this->verifierDonnees();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
private function chargerChorodepContributeurs() {
$chemin = Config::get('chemins.chorodepContributeurs');
$table = Config::get('tables.chorodepContributeurs');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
'IGNORE 2 LINES';
$this->getBdd()->requeter($requete);
}
 
private function chargerChorodepSources() {
$chemin = Config::get('chemins.chorodepSources');
$table = Config::get('tables.chorodepSources');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
'IGNORE 2 LINES';
$this->getBdd()->requeter($requete);
}
 
private function chargerChorodepOntologies() {
$chemin = Config::get('chemins.chorodepOntologies');
$table = Config::get('tables.chorodepOntologies');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
'IGNORE 1 LINES';
$this->getBdd()->requeter($requete);
}
 
private function chargerVersions() {
$versions = explode(',', Config::get('versions'));
$versionsDonnees = explode(',', Config::get('versionsDonnees'));
foreach ($versions as $id => $version) {
$versionDonnees = $versionsDonnees[$id];
$this->chargerStructureSqlVersion($versionDonnees);
$this->chargerDonneesVersion($versionDonnees, $version);
}
}
 
private function chargerStructureSqlVersion($versionDonnees) {
$fichierSqlTpl = Config::get('chemins.structureSqlVersionTpl');
$fichierSql = sprintf($fichierSqlTpl, $versionDonnees, $versionDonnees);
$contenuSql = $this->recupererContenu($fichierSql);
$this->executerScripSql($contenuSql);
}
 
private function chargerDonneesVersion($versionDonnees, $version) {
$fichierTsvTpl = Config::get('chemins.chorodepTpl');
$fichierTsv = sprintf($fichierTsvTpl, $versionDonnees, $versionDonnees);
$tableTpl = Config::get('tables.chorodepTpl');
$table = sprintf($tableTpl, $version);
$champs = Config::get('chorodepChamps'.$version);
$requete = "LOAD DATA INFILE '$fichierTsv' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
"($champs) ";
$this->getBdd()->requeter($requete);
}
 
private function initialiserTraitement() {
//------------------------------------------------------------------------------------------------------------//
// Récupération des informations à vérifier
$table = $this->getNomTableDernierVersion();
$requete = 'SELECT * '.
"FROM $table ";
$taxons = $this->getBdd()->recupererTous($requete);
$tax_col = $taxons[1];
$col = array_keys($tax_col);
$this->initialiserTableaux($col);
//------------------------------------------------------------------------------------------------------------//
// Analyse des données
echo 'Traitement de la ligne n° :';
$i = 0;
$j = 0;
$aso_departements_analyses = array();
$this->nbre_ligne_avec_guillemet = 0;
foreach ($taxons as $aso_champs) {
$nom = $aso_champs['nom_sci'];
$num_taxo = $aso_champs['num_tax'];
$num_nomenc = $aso_champs['num_nom'];
if ($num_nomenc == 'nc') {
$this->nc_nbre_nom++;
} else if ($num_nomenc != 'nc') {
$this->nbre_nom++;
// Vérification de la nom duplication des numéros nomenclaturaux
if ( !array_key_exists($num_nomenc, (array) $this->aso_num_nomenc) ) {
$this->aso_num_nomenc[$num_nomenc]['compteur'] = 1;
$this->aso_num_nomenc[$num_nomenc]['ligne'] = ($this->nbre_ligne+1);
} else {
$this->aso_num_nomenc[$num_nomenc]['compteur']++;
$this->aso_num_nomenc[$num_nomenc]['ligne'] .= ' - '.($this->nbre_ligne+1);
}
}
foreach ($aso_champs as $cle => $val ) {# Pour chaque département du taxon, on regarde la valeur
$this->nbre_ligne_avec_guillemet += preg_match('/"/', $val);
if ( preg_match('/^\d{2}$/', $cle) ) {# Nous vérifions que le nom du champs comprend bien le numéro du département entre ()
$nd = $cle;# Numéro du département
// Nous comptons le nombre de département en base de données
if (!isset($aso_departements_analyses[$nd])) {
$this->nbre_dep_analyse++;
$aso_departements_analyses[$nd] = $nd;
}
if ( $num_nomenc != 'nc' && isset($val) && $val != '') {# Si le taxon n'est pas abscent du département
if ($val == '1') {# Présent
// Calcul du nombre de plante ayant un statut "Présent"
$this->nbre_plte_presente++;
// Stockage par département du nombre de plante ayant un statut "Présent"
$this->aso_totaux_dep[$nd]['plte_presente']++;
// Stockage des informations
$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 3, $this->id_donnee_choro++);
} else if ($val == '1?') {# Présence à confirmer
// Calcul du nombre de plante ayant un statut "Présence à confirmer"
$this->nbre_plte_a_confirmer++;
// Stockage par département du nombre de plante ayant un statut "Présence à confirmer"
$this->aso_totaux_dep[$nd]['plte_a_confirmer']++;
// Stockage des informations
$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 4, $this->id_donnee_choro++);
} else if (preg_match('/^\s*(?:\?)\s*$/', $val)) {# Douteux
// Calcul du nombre de plante ayant un statut "Disparu ou douteux"
$this->nbre_plte_douteux++;
// Stockage par département du nombre de plante ayant un statut "Douteux"
$this->aso_totaux_dep[$nd]['plte_douteux']++;
// Stockage des informations
$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 5, $this->id_donnee_choro++);
if (preg_match('/(?: \?|\? | \? )/', $val)) {# Douteux
// Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "?".
$this->autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} elseif (preg_match('/^\s*(?:#)\s*$/', $val)) {# Erreur
# Calcul du nombre de plante ayant un statut "Erreur"
$this->nbre_plte_erreur++;
# Stockage par département du nombre de plante ayant un statut "Erreur"
$this->aso_totaux_dep[$nd]['plte_erreur']++;
# Stockage des informations
$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
if (preg_match('/(?: #|# | # )/', $val)) {# Erreur avec espace
# Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#".
$autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} elseif (preg_match('/^\s*(?:-\|-)\s*$/', $val)) {# Disparu
# Calcul du nombre de plante ayant un statut "Disparu"
$this->nbre_plte_disparue++;
# Stockage par département du nombre de plante ayant un statut "Disparu"
$this->aso_totaux_dep[$nd]['plte_disparue']++;
# Stockage des informations
$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
if (preg_match('/(?: -\|-|-\|- | -\|- )/', $val)) {# Disparu avec espace
# Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "-|-".
$autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} elseif (preg_match('/^\s*(?:#\?)\s*$/', $val)) {# Erreur à confirmer
# Calcul du nombre de plante ayant un statut "Erreur à confirmer"
$this->nbre_plte_erreur_a_confirmer++;
# Stockage par département du nombre de plante ayant un statut "Erreur à confirmer"
$this->aso_totaux_dep[$nd]['plte_erreur_a_confirmer']++;
# Stockage des informations
$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
if (preg_match('/^(?:\s+#\?|#\?\s+|\s+#\?\s+)$/', $val)) {# Erreur à confirmer avec espace
# Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#?".
$autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} else {
// Ajout de la valeur dans une variable car elle n'est pas conforme.
$this->autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
$j++;
} else if (isset($val) && $val != '') {
if ($val == '1') {# Présent
// Calcul du nombre de plante 'nc' ayant un statut "Présent"
$this->nc_nbre_plte_presente++;
// Stockage par département du nombre de plante 'nc' ayant un statut "Présent"
$this->aso_totaux_dep[$nd]['nc_plte_presente']++;
} elseif ($val == '1?') {# Présence à confirmer
// Calcul du nombre de plante 'nc' ayant un statut "Présence à confirmer"
$this->nc_nbre_plte_a_confirmer++;
// Stockage par département du nombre de plante 'nc' ayant un statut "Présence à confirmer"
$this->aso_totaux_dep[$nd]['nc_plte_a_confirmer']++;
} elseif (preg_match('/^(?:\?| \?|\? | \?)$/', $val)) {# Douteux
// Calcul du nombre de plante 'nc' ayant un statut "Douteux"
$this->nc_nbre_plte_douteux++;
// Stockage par département du nombre de plante 'nc' ayant un statut "Douteux"
$this->aso_totaux_dep[$nd]['nc_plte_douteux']++;
if (preg_match('/(?: \?|\? | \? )/', $val)) {# Douteux
// Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "?".
$this->nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} elseif (preg_match('/^(?:#| #|# | # )$/', $val)) {# Erreur
# Calcul du nombre de plante 'nc' ayant un statut "Erreur"
$this->nc_nbre_plte_erreur++;
# Stockage par département du nombre de plante 'nc' ayant un statut "Erreur"
$this->aso_totaux_dep[$nd]['nc_plte_erreur']++;
if (preg_match('/(?: #|# | # )/', $val)) {# Erreur avec espace
# Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#".
$nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} elseif (preg_match('/^\s*(?:-\|-)\s*$/', $val)) {# Disparu
# Calcul du nombre de plante 'nc' ayant un statut "Disparu"
$this->nc_nbre_plte_disparue++;
# Stockage par département du nombre de plante 'nc' ayant un statut "Disparu"
$this->aso_totaux_dep[$nd]['nc_plte_disparue']++;
if (preg_match('/(?: -\|-|-\|- | -\|- )/', $val)) {# Disparu avec espace
# Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "-|-".
$nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} elseif (preg_match('/^\s*(?:#\?)\s*$/', $val)) {# Erreur à confirmer
# Calcul du nombre de plante 'nc' ayant un statut "Erreur à confirmer"
$this->nc_nbre_plte_erreur_a_confirmer++;
# Stockage par département du nombre de plante 'nc' ayant un statut "Erreur à confirmer"
$this->aso_totaux_dep[$nd]['nc_plte_erreur_a_confirmer']++;
if (preg_match('/^(?:\s+#\?|#\?\s+|\s+#\?\s+)$/', $val)) {# Erreur à confirmer avec espace
# Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#?".
$nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
} else {
// Ajout de la valeur dans une variable car elle n'est pas conforme.
$this->nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
}
}
// Affichage dans la console du numéro de l'enregistrement analysé.
//echo str_repeat(chr(8), ( strlen( $i ) + 1 ))."\t".$i++;
}
}// fin du foreach
// Affichage dans la console du numéro de l'enregistrement analysé.
echo str_repeat(chr(8), ( strlen( $this->nbre_ligne ) + 1 ))."\t".$this->nbre_ligne++;
}
echo "\n";
}
 
private function initialiserTableaux($dep) {
foreach ($dep as $code_dep) {
if ( preg_match('/^\d{2}$/', $code_dep) ) {
$this->aso_totaux_dep[$code_dep]['plte_presente'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_douteux'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_erreur'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_disparue'] = 0;
$this->aso_totaux_dep[$code_dep]['plte_erreur_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['autres_valeur_champ'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_presente'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_douteux'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_erreur'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_disparue'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_plte_erreur_a_confirmer'] = 0;
$this->aso_totaux_dep[$code_dep]['nc_autres_valeur_champ'] = 0;
}
}
}
 
private function verifierDonnees() {
// Ouverture du fichier contenant les résultats (sortie)
if (!$handle = fopen($this->fichier_verif, 'w')) {
echo "Impossible d'ouvrir le fichier ($this->fichier_verif)";
exit;
}
 
// Création de la page
$page = '<html>'."\n";
$page .= '<head>'."\n";
$page .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\n";
$page .= '<title>RESULTAT DE LA VERIFICATION DU FICHIER TABULE DE LA CHOROLOGIE</title>'."\n";
$page .= '</head>'."\n";
$page .= '<body>'."\n";
$page .= '<h1>RESULTAT DE LA VERIFICATION DU FICHIER TABULE DE LA CHOROLOGIE</h1>'."\n";
$page .= '<hr/>'."\n";
$page .= '<p>'.
'Adresse fichier analysé : '.'<br />'."\n".
'</p>'."\n";
$page .= '<hr/>'."\n";
$page .= '<h2>RESULTATS PROGRAMME DE VERIFICATION</h2>'."\n";
$page .= '<p>'.
'Nom du programme générant ce fichier : '.__FILE__.'<br />'."\n".
'Nombre de lignes analysées : '.$this->nbre_ligne.'<br />'."\n".
'Nbre de départements analysés : '.$this->nbre_dep_analyse.'<br />'."\n".
'Date d\'exécution du programme : '.date('d.m.Y').'<br />'."\n".
'</p>'."\n";
$page .= '<hr/>'."\n";
$page .= '<h2>RESULTATS ANALYSE CHOROLOGIE</h2>'."\n";
$page .= '<p>'.
'Nombre de nom "nc" : '.$this->nc_nbre_nom.'<br />'."\n".
'Nombre de nom : '.$this->nbre_nom.'<br />'."\n".
'Valeurs autres que 1, 1?, ?, #, #? et -|- : '.$this->autres_valeur_champ.'<br />'."\n".
'Valeurs autres que 1, 1?, ?, #, #? et -|- pour les plantes nc : <br />'."\n".$this->nc_autres_valeur_champ.'</br>'."\n".
'</p>'."\n";
$page .= '<hr/>'."\n";
$page .= '<h2>RESULTATS ANALYSE des CHAMPS</h2>'."\n";
$page .= '<p>'.
'Nombre de guillemets antislashés: '.$this->nbre_ligne_avec_guillemet.'<br />'."\n".
'</p>'."\n";
$page .= '<hr/>'."\n";
$page .= '<h2>TABLEAUX</h2>'."\n";
 
// Tableau des numéros nomenclaturaux dupliqués
$table = '<table><thead><tr><th colspan="3">Tableau des numéros nomenclaturaux dupliqués </th></tr>';
$table .= '<tr><th>Numéro nomenclatural</th><th>Nbre d\'itération</th><th>Lignes</th></tr></thead>';
$afficher_tab_num_duplique = 0;
ksort($this->aso_num_nomenc);
$table .= '<tbody style="text-align: center;">';
foreach ($this->aso_num_nomenc as $cle_nomenc => $val ) {
$ligne = '<tr><td>'.$cle_nomenc.'</td><td>'.$val['compteur'].'</td><td>'.$val['ligne'].'</td></tr>';
if ($val['compteur'] > 1) {
$table .= $ligne;
$afficher_tab_num_duplique = 1;
}
}
if ( $afficher_tab_num_duplique == 1 ) {
$page .= $table.'</tbody></table>';
}
 
// Tableau des résultats par départements
$table = '<table><thead><tr><th colspan="14">Tableau des résulats par départements</th></tr>';
$table .= '<tr><th>Département</th><th>Nbre pltes présentes</th><th>Nbre pltes à confirmer</th>'.
'<th>Nbre pltes douteuses</th><th>Nbre pltes disparues</th><th>Nbre pltes erreur</th><th>Nbre pltes erreur à confirmer</th>'.
'<th>Total</th><th>Nbre pltes nc présentes</th><th>Nbre pltes nc à confirmer</th>'.
'<th>Nbre nc pltes douteuses</th><th>Nbre nc pltes disparues</th><th>Nbre nc pltes erreur</th><th>Nbre nc pltes erreur à confirmer</th></tr></thead>';
$table .= '<tbody style="text-align: center;">';
ksort($this->aso_totaux_dep);
foreach ($this->aso_totaux_dep as $cle_dep => $val ) {
$plt_total = $val{'plte_presente'} + $val{'plte_a_confirmer'} + $val{'plte_douteux'} + $val{'plte_disparue'} + $val{'plte_erreur'} + $val{'plte_erreur_a_confirmer'};
$table .= '<tr><td>'.ZgFrDepartements::getNom($cle_dep).' ('.ZgFrDepartements::getIdChaine($cle_dep).') </td>'.
'<td>'.$val{'plte_presente'}.'</td><td>'.$val{'plte_a_confirmer'}.'</td><td>'.$val{'plte_douteux'}.'</td>'.
'<td>'.$val{'plte_disparue'}.'</td><td>'.$val{'plte_erreur'}.'</td><td>'.$val{'plte_erreur_a_confirmer'}.'</td><td>'.$plt_total.'</td>'.
'<td>'.$val{'nc_plte_presente'}.'</td><td>'.$val{'nc_plte_a_confirmer'}.'</td><td>'.$val{'nc_plte_douteux'}.'</td>'.
'<td>'.$val{'nc_plte_disparue'}.'</td><td>'.$val{'nc_plte_erreur'}.'</td><td>'.$val{'nc_plte_erreur_a_confirmer'}.'</td></tr>';
}
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur + $this->nbre_plte_erreur_a_confirmer;
$table .= '<tr><td>Totaux : '.$this->nbre_dep_analyse.' départements</td><td>'.$this->nbre_plte_presente.'</td>'.
'<td>'.$this->nbre_plte_a_confirmer.'</td><td>'.$this->nbre_plte_douteux.'</td><td>'.$this->nbre_plte_disparue.'</td>'.
'<td>'.$this->nbre_plte_erreur.'</td><td>'.$this->nbre_plte_erreur_a_confirmer.'</td><td>'.$plt_total.'</td>'.
'<td>'.$this->nc_nbre_plte_presente.'</td>'.'<td>'.$this->nc_nbre_plte_a_confirmer.'</td>'.
'<td>'.$this->nc_nbre_plte_douteux.'</td><td>'.$this->nc_nbre_plte_disparue.'</td><td>'.$this->nc_nbre_plte_erreur.'</td><td>'.$this->nc_nbre_plte_erreur_a_confirmer.'</td></tr>';
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$total_nbre_plte = ($this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur + $this->nbre_plte_erreur_a_confirmer);
$total_nbre_plte_nc = ($this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nc_nbre_plte_douteux + $this->nc_nbre_plte_disparue + $this->nc_nbre_plte_erreur + $this->nc_nbre_plte_erreur_a_confirmer);
$table .= '<tr><td>Totaux plante / plante nc</td><td colspan="7">'.$total_nbre_plte.'</td>'.
'<td colspan="6">'.$total_nbre_plte_nc.'</td></tr>';
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $this->nbre_plte_presente + $this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nbre_plte_a_confirmer;
$table .= '<tr><td>Total plantes présentes et à confirmer</td><td colspan="13">'.$plt_total.'</td></tr>';
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $this->nbre_plte_presente + $this->nc_nbre_plte_presente;
$table .= '<tr><td>Total plantes présentes</td><td colspan="13">'.$plt_total.'</td></tr>';
 
$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$plt_total = $total_nbre_plte + $total_nbre_plte_nc;
$table .= '<tr><td>Total données chorologiques</td><td colspan="13">'.$plt_total.'</td></tr>';
 
$table .= '</tbody></table>';
$page .= $table;
 
$page .= '<hr/>'."\n";
$page .= '<h2>NOTES</h2>'."\n";
$page .= '<p>'.
'1.- Chaque champ précédé par "ATTENTION" doit être vide.'."\n".
'S\'il ne l\'est pas, il y a une erreur'."\n".
'</p>'."\n";
$page .= '</body>'."\n";
$page .= '</html>'."\n";
// Fermeture de la poignée sur le fichier de sortie
if (fwrite($handle, $page) === FALSE) {
echo "Impossible d'écrire dans le fichier ($this->fichier_verif)";
exit;
}
echo 'Ecriture du fichier de vérification de la chorologie réalisée!'."\n";
fclose($handle);
}
 
private function supprimerTous() {
$tablesChorodep = implode(',', $this->getNomsTablesChorodep());
$tableContributeurs = Config::get('tables.chorodepContributeurs');
$tableSources = Config::get('tables.chorodepSources');
$tableOntologies = Config::get('tables.chorodepOntologies');
$requete = "DROP TABLE IF EXISTS chorodep_meta, $tablesChorodep, $tableContributeurs, $tableSources, $tableOntologies ";
$this->getBdd()->requeter($requete);
}
 
private function getNomsTablesChorodep() {
$versions = explode(',', Config::get('versions'));
$tableTpl = Config::get('tables.chorodepTpl');
$tablesChorodep = array();
foreach ($versions as $version) {
$tablesChorodep[] = sprintf($tableTpl, $version);
}
return $tablesChorodep;
}
 
private function getNomTableDernierVersion() {
$version = $this->getDerniereVersion();
$table = sprintf(Config::get('tables.chorodepTpl'), $version);
return $table;
}
 
private function getDerniereVersion() {
$version = array_pop(explode(',', Config::get('versions')));
return $version;
}
}
 
class ZgFrDepartements {
static private $departements =
array(
"01" => array("Ain", "01", 1),
"02" => array("Aisne", "02", 2),
"03" => array("Allier", "03", 3),
"04" => array("Alpes-de-Haute-Provence", "04", 4),
"05" => array("Hautes-Alpes", "05", 5),
"06" => array("Alpes-Maritimes", "06", 6),
"07" => array("Ardèche", "07", 7),
"08" => array("Ardennes", "08", 8),
"09" => array("Ariège", "09", 9),
"10" => array("Aube", "10", 10),
"11" => array("Aude", "11", 11),
"12" => array("Aveyron", "12", 12),
"13" => array("Bouches-du-Rhône", "13", 13),
"14" => array("Calvados", "14", 14),
"15" => array("Cantal", "15", 15),
"16" => array("Charente", "16", 16),
"17" => array("Charente-Maritime", "17", 17),
"18" => array("Cher", "18", 18),
"19" => array("Corrèze", "19", 19),
"20" => array("Corse", "20", 20),
"2A" => array("Haute-Corse", "2A", 20),
"2B" => array("Corse-du-Sud", "2B", 20),
"21" => array("Côte-d'Or", "21", 21),
"22" => array("Côtes-d'Armor", "22", 22),
"23" => array("Creuse", "23", 23),
"24" => array("Dordogne", "24", 24),
"25" => array("Doubs","25", 25),
"26" => array("Drôme", "26", 26),
"27" => array("Eure", "27", 27),
"28" => array("Eure-et-Loir", "28", 28),
"29" => array("Finistère", "29", 29),
"30" => array("Gard", "30", 30),
"31" => array("Haute-Garonne", "31", 31),
"32" => array("Gers", "32", 32),
"33" => array("Gironde", "33", 33),
"34" => array("Hérault", "34", 34),
"35" => array("Ille-et-Vilaine", "35", 35),
"36" => array("Indre", "36", 36),
"37" => array("Indre-et-Loire", "37", 37),
"38" => array("Isère", "38", 38),
"39" => array("Jura", "39", 39),
"40" => array("Landes", "40", 40),
"41" => array("Loir-et-Cher", "41", 41),
"42" => array("Loire", "42", 42),
"43" => array("Haute-Loire", "43", 43),
"44" => array("Loire-Atlantique", "44", 44),
"45" => array("Loiret", "45", 45),
"46" => array("Lot", "46", 46),
"47" => array("Lot-et-Garonne", "47", 47),
"48" => array("Lozére ", "48", 48),
"49" => array("Maine-et-Loire", "49", 49),
"50" => array("Manche", "50", 50),
"51" => array("Marne", "51", 51),
"52" => array("Haute-Marne", "52", 52),
"53" => array("Mayenne", "53", 53),
"54" => array("Meurthe-et-Moselle", "54", 54),
"55" => array("Meuse", "55", 55),
"56" => array("Morbihan", "56", 56),
"57" => array("Moselle", "57", 57),
"58" => array("Nièvre", "58", 58),
"59" => array("Nord", "59", 59),
"60" => array("Oise", "60", 60),
"61" => array("Orne", "61", 61),
"62" => array("Pas-de-Calais", "62", 62),
"63" => array("Puy-de-Dôme", "63", 63),
"64" => array("Pyrénées-Atlantiques", "64", 64),
"65" => array("Hautes-Pyrénées", "65", 65),
"66" => array("Pyrénées-Orientales", "66", 66),
"67" => array("Bas-Rhin", "67", 67),
"68" => array("Haut-Rhin", "68", 68),
"69" => array("Rhône", "69", 69),
"70" => array("Haute-Saône", "70", 70),
"71" => array("Saône-et-Loire", "71", 71),
"72" => array("Sarthe", "72", 72),
"73" => array("Savoie", "73", 73),
"74" => array("Haute-Savoie", "74", 74),
"75" => array("Paris", "75", 75),
"76" => array("Seine-Maritime", "76", 76),
"77" => array("Seine-et-Marne", "77", 77),
"78" => array("Yvelines", "78", 78),
"79" => array("Deux-Sèvres", "79", 79),
"80" => array("Somme", "80", 80),
"81" => array("Tarn", "81", 81),
"82" => array("Tarn-et-Garonne", "82", 82),
"83" => array("Var", "83", 83),
"84" => array("Vaucluse", "84", 84),
"85" => array("Vendée", "85", 85),
"86" => array("Vienne", "86", 86),
"87" => array("Haute-Vienne", "87", 87),
"88" => array("Vosges", "88", 88),
"89" => array("Yonne", "89", 89),
"90" => array("Territoire-de-Belfort", "90", 90),
"91" => array("Essonne", "91", 91),
"92" => array("Hauts-de-Seine", "92", 92),
"93" => array("Seine-Saint-Denis", "93", 93),
"94" => array("Val-de-Marne", "94", 94),
"95" => array("Val-d'Oise", "95", 95),
"96" => array("aaa", "96", 96),
"971" => array("Guadeloupe", "971", 971),
"972" => array("Martinique", "972", 972),
"973" => array("Guyane", "973", 973),
"974" => array("Réunion", "974", 974),
"99" => array("Etranger", "99", 99),
);
 
static public function get() {
return self::$departements;
}
 
static public function getNom($n) {
return self::$departements[$n][0];
}
 
static public function getIdChaine($n) {
return self::$departements[$n][1];
}
 
static public function getIdNumerique($n) {
return (int)self::$departements[$n][2];
}
 
static public function getIdEflore($n) {
return (int)self::$departements[$n][3];
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/apd/apd.ini
New file
0,0 → 1,18
version="3_4_0"
dossierapd = "{ref:dossierDonneesEflore}apd/{ref:version}/"
 
[tables]
apdMeta = "apd_meta"
apd = "apd_v{ref:version}"
 
[fichiers]
structureSql = "apd_v{ref:version}.sql"
csvCjbg = "apd_v{ref:version}.csv"
csvRtax = "apd_v{ref:version}_rtax.csv"
csvRtaxModifie = "apd_v{ref:version}_rtax_modifie.csv"
 
[chemins]
structureSql = "{ref:dossierapd}{ref:fichiers.structureSql}"
csvCjbg = "{ref:dossierapd}{ref:fichiers.csvCjbg}"
csvRtax = "{ref:dossierapd}{ref:fichiers.csvRtax}"
csvRtaxModifie = "{ref:dossierapd}{ref:fichiers.csvRtaxModifie}"
/tags/v5.7-arrayanal/scripts/modules/apd/Apd.php
New file
0,0 → 1,719
<?php
//declare(encoding='UTF-8');
/**
* Exemple de lancement du script : :
* /opt/lampp/bin/php cli.php apd -a chargerTous
*
* Base de données des Trachéophytes (trachéo...quoi ?? C'est le truc avec le stylo Bic ?)
* d'Afrique de l'Ouest (et Centrale mais faut pas le dire)
*
* @category php 5.2
* @package eFlore/Scripts
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @copyright Copyright (c) 2014, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
*/
class Apd extends EfloreScript {
 
private $table = null;
private $tableMeta = null;
private $pasInsertion = 1000;
private $departInsertion = 0;
 
protected $parametres_autorises = array();
 
// Entêtes du nouveau fichier Rtax à produire
protected $entetesRtax = array("num_nom","num_nom_retenu","num_tax_sup","rang","nom_sci",
"nom_supra_generique","genre","epithete_infra_generique","epithete_sp",
"type_epithete","epithete_infra_sp","cultivar_groupe","cultivar","nom_commercial",
"auteur","annee","biblio_origine","notes","nom_addendum","homonyme","num_type",
"num_basionyme","synonyme_proparte","synonyme_douteux","synonyme_mal_applique",
"synonyme_orthographique","orthographe_originelle","hybride_parent_01",
"hybride_parent_01_notes","hybride_parent_02","hybride_parent_02_notes",
"nom_francais","presence","statut_origine ","statut_introduction","statut_culture","exclure_taxref");
 
public function initialiserProjet($projetNom) {
parent::initialiserProjet($projetNom);
$this->table = Config::get("apd");
$this->tableMeta = Config::get("apdMeta");
}
 
public function executer() {
try {
$this->initialiserProjet('apd');
 
// Lancement de l'action demandée
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'tout' :
$ok = $this->productionCsvPourReferentiels();
if ($ok === true) {
$this->integrationEFlore();
}
break;
case 'ref' : // partie 1 : "referentiels"
$this->productionCsvPourReferentiels();
break;
case 'eflore' : // partie 2 : "eFlore"
$this->integrationEFlore();
break;
case 'nettoyage' :
$this->nettoyage();
break;
case 'chargerStructureSql' :
//$this->creerStructure();
$this->chargerStructureSql();
break;
case 'verifierEtGenererCsvRtax' :
$this->verifierEtGenererCsvRtax();
break;
case 'chargerCsvRtax' :
$this->chargerCsvRtax();
break;
case 'changerRangs' :
$this->changerRangs();
break;
case 'completerNumNomRetenu' :
$this->completerNumNomRetenu();
break;
case 'supprimerNumTaxSupPourSynonymes' :
$this->supprimerNumTaxSupPourSynonymes();
break;
case 'subspAutonymes' :
$this->subspAutonymes();
break;
case 'genererNomSupraGenerique' :
$this->genererNomSupraGenerique();
break;
case 'genererEpitheteInfraGenerique' :
$this->genererEpitheteInfraGenerique();
break;
case 'exporterCSVModifie' :
$this->exporterCSVModifie();
break;
case 'genererChpNumTax' :
$this->genererChpNumTax();
break;
case 'genererNomSciHtml' :
$this->genererChpNomSciHtml();
break;
case 'genererChpNomComplet' :
$this->genererChpNomComplet();
break;
case 'genererChpFamille' :
$this->genererChpFamille();
break;
case 'genererChpHierarchie' :
$this->genererChpHierarchie();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
// Lance la première moitié du boulot, et s'arrête lorsque le fichier CSV
// au format Rtax est rempli avec les données amendées - il est prêt à rentrer dans Rtxß.
// Retourne true si tout s'est bien passé, false sinon
protected function productionCsvPourReferentiels() {
$retour = false;
$this->nettoyage();
$this->chargerStructureSql();
$verifOk = $this->verifierEtGenererCsvRtax();
if ($verifOk === true) {
$chgtOk = $this->chargerCsvRtax();
if ($chgtOk) {
$this->changerRangs();
$this->completerNumNomRetenu();
$this->supprimerNumTaxSupPourSynonymes();
$this->subspAutonymes();
$this->genererNomSupraGenerique();
$this->genererEpitheteInfraGenerique();
$this->exporterCSVModifie();
$retour = true;
}
}
return $retour;
}
 
// Lance la seconde moitié du boulot, et s'arrête lorsque le référentiel
// est inséré dans la base eFlore.
// Retourne true si tout s'est bien passé, false sinon
protected function integrationEFlore() {
$retour = false;
$this->genererChpNumTax();
$this->genererChpNomSciHtml();
$this->genererChpFamille();
$this->genererChpNomComplet();
$this->genererChpHierarchie();
$retour = true;
return $retour;
}
 
// -------------- partie Rtax -------------
 
// Dézingue tout le bousin
protected function nettoyage() {
echo "---- suppression des tables\n";
$req = "DROP TABLE IF EXISTS `" . $this->table . "`";
$this->getBdd()->requeter($req);
$req = "DROP TABLE IF EXISTS `" . $this->tableMeta . "`;";
$this->getBdd()->requeter($req);
}
 
// Analyse le fichier CSV fourni par le CJBG, le vérifie et écrit un CSV minimal au format Rtax
function verifierEtGenererCsvRtax() {
$cheminCsvRtax = Config::get('chemins.csvRtax');
$cheminCsvCjbg = Config::get('chemins.csvCjbg');
$retour = false;
echo "---- vérification CSV CJBG [$cheminCsvCjbg] et génération CSV Rtax\n";
 
// Correspondances de colonnes pour le remplissage à minima du fichier CSV Rtax
// Clefs: CJBG
// Valeurs: Rtax
$entetesCjbgVersRtax = array(
"id_name" => "num_nom",
"presence" => "presence",
"statut_introduction" => "statut_introduction",
"statut_origine" => "statut_origine",
"nom_addendum" => "nom_addendum",
"BASIONYME" => "num_basyonyme",
"NO_RANG" => "rang",
"auteur" => "auteur",
"ANNEE" => "annee",
"type_epithete" => "type_epithete",
"SYN_mal_applique" => "synonyme_mal_applique",
"nom_sci" => "nom_sci",
"num_tax_sup" => "num_tax_sup",
"num_nom_retenu" => "num_nom_retenu",
"genre" => "genre",
"NOTES" => "notes",
"epithete_sp" => "epithete_sp",
"epithete_infra_sp" => "epithete_infra_sp",
// champs additionnels
"NOM_STANDARD2" => false,
"STATUT_SYN" => false, // @TODO convertir
"hybride_parents" => false, // toujours "x" => ??
"FAM APG3" => false,
"auth_genre" => false,
"auth_esp" => false
);
 
$analyseOK = true;
$numLigne = 1;
$idNames = array();
// lecture CSV d'origine
$csv = fopen($cheminCsvCjbg, "r");
$donneesTransformees = array();
if ($csv) {
$entetes = fgetcsv($csv);
//echo "Entetes: " . print_r($entetes, true) . "\n";
while(($ligne = fgetcsv($csv)) !== false) {
$numLigne++;
$nouvelleLigne = array();
if (isset($idNames[$ligne[0]])) {
echo "Entrée dupliquée pour id_name [" . $ligne[0] . "]\n";
$analyseOK = false;
} else if (! is_numeric($ligne[0])) {
echo "Ligne $numLigne : la clef [" . $ligne[0] . "] n'est pas un entier\n";
$analyseOK = false;
} else if ($ligne[0] == 0) {
echo "Ligne $numLigne : la clef [" . $ligne[0] . "] vaut zéro\n";
$analyseOK = false;
} else {
$idNames[$ligne[0]] = $ligne[13]; // stockage du nom retenu
foreach ($ligne as $idx => $col) {
$entete = $entetes[$idx];
$ert = $entetesCjbgVersRtax[$entete];
if (strpos($col, "\n") > -1) {
echo "Info: la colonne $ert de la ligne $numLigne contient des retours chariot. Conversion en espaces.\n";
$col = str_replace("\n", " ", $col);
}
$nouvelleLigne[$ert] = $col;
}
$donneesTransformees[] = $nouvelleLigne;
}
}
} else {
echo "Erreur lors de l'ouverture du fichier\n";
}
 
// Vérifications:
// - existence des num_nom_retenu et num_tax_sup mentionnés
// - réduction des chaînes de synonymie
$nnrManquants = array();
$ntsManquants = array();
$chaineSyn = array();
foreach ($donneesTransformees as $ligne) {
$taxSup = $ligne['num_tax_sup'];
$nomRet = $ligne['num_nom_retenu'];
$numNom = $ligne['num_nom'];
// Si un nom est retenu, son taxon supérieur doit être mentionné et exister
if (($numNom == $nomRet) && $taxSup && (! isset($idNames[$taxSup])) && (! isset($ntsManquants[$taxSup]))) {
$ntsManquants[$taxSup] = true;
}
// Si un nom retenu est mentionné, il doit exister et être un nom retenu
if ($nomRet) {
if (isset($idNames[$nomRet])) {
/*$nrnr = $idNames[$nomRet];
echo "Test pour nn $numNom, nr $nomRet, " . $nrnr . "\n";
if ($nomRet && $nrnr != $nomRet) {
if (! isset($chaineSyn[$nomRet])) {
$chaineSyn[$nomRet] = true;
}
}*/
} else {
if (! isset($nnrManquants[$nomRet])) {
$nnrManquants[$nomRet] = true;
}
}
}
}
if (count($nnrManquants) > 0) {
echo count($nnrManquants) . " Nom(s) retenu(s) absent(s):\n";
echo "(" . implode(",", array_keys($nnrManquants)) . ")\n";
}
if (count($ntsManquants) > 0) {
echo count($ntsManquants) . " Taxon(s) supérieur(s) absent(s):\n";
echo "(" . implode(",", array_keys($ntsManquants)) . ")\n";
}
/*if (count($chaineSyn) > 0) {
echo count($chaineSyn) . " Synonymes ne sont pas des noms retenus:\n";
//echo "(" . implode(",", array_keys($chaineSyn)) . ")\n";
}*/
 
if ($analyseOK === true) {
// Production CSV de destination
$csvDestination = '';
$csvDestination .= implode($this->entetesRtax, ',') . "\n";
$tailleLigne = count($this->entetesRtax);
foreach ($donneesTransformees as $dt) {
//$ligne = array();
$ligneCsv = '';
$i = 0;
foreach ($this->entetesRtax as $e) {
/*if (isset($dt[$e])) {
$ligne[] = $dt[$e];
} else {
$ligne[] = '';
}*/
if (isset($dt[$e]) && ($dt[$e] !== '')) {
$ligneCsv .= '"' . $dt[$e] . '"';
}
if ($i < $tailleLigne) {
$ligneCsv .= ',';
}
$i++;
}
$ligneCsv .= "\n";
//$ligneCsv = '"' . implode($ligne, '","') . '"' . "\n"; // met des double guillemets sur les champs vides et /i
$csvDestination .= $ligneCsv;
}
// @TODO créer le répertoire dans /tmp et donner les droits 777
file_put_contents($cheminCsvRtax, $csvDestination);
$retour = true;
} else {
echo "L'analyse a mis en évidence des erreurs. Interruption.\n";
}
 
return $retour;
}
 
// Charge le CSV minimal au format TexRaf
protected function chargerCsvRtax() {
$cheminCsvRtax = Config::get('chemins.csvRtax');
echo "---- chargement du fichier CSV Rtax [$cheminCsvRtax]\n";
$req = "LOAD DATA INFILE '" . $cheminCsvRtax . "' INTO TABLE " . $this->table
. " FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES";
$retour = $this->getBdd()->requeter($req);
return $retour;
}
 
// Convertit les rangs du format chaispasquoi au format RexTaf
protected function changerRangs() {
echo "---- conversion des rangs\n";
$rangs = array(
"0" => "10",
"1" => "20",
"2" => "50",
"3" => "53",
"4" => "80",
"5" => "140",
"6" => "180",
"7" => "190",
"8" => "200",
"9" => "220",
"10" => "230",
"11" => "240",
"12" => "250",
"13" => "260",
"14" => "280",
"15" => "290",
"16" => "320",
"17" => "340",
"18" => "350",
"19" => "360",
"20" => "370",
"26" => "440"
);
foreach ($rangs as $src => $dest) {
echo "rang $src => rang $dest\n";
$req = "UPDATE " . $this->table . " SET rang=$dest WHERE rang=$src;";
$this->getBdd()->requeter($req);
}
}
 
// Copie num_nom dans num_nom_retenu lorsque ce dernier est vide
protected function completerNumNomRetenu() {
echo "---- complétion des num_nom_retenu\n";
$req = "UPDATE " . $this->table . " SET num_nom_retenu = num_nom WHERE num_nom_retenu='';";
$this->getBdd()->requeter($req);
}
 
// Supprime le num_tax_sup pour les synonymes
// et le met à 1 s'il est égal au num_nom
protected function supprimerNumTaxSupPourSynonymes() {
echo "---- suppression de num_tax_sup pour les synonymes et mise à 1 si égal à num_nom\n";
$req = "UPDATE " . $this->table . " SET num_tax_sup = '' WHERE num_nom != num_nom_retenu;";
$this->getBdd()->requeter($req);
$req = "UPDATE " . $this->table . " SET num_tax_sup = 1 WHERE num_nom = num_tax_sup;";
$this->getBdd()->requeter($req);
}
 
// Pour chaque subsp. autonyme, inscrit l'epithete_infra_sp
protected function subspAutonymes() {
echo "---- inscription de l'épithète infraspécifique des subsp. autonymes\n";
$req = "SELECT num_nom, nom_sci, epithete_infra_sp FROM " . $this->table . " WHERE nom_sci LIKE '%subsp.%'";
$res = $this->getBdd()->recupererTous($req);
 
$nbres = count($res);
$cpt = 0;
$ok = 0;
$ids = array();
foreach ($res as $subsp) {
$ns = $subsp['nom_sci'];
$pos = strpos($ns, 'subsp.');
$gsp = substr($ns, 0, $pos - 1);
$sp = substr($gsp, strrpos($gsp, ' ') + 1);
$sub = substr($ns, $pos + 8);
if ($sub == $sp) {
$cpt++;
// @TODO
// 1) récupérer l'auteur
// 2) intégrer l'auteur avant "subsp." dans le nom_sci
//echo "[$sp] || [$sub] || [" . $subsp['epithete_infra_sp'] . "]\n";
if ($sub == $subsp['epithete_infra_sp']) {
$ok++;
} else {
$reqMod = "UPDATE " . $this->table . " SET epithete_infra_sp='"
. $sub . "' WHERE num_nom=" . $subsp['num_nom'];
$this->getBdd()->requeter($reqMod);
}
}
}
echo "subsp.: $nbres\n";
echo "Autonymes: $cpt dont $ok déjà inscrites\n";
}
 
// Copie le nom scientifique dans le nom supra générique pour les taxons de rang
// supérieur au genre
protected function genererNomSupraGenerique() {
echo "---- complétion des noms supragénériques\n";
$req = "UPDATE " . $this->table . " SET nom_supra_generique = nom_sci WHERE rang < 220";
$res = $this->getBdd()->requeter($req);
}
 
// Copie le nom scientifique dans l'épithète infra générique pour les taxons de rang
// entre genre et espèce
protected function genererEpitheteInfraGenerique() {
echo "---- complétion des épithètes infragénériques\n";
$req = "UPDATE " . $this->table . " SET epithete_infra_generique = nom_sci WHERE rang > 220 AND rang < 290";
$res = $this->getBdd()->requeter($req);
}
 
protected function exporterCSVModifie() {
$cheminFichierCsvRtaxModifie = Config::get('chemins.csvRtaxModifie');
echo "---- export du CSV Rtax modifié [$cheminFichierCsvRtaxModifie]\n";
if (file_exists($cheminFichierCsvRtaxModifie)) {
unlink($cheminFichierCsvRtaxModifie);
}
$req = "SELECT '" . implode("','", $this->entetesRtax) . "'"
. " UNION ALL "
. " SELECT * FROM " . $this->table . " INTO OUTFILE '" . $cheminFichierCsvRtaxModifie . "'"
. " FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n'";
$res = $this->getBdd()->requeter($req);
// Remplacement des cases vides par '' aulieu de '""' (peut faire foirer l'import par la suite)
exec("sed -i 's/\"\"//g' " . $cheminFichierCsvRtaxModifie);
}
 
// -------------- partie eFlore ------------- copiée depuis le script Bdtfx
 
private function genererChpNomSciHtml() {
echo "---- génération des noms scientifiques en HTML \n";
$this->preparerTablePrChpNomSciHtml();
$generateur = new GenerateurNomSciHtml();
$nbreTotal = $this->recupererNbTotalTuples();
$erreurs = array();
$this->departInsertion = 0;
while ($this->departInsertion < $nbreTotal) {
$resultat = $this->recupererTuplesPrChpNomSciHtml();
try {
$nomsSciEnHtml = $generateur->generer($resultat);
} catch (Exception $e) {
$erreurs[] = $e->getMessage();
}
$this->remplirChpNomSciHtm($nomsSciEnHtml);
$this->departInsertion += $this->pasInsertion;
$this->afficherAvancement("Insertion des noms scientifique au format HTML dans la base par paquet de {$this->pasInsertion} en cours");
}
echo "\n";
 
if (count($erreurs) > 0) {
echo 'Erreurs lors de la génération HTML des noms scientifiques:\n' . print_r($erreurs, true) . "\n";
}
}
 
private function preparerTablePrChpNomSciHtml() {
echo "---- ajout de la colonne nom_sci_html \n";
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'nom_sci_html' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD nom_sci_html VARCHAR( 500 ) '.
'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
$this->getBdd()->requeter($requete);
}
}
 
private function recupererNbTotalTuples(){
$requete = "SELECT count(*) AS nb FROM {$this->table} ";
$resultat = $this->getBdd()->recuperer($requete);
return $resultat['nb'];
}
 
private function recupererTuplesPrChpNomSciHtml() {
$requete = 'SELECT num_nom, rang, nom_sci, nom_supra_generique, genre, epithete_infra_generique, '.
' epithete_sp, type_epithete, epithete_infra_sp,cultivar_groupe, '.
' nom_commercial, cultivar '.
"FROM {$this->table} ".
"LIMIT {$this->departInsertion},{$this->pasInsertion} ";
$resultat = $this->getBdd()->recupererTous($requete);
return $resultat;
}
 
private function remplirChpNomSciHtm($nomsSciHtm) {
foreach ($nomsSciHtm as $id => $html) {
$html = $this->getBdd()->proteger($html);
$requete = "UPDATE {$this->table} SET nom_sci_html = $html WHERE num_nom = $id ";
$resultat = $this->getBdd()->requeter($requete);
if ($resultat === false) {
throw new Exception("Erreur d'insertion pour le tuple $id");
}
}
}
 
// Attention c'est over-lent !
private function genererChpNumTax() {
$this->preparerTablePrChpNumTax();
$erreurs = array();
$this->departInsertion = 0;
$dernier_num_tax = 0;
$requete = 'SELECT num_nom '.
'FROM '.$this->table.' '.
'WHERE num_nom = num_nom_retenu AND num_nom_retenu != 0 '.
'ORDER by num_nom_retenu ASC ';
 
$resultat = $this->getBdd()->recupererTous($requete);
foreach ($resultat as $taxon) {
$dernier_num_tax++;
$requete_maj = 'UPDATE '.$this->table.' '.
'SET num_taxonomique = '.$dernier_num_tax.' '.
'WHERE num_nom_retenu = '.$taxon['num_nom'];
$this->getBdd()->requeter($requete_maj);
$this->pasInsertion++;
$this->afficherAvancement("Insertion des num tax, ".count($resultat)." num tax a traiter");
}
echo "\n";
if (count($erreurs) > 0) {
echo 'Erreurs lors de la génération des numéros taxonomiques' . print_r($erreurs, true) . "\n";
}
}
private function preparerTablePrChpNumTax() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'num_taxonomique' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD num_taxonomique INT( 9 ) ';
$this->getBdd()->requeter($requete);
}
}
 
private function genererChpNomComplet() {
$this->preparerTablePrChpNomComplet();
$this->remplirChpNomComplet();
}
private function preparerTablePrChpNomComplet() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'nom_complet' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD nom_complet VARCHAR( 500 ) '.
'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
$this->getBdd()->requeter($requete);
}
}
private function remplirChpNomComplet() {
echo "---- Attribution du champ nom complet au taxons :\n";
$requete = "UPDATE {$this->table} SET nom_complet = CONCAT(nom_sci,' ',auteur)";
$resultat = $this->getBdd()->requeter($requete);
if ($resultat === false) {
echo "Erreur de génération du champ nom complet\n";
} else {
echo "OK\n";
}
}
 
private function genererChpFamille() {
$this->preparerTablePrChpFamille();
$resultats = $this->recupererTuplesPrChpFamille();
$noms = array();
$introuvables = array();
$introuvablesSyno = array();
foreach ($resultats as $id => $nom) {
$nn = $nom['num_nom'];
$nnr = $nom['num_nom_retenu'];
$nts = $nom['num_tax_sup'];
$rg = $nom['rang'];
if ($nnr != '') {
if ($rg == '180') {
$noms[$nn] = $nom['nom_sci'];
} else {
if ($nn == $nnr) {// nom retenu
if (isset($noms[$nts])) {
$noms[$nn] = $noms[$nts];
} else {
$introuvables[] = $nn;
}
} else {// nom synonyme
if (isset($noms[$nnr])) {
$noms[$nn] = $noms[$nnr];
} else {
$introuvablesSyno[] = $nom;
}
}
}
}
unset($resultats[$id]);
$this->afficherAvancement("Attribution de leur famille aux noms en cours");
}
echo "\n";
 
foreach ($introuvablesSyno as $id => $nom) {
$nn = $nom['num_nom'];
$nnr = $nom['num_nom_retenu'];
if (isset($noms[$nnr])) {
$noms[$nn] = $noms[$nnr];
} else {
$introuvables[] = $nn;
}
unset($introuvablesSyno[$id]);
$this->afficherAvancement("Attribution de leur famille aux synonymes en cours");
}
echo "\n";
 
if (count($introuvables) > 0) {
echo count($introuvables) . ' familles sont introuvables : ' . implode(',', $introuvables) . "\n";
}
$this->remplirChpFamille($noms);
}
 
private function preparerTablePrChpFamille() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'famille' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD famille VARCHAR(255) '.
'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
$this->getBdd()->requeter($requete);
}
}
 
private function recupererTuplesPrChpFamille() {
$requete = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci '.
"FROM {$this->table} ".
"WHERE rang >= 180 ".
"ORDER BY rang ASC, num_tax_sup ASC, num_nom_retenu DESC ";
$resultat = $this->getBdd()->recupererTous($requete);
return $resultat;
}
 
private function remplirChpFamille($noms) {
foreach ($noms as $id => $famille) {
$famille = $this->getBdd()->proteger($famille);
$requete = "UPDATE {$this->table} SET famille = $famille WHERE num_nom = $id ";
$resultat = $this->getBdd()->requeter($requete);
if ($resultat === false) {
throw new Exception("Erreur d'insertion pour le tuple $id");
}
$this->afficherAvancement("Insertion des noms de famille dans la base en cours");
}
echo "\n";
}
private function genererChpHierarchie() {
$this->preparerTablePrChpHierarchie();
$table = Config::get('tables.isfan');
$requete = "UPDATE {$this->table} SET hierarchie = NULL ";
$mise_a_jour = $this->getBdd()->requeter($requete);
$requete_hierarchie = "SELECT num_nom, num_nom_retenu, num_tax_sup FROM " . $this->table . " ORDER BY rang DESC";
$resultat = $this->getBdd()->recupererTous($requete_hierarchie);
$num_nom_a_num_sup = array();
foreach($resultat as &$taxon) {
$num_nom_a_num_sup[$taxon['num_nom']] = $taxon['num_tax_sup'];
}
$chemin_taxo = "";
foreach($resultat as &$taxon) {
$chemin_taxo = $this->traiterHierarchieNumTaxSup($taxon['num_nom_retenu'], $num_nom_a_num_sup).'-';
$requete = "UPDATE {$this->table} SET hierarchie = ".$this->getBdd()->proteger($chemin_taxo)." WHERE num_nom = ".$taxon['num_nom']." ";
$mise_a_jour = $this->getBdd()->requeter($requete);
$this->afficherAvancement("Insertion de la hierarchie taxonomique en cours");
}
echo "\n";
}
private function traiterHierarchieNumTaxSup($num_nom_retenu, &$num_nom_a_num_sup) {
$chaine_hierarchie = "";
if(isset($num_nom_a_num_sup[$num_nom_retenu])) {
$num_tax_sup = $num_nom_a_num_sup[$num_nom_retenu];
$chaine_hierarchie = '-'.$num_tax_sup;
if($num_tax_sup != 0 && $num_tax_sup != '') {
$chaine_hierarchie = $this->traiterHierarchieNumTaxSup($num_tax_sup, $num_nom_a_num_sup).$chaine_hierarchie;
}
}
return $chaine_hierarchie;
}
private function preparerTablePrChpHierarchie() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'hierarchie' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD hierarchie VARCHAR(1000) '.
'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
$this->getBdd()->requeter($requete);
}
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/biblio_bota/BiblioBota.php
New file
0,0 → 1,70
<?php
//declare(encoding='UTF-8');
/**
* Exemple de lancement du script : :
* /opt/lampp/bin/php cli.php cel -a chargerTous
*
* @category php 5.2
* @package eFlore/Scripts
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2011, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class BiblioBota extends EfloreScript {
 
public function executer() {
try {
$this->initialiserProjet('biblio_bota');
 
// Lancement de l'action demandée
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerBiblioBota();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
public function chargerBiblioBota() {
$tablesCodes = array_keys(Config::get('tables'));
foreach ($tablesCodes as $code) {
echo "Chargement de la table : $code\n";
$this->chargerFichierTsvDansTable($code);
}
}
 
private function chargerFichierTsvDansTable($code) {
$chemin = Config::get('chemins.'.$code);
$table = Config::get('tables.'.$code);
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '\"' ".
" ESCAPED BY '\\\' ";
$this->getBdd()->requeter($requete);
}
 
private function supprimerTous() {
$requete = "DROP TABLE IF EXISTS biblio_article, biblio_article_sauv, biblio_aut_saisie, ".
"biblio_collection, biblio_domaine, biblio_domaine_lier, biblio_domaine_lier_sauv, biblio_fasc, ".
"biblio_fasc_sauv, biblio_item, biblio_item_sauv, biblio_item_typlog, biblio_item_typphy, ".
"biblio_link, biblio_link_categ, biblio_link_categoriser, biblio_link_sauv, biblio_media, ".
"biblio_modif, biblio_serie, biblio_spy, biblio_str, biblio_str_sauve, biblio_str_type, ".
"biblio_meta";
$this->getBdd()->requeter($requete);
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/biblio_bota/biblio_bota.ini
New file
0,0 → 1,84
version="2009-10-05"
dossierTsv = "{ref:dossierDonneesEflore}biblio_bota/{ref:version}/"
dossierSql = "{ref:dossierTsv}"
prefixe = "biblio_"
 
[tables]
article = "{ref:prefixe}article"
article_sauv = "{ref:prefixe}article_sauv"
aut_saisie = "{ref:prefixe}aut_saisie"
collection = "{ref:prefixe}collection"
domaine = "{ref:prefixe}domaine"
domaine_lier = "{ref:prefixe}domaine_lier"
domaine_lier_sauv = "{ref:prefixe}domaine_lier_sauv"
fasc = "{ref:prefixe}fasc"
fasc_sauv = "{ref:prefixe}fasc_sauv"
item = "{ref:prefixe}item"
item_sauv = "{ref:prefixe}item_sauv"
item_typlog = "{ref:prefixe}item_typlog"
item_typphy = "{ref:prefixe}item_typphy"
link = "{ref:prefixe}link"
link_categ = "{ref:prefixe}link_categ"
link_categoriser = "{ref:prefixe}link_categoriser"
link_sauv = "{ref:prefixe}link_sauv"
media = "{ref:prefixe}media"
modif = "{ref:prefixe}modif"
serie = "{ref:prefixe}serie"
spy = "{ref:prefixe}spy"
str = "{ref:prefixe}str"
str_sauve = "{ref:prefixe}str_sauve"
str_type = "{ref:prefixe}str_type"
 
[fichiers]
structureSql = "biblio_bota.sql"
article = "{ref:prefixe}article.tsv"
article_sauv = "{ref:prefixe}article_sauv.tsv"
aut_saisie = "{ref:prefixe}aut_saisie.tsv"
collection = "{ref:prefixe}collection.tsv"
domaine = "{ref:prefixe}domaine.tsv"
domaine_lier = "{ref:prefixe}domaine_lier.tsv"
domaine_lier_sauv = "{ref:prefixe}domaine_lier_sauv.tsv"
fasc = "{ref:prefixe}fasc.tsv"
fasc_sauv = "{ref:prefixe}fasc_sauv.tsv"
item = "{ref:prefixe}item.tsv"
item_sauv = "{ref:prefixe}item_sauv.tsv"
item_typlog = "{ref:prefixe}item_typlog.tsv"
item_typphy = "{ref:prefixe}item_typphy.tsv"
link = "{ref:prefixe}link.tsv"
link_categ = "{ref:prefixe}link_categ.tsv"
link_categoriser = "{ref:prefixe}link_categoriser.tsv"
link_sauv = "{ref:prefixe}link_sauv.tsv"
media = "{ref:prefixe}media.tsv"
modif = "{ref:prefixe}modif.tsv"
serie = "{ref:prefixe}serie.tsv"
spy = "{ref:prefixe}spy.tsv"
str = "{ref:prefixe}str.tsv"
str_sauve = "{ref:prefixe}str_sauve.tsv"
str_type = "{ref:prefixe}str_type.tsv"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
article = "{ref:dossierSql}{ref:fichiers.article}"
article_sauv = "{ref:dossierSql}{ref:fichiers.article_sauv}"
aut_saisie = "{ref:dossierSql}{ref:fichiers.aut_saisie}"
collection = "{ref:dossierSql}{ref:fichiers.collection}"
domaine = "{ref:dossierSql}{ref:fichiers.domaine}"
domaine_lier = "{ref:dossierSql}{ref:fichiers.domaine_lier}"
domaine_lier_sauv = "{ref:dossierSql}{ref:fichiers.domaine_lier_sauv}"
fasc = "{ref:dossierSql}{ref:fichiers.fasc}"
fasc_sauv = "{ref:dossierSql}{ref:fichiers.fasc_sauv}"
item = "{ref:dossierSql}{ref:fichiers.item}"
item_sauv = "{ref:dossierSql}{ref:fichiers.item_sauv}"
item_typlog = "{ref:dossierSql}{ref:fichiers.item_typlog}"
item_typphy = "{ref:dossierSql}{ref:fichiers.item_typphy}"
link = "{ref:dossierSql}{ref:fichiers.link}"
link_categ = "{ref:dossierSql}{ref:fichiers.link_categ}"
link_categoriser = "{ref:dossierSql}{ref:fichiers.link_categoriser}"
link_sauv = "{ref:dossierSql}{ref:fichiers.link_sauv}"
media = "{ref:dossierSql}{ref:fichiers.media}"
modif = "{ref:dossierSql}{ref:fichiers.modif}"
serie = "{ref:dossierSql}{ref:fichiers.serie}"
spy = "{ref:dossierSql}{ref:fichiers.spy}"
str = "{ref:dossierSql}{ref:fichiers.str}"
str_sauve = "{ref:dossierSql}{ref:fichiers.str_sauve}"
str_type = "{ref:dossierSql}{ref:fichiers.str_type}"
/tags/v5.7-arrayanal/scripts/modules/wikipedia/Wikipedia.php
New file
0,0 → 1,115
<?php
//declare(encoding='UTF-8');
/**
* Classe permettant de :
* - rajouter l'objet point centroide de la commune.
* - charger la bdd
* Exemple de lancement du script : :
* /opt/lampp/bin/php cli.php wikipedia -a chargerTous
*
* @category php 5.2
* @package eFlore/Scripts
* @author Mohcen BENMOUNAH <mohcen@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2011, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class Wikipedia extends EfloreScript {
private $tableMeta = '';
private $cheminFichierMeta = '';
private $tableCommunes = '';
private $cheminFichierCommunes = '';
 
public function executer() {
try {
$this->initialiserProjet('wikipedia');
$this->tableMeta = Config::get('tables.wikipediaMeta');
$this->cheminFichierMeta = Config::get('chemins.wikipediaMeta');
$this->tableCommunes = Config::get('tables.wikipediaCommunes');
$this->cheminFichierCommunes = Config::get('chemins.wikipediaCommunes');
 
// Lancement de l'action demandée
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerMetaDonnees();
$this->chargerWikipediaCommunes();
$this->preparerTable();
$this->recupererPoints();
case 'points' :
$this->preparerTable();
$this->recupererPoints();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
protected function chargerMetaDonnees() {
$contenuSql = $this->recupererContenu($this->cheminFichierMeta);
$this->executerScripSql($contenuSql);
}
 
private function chargerWikipediaCommunes() {
$requete = "LOAD DATA INFILE '{$this->cheminFichierCommunes}' ".
"REPLACE INTO TABLE {$this->tableCommunes} ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY ',' ".
" ENCLOSED BY '\"' ".
" ESCAPED BY '\\\' ".
'IGNORE 1 LINES';
$this->getBdd()->requeter($requete);
}
 
private function preparerTable() {
$requete = "ALTER TABLE {$this->tableCommunes} ".
'DROP centroide ';
$this->getBdd()->requeter($requete);
 
$requete = "ALTER TABLE {$this->tableCommunes} ".
' ADD centroide point NOT NULL ';
$this->getBdd()->requeter($requete);
 
$requete = "ALTER TABLE {$this->tableCommunes} ".
' ADD INDEX (centroide) ';
$this->getBdd()->requeter($requete);
}
 
private function recupererPoints() {
$requete = 'SELECT * '.
"FROM {$this->tableCommunes} ";
$LatLons = $this->getBdd()->recupererTous($requete);
 
foreach ($LatLons as $LatLon) {
$latitude_degre = $LatLon['latitude'];
$longitude_degre = $LatLon['longitude'];
$insee = $LatLon['code_insee'];
$this->formerPointCentre($latitude_degre, $longitude_degre, $insee);
$this->afficherAvancement('Analyse des communes Wikipedia');
}
}
 
private function formerPointCentre($latitude_degre, $longitude_degre, $insee) {
$centre = "$latitude_degre $longitude_degre";
$requete = "UPDATE {$this->tableCommunes} ".
"SET centroide = POINTFROMTEXT('POINT($centre)') ".
"WHERE code_insee = $insee ";
$this->getBdd()->requeter($requete);
}
 
private function supprimerTous() {
$requete = "DROP TABLE IF EXISTS {$this->tableMeta}, {$this->tableCommunes}";
$this->getBdd()->requeter($requete);
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/wikipedia/wikipedia.ini
New file
0,0 → 1,21
version="2011"
dossierDonnees = "{ref:dossierDonneesEflore}wikipedia/"
 
[dossiers]
structure = "{ref:dossierDonnees}"
meta = "{ref:dossierDonnees}"
communes = "{ref:dossierDonnees}communes/2011-05-13/"
[tables]
wikipediaMeta = "wikipedia_meta"
wikipediaCommunes = "wikipedia_communes_v{ref:version}"
 
[fichiers]
structureSql = "wikipedia.sql"
wikipediaMeta = "wikipedia_meta.sql"
wikipediaCommunes = "communes_tom_com_v2011.csv"
 
[chemins]
structureSql = "{ref:dossiers.structure}{ref:fichiers.structureSql}"
wikipediaMeta = "{ref:dossiers.meta}{ref:fichiers.wikipediaMeta}"
wikipediaCommunes = "{ref:dossiers.communes}{ref:fichiers.wikipediaCommunes}"
/tags/v5.7-arrayanal/scripts/modules/sptb/Sptb.php
New file
0,0 → 1,90
<?php
/** Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M cli.php sptb -a chargerTous
*/
class Sptb extends EfloreScript {
 
public function executer() {
// Lancement de l'action demandée
try {
$this->initialiserProjet('sptb');
 
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerDonnees('especes');
$this->chargerDonnees('lois');
$this->genererChampNumNomRetenu();
break;
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'chargerDonnees' :
$this->chargerDonnees('especes');
$this->chargerDonnees('lois');
$this->genererChampNumNomRetenu();
break;
case 'genererChampNumNomRetenu' :
$this->genererChampNumNomRetenu();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
private function chargerDonnees($type) {
$chemin = Config::get('chemins.'.$type);
$table = Config::get('tables.'.$type);
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' ".
'IGNORE 1 LINES';
$this->getBdd()->requeter($requete);
}
private function genererChampNumNomRetenu() {
$this->preparerTablePrChpNumNomRetenu();
$this->genererNumNomRetenu();
}
private function preparerTablePrChpNumNomRetenu() {
$table = Config::get('tables.especes');
$requete = "SHOW COLUMNS FROM $table LIKE 'num_nom_retenu' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE $table ".
'ADD num_nom_retenu INT(10) '.
'NULL DEFAULT NULL AFTER num_nom';
$this->getBdd()->requeter($requete);
}
}
private function genererNumNomRetenu() {
$table = Config::get('tables.especes');
$table_referentiel = Config::get('tables.referentielTaxo');
$requete = 'UPDATE '.$table.' s, '.$table_referentiel.' r '.
'SET s.num_nom_retenu = r.num_nom_retenu '.
' WHERE s.num_nom = r.num_nom ';
$this->getBdd()->requeter($requete);
}
 
private function supprimerTous() {
$requete = "DROP TABLE IF EXISTS sptb_meta, sptb_especes_v2012, sptb_lois_v2012";
$this->getBdd()->requeter($requete);
Debug::printr('suppression');
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/sptb/sptb.ini
New file
0,0 → 1,19
version="2012"
dossierTsv = "{ref:dossierDonneesEflore}sptb/{ref:version}/"
dossierSql = "{ref:dossierTsv}"
 
[tables]
especes = "sptb_especes_v2012"
lois = "sptb_lois_v2012"
referentielTaxo = "bdtfx_v1_02"
 
[fichiers]
structureSql = "sptb_v2012.sql"
especes = "sptb_especes_v2012.tsv"
lois = "sptb_lois_v2012.tsv"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
especes = "{ref:dossierTsv}{ref:fichiers.especes}"
lois = "{ref:dossierTsv}{ref:fichiers.lois}"
numNomRetenus = "{ref:dossierTsv}{ref:fichiers.numNomRetenus}"
/tags/v5.7-arrayanal/scripts/modules/eflore/Eflore.php
New file
0,0 → 1,54
<?php
/** Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M cli.php eflore -a chargerTous
*/
class Eflore extends EfloreScript {
 
public function executer() {
// Lancement de l'action demandée
try {
$this->initialiserProjet('eflore');
 
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerTous' :
$this->chargerStructureSql();
$this->chargerOntologies();
break;
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'chargerOntologies' :
$this->chargerOntologies();
break;
case 'supprimerTous' :
$this->supprimerTous();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
 
private function chargerOntologies() {
$chemin = Config::get('chemins.ontologies');
$table = Config::get('tables.ontologies');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '\"' ".
" ESCAPED BY '\\\' ".
'IGNORE 1 LINES';
$this->getBdd()->requeter($requete);
}
 
private function supprimerTous() {
$requete = "DROP TABLE IF EXISTS eflore_meta, eflore_ontologies";
$this->getBdd()->requeter($requete);
}
}
?>
/tags/v5.7-arrayanal/scripts/modules/eflore/get-donnees-fiches-eflore.php
New file
0,0 → 1,181
<?php
/**
* @category PHP 5.2
* @package Framework
* @author Raphaël Droz <raphael@tela-botanica.org>
* @copyright Copyright (c) 2013, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
*/
 
/*
- bootstrap le framework
- bootstrap une fiche
- puis, pour un ou plusieurs onglet (automatique ou manuellement),
obtient les données correspondante.
 
L'objectif est de pouvoir générer un flux de données exhaustive pour une Fiche donnée
tout en restant assez indépendant des (lourds) appels à l'API.
Une finalité est de pouvoir s'orienter vers un cron pour index Sphinx, tout en
permettant d'identifier les limites de l'API.
*/
 
 
define('_DIR_FRAMEWORK', '/home/raphael/TBF/trunk/framework');
define('_DIR_CONSULT', '/home/raphael/eflore/consultation');
define('_DIR_SERVICES', '/home/raphael/eflore/projets/services/modules/0.1');
 
//require_once __DIR__ . '/../../framework.php';
set_include_path(_DIR_FRAMEWORK . PATH_SEPARATOR .
_DIR_CONSULT . '/controleurs' . PATH_SEPARATOR .
_DIR_CONSULT . '/bibliotheque' . PATH_SEPARATOR .
_DIR_CONSULT . '/modules/fiche' . PATH_SEPARATOR .
_DIR_CONSULT . '/metier/api_0.1' . PATH_SEPARATOR .
_DIR_SERVICES . '/commun' . PATH_SEPARATOR .
_DIR_SERVICES . '/bdtfx' . PATH_SEPARATOR .
_DIR_CONSULT . '/modules/fiche/formateurs' . PATH_SEPARATOR .
get_include_path());
spl_autoload_extensions('.php');
spl_autoload_register();
 
/*require_once _DIR_FRAMEWORK . '/Controleur.php';
require_once _DIR_CONSULT . '/controleurs/AppControleur.php';
require_once _DIR_CONSULT . '/bibliotheque/AppUrls.php';
require_once _DIR_CONSULT . '/controleurs/aControleur.php';
require_once _DIR_CONSULT . '/bibliotheque/Conteneur.php';
require_once _DIR_CONSULT . '/modules/fiche/Fiche.php';*/
 
 
// require_once _DIR_CONSULT . '/modules/fiche/Fiche.php'
require_once('Framework.php');
Framework::setCheminAppli(__FILE__);
Framework::setInfoAppli(Config::get('info'));
// idéalement
// $a = new Fiche(new Conteneur(array()));
 
 
require_once('Config.php');
require_once('Controleur.php');
require_once('aControleur.php');
require_once('AppControleur.php');
require_once('AppUrls.php');
require_once('Conteneur.php');
 
AppControleur::initialiser();
 
require_once('Commun.php');
require_once('CommunNomsTaxons.php');
require_once('Eflore.php');
require_once('Taxons.php');
require_once('Noms.php');
 
require_once('NomCourant.php');
require_once('Nom.php');
 
Config::charger(_DIR_FRAMEWORK . '/config.ini');
Config::charger(_DIR_CONSULT . '/configurations/config.ini');
 
 
require_once('Fiche.php');
$a = new Fiche();
$_GET['num_nom'] = 141;
$_GET['referentiel'] = 'bdtfx';
 
$a->initialiser();
 
$classes = array(
// 'illustrations',
// 'repartition',
// 'ecologie', // fait main (mais peu utile)
 
// 'nomenclature', // TODO
// 'description', // fait main
// 'ethnobotanique', // fait main
// 'bibliographie', // fait main
// 'statut', // TODO
);
 
// pour nomenclature
require_once('MetaDonnees.php');
require_once('Wikini.php');
 
// pour description
require_once('Textes.php');
require_once('Informations.php');
 
// pour ethnobotanique
require_once('NomsVernaculaires.php');
 
// pour bibliographie
require_once('BiblioBota.php');
 
// pour statuts
require_once('Statuts.php');
 
// pour ecologie
require_once('Graphiques.php');
require_once('Syntaxons.php');
 
// pour repartition
require_once('Cartes.php'); // TODO
 
// way 1
foreach($classes as $c) {
$a->onglet = $c;
$b = $a->obtenirDonnees();
var_dump($b);die();
}
 
 
// non-nécessaire si l'on peut récupérer le conteneur
// initialisé par new Fiche()
// $conteneur = new Conteneur($a->parametres);
 
// description
$onglet = new Description($a->conteneur);
$onglet->obtenirDonnees();
$onglet->getCoste();
echo implode('; ', $onglet->donnees['wikini']['description']);
echo implode('; ', $onglet->donnees['coste']['description']);
 
// bibliographie
Config::charger(_DIR_CONSULT . '/configurations/bdtfx.ini');
$onglet = new Bibliographie($a->conteneur);
$onglet->obtenirDonnees();
echo implode('; ', $onglet->donnees['flores']['liste_flores']);
echo implode('; ', $onglet->donnees['bibliobota']['references']);
 
// ethnobota
Config::charger(_DIR_CONSULT . '/configurations/bdtfx.ini');
$onglet = new Ethnobotanique($a->conteneur);
$onglet->obtenirDonnees();
echo implode('; ', array_map(function($v) { return $v['nom_vernaculaire']; }, $onglet->donnees['nvjfl']['noms'])) . '; ' .
implode('; ', array_map(function($v) { return $v['nom_vernaculaire']; }, $onglet->donnees['nvps']['noms']));
 
// ecologie
Config::charger(_DIR_CONSULT . '/configurations/bdtfx.ini');
$onglet = new Ecologie($a->conteneur);
// $onglet->obtenirDonnees(); // slow !
// var_dump($onglet->donnees['baseflor']['legende']);
 
 
 
/*
API: TODO:
- Chaque service de /consultation/formateur/ doit définir en en-tête:
* référentiels supportés
* fichiers/directives de configuration nécessaire
* class utilisées (namespace "use")
 
- obtenirDonnees() doit prendre ses paramètres [optionnels] par argument, sans compter
sur l'instanciation et la définition d'attributs
- obtenirDonnees() doit retourner les valeurs générées
- obtenirDonnees() ne doit pas traiter le formattage des résultats (getBloc() oui)
- si $this->données reste nécessaire pour une quelconque raison, celui-ci doit être public
 
- pour Fiche.php
- onglets ne doit plus être un attribut (pas même public)
- executerFiche(), executerOnglet() et obtenirDonnees() doivent prendre un $onglet comme paramètre
- $parametre et $conteneur doivent être "public"
 
*/
/tags/v5.7-arrayanal/scripts/modules/eflore/eflore.ini
New file
0,0 → 1,14
version="2011"
dossierTsv = "{ref:dossierDonneesEflore}eflore/{ref:version}/"
dossierSql = "{ref:dossierTsv}"
 
[tables]
ontologies = "eflore_ontologies"
 
[fichiers]
structureSql = "eflore_v2011.sql"
ontologies = "eflore_ontologies_v2011.tsv"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
ontologies = "{ref:dossierTsv}{ref:fichiers.ontologies}"
/tags/v5.7-arrayanal/scripts/modules/baseveg/BasevegVerif.php
New file
0,0 → 1,94
<?php
 
class BasevegVerif extends VerificateurDonnees {
 
private $synonymes;
private $niveaux;
private $motifs;
 
//obligatoire
public function definirTraitementsColonnes() {
$this->initialiserParametresVerif();
if ($this->colonne_num == 1 ) {
$this->verifierColonne();
} elseif ($this->colonne_num == 2 ) {
$this->verifierColonne();
} elseif ($this->colonne_num == 4 ) {
$this->verifierNiveaux();
}
}
public function initialiserParametresVerif() {
$this->niveaux = array('CLA','ALL','ORD','ASS','GRPT','SUBORD','SUBASS','BC','SUBCLA','DC','SUBALL');
$this->synonymes = array('incl','=','?','illeg','pp','pmaxp','pminp','compl','ambig','non','inval','nn','ined');
$this->motifs= $this->inverserTableau(array('/^[0-9]+$/' => 1,
'/(?:[0-9]{2}\/$|[0-9]{2}\/[0-9]\.$|[0-9]{2}\/(?:[0-9]\.){1,5}[0-9]$|[0-9]{2}\/(?:[0-9]\.){4,5}[0-9]\/[0-9]+(?:bis|ter|quater){0,1}$)|incertae sedis/' => 2));
//présence de '=' , '= ?' et ',' dans les valeurs des paramètres. ne pas utiliser getParametresTableau.
}
//++---------------------------------traitements des colonnes baseveg------------------------------------++
/**
*
* verifie le champ niveau
*/
public function verifierNiveaux(){
if (preg_match("/^syn(.+)$/", $this->colonne_valeur, $retour) == 1) {
$synonymes = explode(' ', trim($retour[1]));
foreach($synonymes as $syn){
if (!in_array($syn, $this->synonymes)) {
$this->noterErreur();
}
}
} elseif($this->colonne_valeur != '') {
if (!in_array($this->colonne_valeur , $this->niveaux)) {
$this->noterErreur();
}
}
}
 
/**
*
* vérifie un motif sur la valeur entière d'une colonne par expression régulière
*
*/
public function verifierColonne(){
$motif = $this->motifs[$this->colonne_num];
if (preg_match($motif, $this->colonne_valeur) == 0 && $this->verifierSiVide() == false){
$this->noterErreur();
}
}
 
/**
*
* vérifie si une colonne est vide ou non de valeurs
*
*/
public function verifierSiVide(){
$vide = ($this->colonne_valeur == '') ? true : false;
return $vide;
}
/*--------------------------------------------OUtils-------------------------------------------*/
//attention , dans les motifs !!
private function inverserTableau($tableau) {
$inverse = array();
foreach ($tableau as $cle => $valeurs) {
$valeurs = explode(';', $valeurs);
foreach ($valeurs as $valeur) {
$inverse[$valeur] = $cle;
}
}
return $inverse;
}
}
 
?>
/tags/v5.7-arrayanal/scripts/modules/baseveg/Baseveg.php
New file
0,0 → 1,111
<?php
/** Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M ~/web/eflore-projets/scripts/cli.php baseveg -a chargerTous
*/
 
class Baseveg extends EfloreScript {
 
 
 
 
public function executer() {
try {
$this->initialiserProjet('baseveg');
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'supprimerTous' :
$this->supprimerTous();
break;
case 'chargerStructureSql' :
$this->chargerStructureSql();
break;
case 'chargerMetadonnees' :
$this->chargerMetadonnees();
break;
case 'chargerDonnees' :
$this->chargerDonnees();
break;
case 'verifierFichier' :
//cette étape met en avant les valeurs qui vont poser des problèmes (ontologies..)
$this->verifierFichier();
break;
case 'supprimerOntologies' :
$this->supprimerOntologies();
break;
case 'chargerOntologies' :
$this->chargerOntologies();
break;
case 'chargerTous' :
$this->supprimerTous();
$this->chargerStructureSql();
$this->chargerMetadonnees();
$this->chargerDonnees();
$this->chargerOntologies();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
private function getClasseBasevegVerif() {
$conteneur = new Conteneur();
require_once dirname(__FILE__)."/BasevegVerif.php";
$verif = new BasevegVerif($conteneur,'baseveg');
return $verif;
}
private function verifierFichier() {
$verif = $this->getClasseBasevegVerif();
$verif->verifierFichier(Config::get('chemins.donnees'));
}
private function supprimerOntologies() {
$chemin = Config::get('chemins.ontologies');
$table = Config::get('tables.ontologies');
$requete = "TRUNCATE TABLE $table ;";
$this->getBdd()->requeter($requete);
}
private function chargerOntologies() {
$chemin = Config::get('chemins.ontologies');
$table = Config::get('tables.ontologies');
$requete = "LOAD DATA INFILE '$chemin' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\' "
;
$this->getBdd()->requeter($requete);
}
 
private function chargerDonnees() {
$table = Config::get('tables.donnees');
$requete = "LOAD DATA INFILE '".Config::get('chemins.donnees')."' ".
"REPLACE INTO TABLE $table ".
'CHARACTER SET utf8 '.
'FIELDS '.
" TERMINATED BY '\t' ".
" ENCLOSED BY '' ".
" ESCAPED BY '\\\'";
$this->getBdd()->requeter($requete);
}
protected function chargerMetadonnees() {
$contenuSql = $this->recupererContenu(Config::get('chemins.metadonnees'));
$this->executerScripSql($contenuSql);
}
 
private function supprimerTous() {
$requete = "DROP TABLE IF EXISTS baseveg_meta, baseveg_ontologies, baseveg_v".Config::get('version');
$this->getBdd()->requeter($requete);
}
 
}
?>
/tags/v5.7-arrayanal/scripts/modules/baseveg/baseveg.ini
New file
0,0 → 1,26
version="2014_01_16"
dossierTsv = "{ref:dossierDonneesEflore}baseveg/2014-01-16/"
dossierSql = "{ref:dossierTsv}"
 
[tables]
donnees = "baseveg_v{ref:version}"
metadonnees = "baseveg_meta"
ontologies = "baseveg_ontologies"
 
[fichiers]
structureSql = "baseveg_v{ref:version}.sql"
metadonnees = "baseveg_insertion_meta_v{ref:version}.sql"
donnees = "baseveg_v{ref:version}.tsv"
ontologies = "baseveg_ontologies.tsv"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
donnees = "{ref:dossierTsv}{ref:fichiers.donnees}"
metadonnees = "{ref:dossierSql}{ref:fichiers.metadonnees}"
ontologies ="{ref:dossierTsv}{ref:fichiers.ontologies}"
 
[Parametres]
niveaux = "'CLA';'ALL';'ORD';'ASS';'GRPT';'SUBORD';'SUBASS';'BC';'SUBCLA';'DC';'SUBALL'"
synonymes = "'incl';'=';'= ?';'illeg';'pp';'pmaxp';'pminp';'compl';'ambig';'non';'inval';'nn';'ined'"
motifs = "/^[0-9]+$/=1;
/(?:[0-9]{2}\/$|[0-9]{2}\/[0-9]\.$|[0-9]{2}\/(?:[0-9]\.){1,5}[0-9]$|[0-9]{2}\/(?:[0-9]\.){4,5}[0-9]\/[0-9]+(?:bis|ter){0,1}$)|incertae sedis/=2"
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/WSProj4PHP_1.0.php
New file
0,0 → 1,104
<?php
 
include_once("proj4php.php");
 
$error = false;
 
/**
* Geometry-Points
*/
if( isset( $_GET['GEOM'] ) ) {
list($x, $y) = explode( ' ', $_GET['GEOM'] );
} else {
if( isset( $_GET['x'] ) ) {
$x = $_GET['x'];
}
else
$error = true;
 
if( isset( $_GET['y'] ) ) {
$y = $_GET['y'];
}
else
$error = true;
}
 
/**
* Source-CRS
*/
if( isset( $_GET['SOURCECRS'] ) ) {
$srcProjection = str_replace( '::', ':', $_GET['SOURCECRS'] );
} else if( isset( $_GET['projectionxy'] ) ) {
$srcProjection = $_GET['projectionxy'];
$srcProjection = str_replace( '::', ':', $srcProjection );
}
else
$srcProjection = 'EPSG:2154';
 
/**
* Target-CRS
*/
if( isset( $_GET['TARGETCRS'] ) ) {
$tgtProjection = str_replace( '::', ':', $_GET['TARGETCRS'] );
} else if( isset( $_GET['projection'] ) ) {
$tgtProjection = $_GET['projection'];
$tgtProjection = str_replace( '::', ':', $tgtProjection );
}
else
$tgtProjection = 'EPSG:4326';
 
/**
* Format
*/
if( isset( $_GET['format'] ) ) {
$format = $_GET['format'];
if( !($format == 'xml' || $format == 'json') )
$error = true;
}
else
$format = 'xml';
 
 
$proj4 = new Proj4php();
$projsource = new Proj4phpProj( $srcProjection, $proj4 );
$projdest = new Proj4phpProj( $tgtProjection, $proj4 );
 
// check the projections
if( Proj4php::$defs[$srcProjection] == Proj4php::$defs['WGS84'] && $srcProjection != 'EPSG:4326' )
$error = true;
if( Proj4php::$defs[$tgtProjection] == Proj4php::$defs['WGS84'] && $tgtProjection != 'EPSG:4326' )
$error = true;
 
if( $error === true ) {
if( $format == 'json' ) {
echo "{\"status\":\"error\", \"erreur\": {\"code\": 2, \"message\": \"Wrong parameters.\"} }";
exit;
} else {
echo "<reponse>";
echo " <erreur>";
echo " <code>2</code>";
echo " <message>Wrong parameters</message>";
echo " </erreur>";
echo "</reponse>";
exit;
}
}
 
$pointSrc = new proj4phpPoint( $x, $y );
$pointDest = $proj4->transform( $projsource, $projdest, $pointSrc );
 
$tgtProjection = str_replace( ':', '::', $tgtProjection );
 
if( $format == 'json' ) {
echo "{\"status\" :\"success\", \"point\" : {\"x\":" . $pointDest->x . ", \"y\":" . $pointDest->y . ",\"projection\" :\"" . $tgtProjection . "\"}}";
exit;
} else {
header ("Content-Type:text/xml");
echo "<reponse>";
echo "<point>";
echo "<x>" . $pointDest->x . "</x>";
echo "<y>" . $pointDest->y . "</y>";
echo "<projection>" . $tgtProjection . "</projection>";
echo "</point>";
echo "</reponse>";
}
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/proj4phpCommon.php
New file
0,0 → 1,389
<?php
 
/**
* Author : Julien Moquet
*
* Inspired by Proj4js from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodmap.com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
class Proj4phpCommon {
 
public $PI = M_PI; #3.141592653589793238; //Math.PI,
public $HALF_PI = M_PI_2; #1.570796326794896619; //Math.PI*0.5,
public $TWO_PI = 6.283185307179586477; //Math.PI*2,
public $FORTPI = 0.78539816339744833;
public $R2D = 57.29577951308232088;
public $D2R = 0.01745329251994329577;
public $SEC_TO_RAD = 4.84813681109535993589914102357e-6; /* SEC_TO_RAD = Pi/180/3600 */
public $EPSLN = 1.0e-10;
public $MAX_ITER = 20;
// following constants from geocent.c
public $COS_67P5 = 0.38268343236508977; /* cosine of 67.5 degrees */
public $AD_C = 1.0026000; /* Toms region 1 constant */
 
/* datum_type values */
public $PJD_UNKNOWN = 0;
public $PJD_3PARAM = 1;
public $PJD_7PARAM = 2;
public $PJD_GRIDSHIFT = 3;
public $PJD_WGS84 = 4; // WGS84 or equivalent
public $PJD_NODATUM = 5; // WGS84 or equivalent
 
const SRS_WGS84_SEMIMAJOR = 6378137.0; // only used in grid shift transforms
 
// ellipoid pj_set_ell.c
 
public $SIXTH = .1666666666666666667; /* 1/6 */
public $RA4 = .04722222222222222222; /* 17/360 */
public $RA6 = .02215608465608465608; /* 67/3024 */
public $RV4 = .06944444444444444444; /* 5/72 */
public $RV6 = .04243827160493827160; /* 55/1296 */
 
 
/* meridinal distance for ellipsoid and inverse
* * 8th degree - accurate to < 1e-5 meters when used in conjuction
* * with typical major axis values.
* * Inverse determines phi to EPS (1e-11) radians, about 1e-6 seconds.
*/
protected $C00 = 1.0;
protected $C02 = .25;
protected $C04 = .046875;
protected $C06 = .01953125;
protected $C08 = .01068115234375;
protected $C22 = .75;
protected $C44 = .46875;
protected $C46 = .01302083333333333333;
protected $C48 = .00712076822916666666;
protected $C66 = .36458333333333333333;
protected $C68 = .00569661458333333333;
protected $C88 = .3076171875;
 
/**
* Function to compute the constant small m which is the radius of
* a parallel of latitude, phi, divided by the semimajor axis.
*
* @param type $eccent
* @param type $sinphi
* @param type $cosphi
* @return type
*/
public function msfnz( $eccent, $sinphi, $cosphi ) {
$con = $eccent * $sinphi;
return $cosphi / (sqrt( 1.0 - $con * $con ));
}
 
/**
* Function to compute the constant small t for use in the forward
* computations in the Lambert Conformal Conic and the Polar
* Stereographic projections.
*
* @param type $eccent
* @param type $phi
* @param type $sinphi
* @return type
*/
public function tsfnz( $eccent, $phi, $sinphi ) {
$con = $eccent * $sinphi;
$com = 0.5 * $eccent;
$con = pow( ((1.0 - $con) / (1.0 + $con) ), $com );
return (tan( .5 * (M_PI_2 - $phi) ) / $con);
}
 
/**
* Function to compute the latitude angle, phi2, for the inverse of the
* Lambert Conformal Conic and Polar Stereographic projections.
*
* rise up an assertion if there is no convergence.
*
* @param type $eccent
* @param type $ts
* @return type
*/
public function phi2z( $eccent, $ts ) {
$eccnth = .5 * $eccent;
$phi = M_PI_2 - 2 * atan( $ts );
for( $i = 0; $i <= 15; $i++ ) {
$con = $eccent * sin( $phi );
$dphi = M_PI_2 - 2 * atan( $ts * (pow( ((1.0 - $con) / (1.0 + $con) ), $eccnth )) ) - $phi;
$phi += $dphi;
if( abs( $dphi ) <= .0000000001 )
return $phi;
}
assert( "false; /* phi2z has NoConvergence */" );
return (-9999);
}
 
/**
* Function to compute constant small q which is the radius of a
* parallel of latitude, phi, divided by the semimajor axis.
*
* @param type $eccent
* @param type $sinphi
* @return type
*/
public function qsfnz( $eccent, $sinphi ) {
if( $eccent > 1.0e-7 ) {
$con = $eccent * $sinphi;
return (( 1.0 - $eccent * $eccent) * ($sinphi / (1.0 - $con * $con) - (.5 / $eccent) * log( (1.0 - $con) / (1.0 + $con) )));
}
return (2.0 * $sinphi);
}
 
/**
* Function to eliminate roundoff errors in asin
*
* @param type $x
* @return type
*/
public function asinz( $x ) {
return asin(
abs( $x ) > 1.0 ? ($x > 1.0 ? 1.0 : -1.0) : $x
);
#if( abs( $x ) > 1.0 ) {
# $x = ($x > 1.0) ? 1.0 : -1.0;
#}
#return asin( $x );
}
 
/**
* following functions from gctpc cproj.c for transverse mercator projections
*
* @param type $x
* @return type
*/
public function e0fn( $x ) {
return (1.0 - 0.25 * $x * (1.0 + $x / 16.0 * (3.0 + 1.25 * $x)));
}
 
/**
*
* @param type $x
* @return type
*/
public function e1fn( $x ) {
return (0.375 * $x * (1.0 + 0.25 * $x * (1.0 + 0.46875 * $x)));
}
 
/**
*
* @param type $x
* @return type
*/
public function e2fn( $x ) {
return (0.05859375 * $x * $x * (1.0 + 0.75 * $x));
}
 
/**
*
* @param type $x
* @return type
*/
public function e3fn( $x ) {
return ($x * $x * $x * (35.0 / 3072.0));
}
 
/**
*
* @param type $e0
* @param type $e1
* @param type $e2
* @param type $e3
* @param type $phi
* @return type
*/
public function mlfn( $e0, $e1, $e2, $e3, $phi ) {
return ($e0 * $phi - $e1 * sin( 2.0 * $phi ) + $e2 * sin( 4.0 * $phi ) - $e3 * sin( 6.0 * $phi ));
}
 
/**
*
* @param type $esinp
* @param type $exp
* @return type
*/
public function srat( $esinp, $exp ) {
return (pow( (1.0 - $esinp) / (1.0 + $esinp), $exp ));
}
 
/**
* Function to return the sign of an argument
*
* @param type $x
* @return type
*/
public function sign( $x ) {
return $x < 0.0 ? -1 : 1;
}
 
/**
* Function to adjust longitude to -180 to 180; input in radians
*
* @param type $x
* @return type
*/
public function adjust_lon( $x ) {
return (abs( $x ) < M_PI) ? $x : ($x - ($this->sign( $x ) * $this->TWO_PI) );
}
 
/**
* IGNF - DGR : algorithms used by IGN France
* Function to adjust latitude to -90 to 90; input in radians
*
* @param type $x
* @return type
*/
public function adjust_lat( $x ) {
$x = (abs( $x ) < M_PI_2) ? $x : ($x - ($this->sign( $x ) * M_PI) );
return $x;
}
 
/**
* Latitude Isometrique - close to tsfnz ...
*
* @param type $eccent
* @param float $phi
* @param type $sinphi
* @return string
*/
public function latiso( $eccent, $phi, $sinphi ) {
if( abs( $phi ) > M_PI_2 )
return +NaN;
if( $phi == M_PI_2 )
return INF;
if( $phi == -1.0 * M_PI_2 )
return -1.0 * INF;
 
$con = $eccent * $sinphi;
return log( tan( (M_PI_2 + $phi) / 2.0 ) ) + $eccent * log( (1.0 - $con) / (1.0 + $con) ) / 2.0;
}
 
/**
*
* @param type $x
* @param type $L
* @return type
*/
public function fL( $x, $L ) {
return 2.0 * atan( $x * exp( $L ) ) - M_PI_2;
}
 
/**
* Inverse Latitude Isometrique - close to ph2z
*
* @param type $eccent
* @param type $ts
* @return type
*/
public function invlatiso( $eccent, $ts ) {
$phi = $this->fL( 1.0, $ts );
$Iphi = 0.0;
$con = 0.0;
do {
$Iphi = $phi;
$con = $eccent * sin( $Iphi );
$phi = $this->fL( exp( $eccent * log( (1.0 + $con) / (1.0 - $con) ) / 2.0 ), $ts );
} while( abs( $phi - $Iphi ) > 1.0e-12 );
return $phi;
}
 
/**
* Grande Normale
*
* @param type $a
* @param type $e
* @param type $sinphi
* @return type
*/
public function gN( $a, $e, $sinphi ) {
$temp = $e * $sinphi;
return $a / sqrt( 1.0 - $temp * $temp );
}
 
/**
* code from the PROJ.4 pj_mlfn.c file; this may be useful for other projections
*
* @param type $es
* @return type
*/
public function pj_enfn( $es ) {
 
$en = array( );
$en[0] = $this->C00 - $es * ($this->C02 + $es * ($this->C04 + $es * ($this->C06 + $es * $this->C08)));
$en[1] = es * ($this->C22 - $es * ($this->C04 + $es * ($this->C06 + $es * $this->C08)));
$t = $es * $es;
$en[2] = $t * ($this->C44 - $es * ($this->C46 + $es * $this->C48));
$t *= $es;
$en[3] = $t * ($this->C66 - $es * $this->C68);
$en[4] = $t * $es * $this->C88;
return $en;
}
 
/**
*
* @param type $phi
* @param type $sphi
* @param type $cphi
* @param type $en
* @return type
*/
public function pj_mlfn( $phi, $sphi, $cphi, $en ) {
$cphi *= $sphi;
$sphi *= $sphi;
return ($en[0] * $phi - $cphi * ($en[1] + $sphi * ($en[2] + $sphi * ($en[3] + $sphi * $en[4]))));
}
 
/**
*
* @param type $arg
* @param type $es
* @param type $en
* @return type
*/
public function pj_inv_mlfn( $arg, $es, $en ) {
$k = (float) 1 / (1 - $es);
$phi = $arg;
for( $i = Proj4php::$common->MAX_ITER; $i; --$i ) { /* rarely goes over 2 iterations */
$s = sin( $phi );
$t = 1. - $es * $s * $s;
//$t = $this->pj_mlfn($phi, $s, cos($phi), $en) - $arg;
//$phi -= $t * ($t * sqrt($t)) * $k;
$t = ($this->pj_mlfn( $phi, $s, cos( $phi ), $en ) - $arg) * ($t * sqrt( $t )) * $k;
$phi -= $t;
if( abs( $t ) < Proj4php::$common->EPSLN )
return $phi;
}
 
Proj4php::reportError( "cass:pj_inv_mlfn: Convergence error" );
 
return $phi;
}
 
}
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/gauss.php
New file
0,0 → 1,74
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
class Proj4phpProjGauss {
 
/**
*
*/
public function init() {
$sphi = sin( $this->lat0 );
$cphi = cos( $this->lat0 );
$cphi *= $cphi;
$this->rc = sqrt( 1.0 - $this->es ) / (1.0 - $this->es * $sphi * $sphi);
$this->C = sqrt( 1.0 + $this->es * $cphi * $cphi / (1.0 - $this->es) );
$this->phic0 = asin( $sphi / $this->C );
$this->ratexp = 0.5 * $this->C * $this->e;
$this->K = tan( 0.5 * $this->phic0 + Proj4php::$common->FORTPI ) / (pow( tan( 0.5 * $this->lat0 + Proj4php::$common->FORTPI ), $this->C ) * Proj4php::$common->srat( $this->e * $sphi, $this->ratexp ));
}
 
/**
*
* @param type $p
* @return type
*/
public function forward( $p ) {
$lon = $p->x;
$lat = $p->y;
 
$p->y = 2.0 * atan( $this->K * pow( tan( 0.5 * $lat + Proj4php::$common->FORTPI ), $this->C ) * Proj4php::$common->srat( $this->e * sin( $lat ), $this->ratexp ) ) - Proj4php::$common->HALF_PI;
$p->x = $this->C * $lon;
return $p;
}
 
/**
*
* @param type $p
* @return null
*/
public function inverse( $p ) {
$DEL_TOL = 1e-14;
$lon = $p->x / $this->C;
$lat = $p->y;
$num = pow( tan( 0.5 * $lat + Proj4php::$common . FORTPI ) / $this->K, 1. / $this->C );
for( $i = Proj4php::$common . MAX_ITER; $i > 0; --$i ) {
$lat = 2.0 * atan( $num * Proj4php::$common->srat( $this->e * sin( $p->y ), -0.5 * $this->e ) ) - Proj4php::$common->HALF_PI;
if( abs( $lat - $p->y ) < $DEL_TOL )
break;
$p->y = $lat;
}
/* convergence failed */
if( !$i ) {
Proj4php::reportError( "gauss:inverse:convergence failed" );
return null;
}
$p->x = $lon;
$p->y = $lat;
return $p;
}
 
}
 
Proj4php::$proj['gauss'] = new Proj4phpProjGauss();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/stere.php
New file
0,0 → 1,303
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
 
// Initialize the Stereographic projection
class Proj4phpProjStere {
 
protected $TOL = 1.e-8;
protected $NITER = 8;
protected $CONV = 1.e-10;
protected $S_POLE = 0;
protected $N_POLE = 1;
protected $OBLIQ = 2;
protected $EQUIT = 3;
 
/**
*
* @param type $phit
* @param type $sinphi
* @param type $eccen
* @return type
*/
public function ssfn_( $phit, $sinphi, $eccen ) {
$sinphi *= $eccen;
return (tan( .5 * (Proj4php::$common->HALF_PI + $phit) ) * pow( (1. - $sinphi) / (1. + $sinphi), .5 * $eccen ));
}
/**
*
*/
public function init() {
$this->phits = $this->lat_ts ? $this->lat_ts : Proj4php::$common->HALF_PI;
$t = abs( $this->lat0 );
if( (abs( $t ) - Proj4php::$common->HALF_PI) < Proj4php::$common->EPSLN ) {
$this->mode = $this->lat0 < 0. ? $this->S_POLE : $this->N_POLE;
} else {
$this->mode = $t > Proj4php::$common->EPSLN ? $this->OBLIQ : $this->EQUIT;
}
$this->phits = abs( $this->phits );
if( $this->es ) {
#$X;
 
switch( $this->mode ) {
case $this->N_POLE:
case $this->S_POLE:
if( abs( $this->phits - Proj4php::$common->HALF_PI ) < Proj4php::$common->EPSLN ) {
$this->akm1 = 2. * $this->k0 / sqrt( pow( 1 + $this->e, 1 + $this->e ) * pow( 1 - $this->e, 1 - $this->e ) );
} else {
$t = sin( $this->phits );
$this->akm1 = cos( $this->phits ) / Proj4php::$common->tsfnz( $this->e, $this->phits, $t );
$t *= $this->e;
$this->akm1 /= sqrt( 1. - $t * $t );
}
break;
case $this->EQUIT:
$this->akm1 = 2. * $this->k0;
break;
case $this->OBLIQ:
$t = sin( $this->lat0 );
$X = 2. * atan( $this->ssfn_( $this->lat0, $t, $this->e ) ) - Proj4php::$common->HALF_PI;
$t *= $this->e;
$this->akm1 = 2. * $this->k0 * cos( $this->lat0 ) / sqrt( 1. - $t * $t );
$this->sinX1 = sin( $X );
$this->cosX1 = cos( $X );
break;
}
} else {
switch( $this->mode ) {
case $this->OBLIQ:
$this->sinph0 = sin( $this->lat0 );
$this->cosph0 = cos( $this->lat0 );
case $this->EQUIT:
$this->akm1 = 2. * $this->k0;
break;
case $this->S_POLE:
case $this->N_POLE:
$this->akm1 = abs( $this->phits - Proj4php::$common->HALF_PI ) >= Proj4php::$common->EPSLN ?
cos( $this->phits ) / tan( Proj4php::$common->FORTPI - .5 * $this->phits ) :
2. * $this->k0;
break;
}
}
}
 
/**
* Stereographic forward equations--mapping lat,long to x,y
*
* @param type $p
* @return type
*/
public function forward( $p ) {
$lon = $p->x;
$lon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
$lat = $p->y;
#$x;
#$y;
 
if( $this->sphere ) {
/*
$sinphi;
$cosphi;
$coslam;
$sinlam;
*/
$sinphi = sin( $lat );
$cosphi = cos( $lat );
$coslam = cos( $lon );
$sinlam = sin( $lon );
switch( $this->mode ) {
case $this->EQUIT:
$y = 1. + $cosphi * $coslam;
if( y <= Proj4php::$common->EPSLN ) {
Proj4php::reportError("stere:forward:Equit");
}
$y = $this->akm1 / $y;
$x = $y * $cosphi * $sinlam;
$y *= $sinphi;
break;
case $this->OBLIQ:
$y = 1. + $this->sinph0 * $sinphi + $this->cosph0 * $cosphi * $coslam;
if( $y <= Proj4php::$common->EPSLN ) {
Proj4php::reportError("stere:forward:Obliq");
}
$y = $this->akm1 / $y;
$x = $y * $cosphi * $sinlam;
$y *= $this->cosph0 * $sinphi - $this->sinph0 * $cosphi * $coslam;
break;
case $this->N_POLE:
$coslam = -$coslam;
$lat = -$lat;
//Note no break here so it conitnues through S_POLE
case $this->S_POLE:
if( abs( $lat - Proj4php::$common->HALF_PI ) < $this->TOL ) {
Proj4php::reportError("stere:forward:S_POLE");
}
$y = $this->akm1 * tan( Proj4php::$common->FORTPI + .5 * $lat );
$x = $sinlam * $y;
$y *= $coslam;
break;
}
} else {
$coslam = cos( $lon );
$sinlam = sin( $lon );
$sinphi = sin( $lat );
if( $this->mode == $this->OBLIQ || $this->mode == $this->EQUIT ) {
$Xt = 2. * atan( $this->ssfn_( $lat, $sinphi, $this->e ) );
$sinX = sin( $Xt - Proj4php::$common->HALF_PI );
$cosX = cos( $Xt );
}
switch( $this->mode ) {
case $this->OBLIQ:
$A = $this->akm1 / ($this->cosX1 * (1. + $this->sinX1 * $sinX + $this->cosX1 * $cosX * $coslam));
$y = $A * ($this->cosX1 * $sinX - $this->sinX1 * $cosX * $coslam);
$x = $A * $cosX;
break;
case $this->EQUIT:
$A = 2. * $this->akm1 / (1. + $cosX * $coslam);
$y = $A * $sinX;
$x = $A * $cosX;
break;
case $this->S_POLE:
$lat = -$lat;
$coslam = - $coslam;
$sinphi = -$sinphi;
case $this->N_POLE:
$x = $this->akm1 * Proj4php::$common->tsfnz( $this->e, $lat, $sinphi );
$y = - $x * $coslam;
break;
}
$x = $x * $sinlam;
}
$p->x = $x * $this->a + $this->x0;
$p->y = $y * $this->a + $this->y0;
return $p;
}
 
 
/**
* Stereographic inverse equations--mapping x,y to lat/long
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
$x = ($p->x - $this->x0) / $this->a; /* descale and de-offset */
$y = ($p->y - $this->y0) / $this->a;
/*
$lon;
$lat;
$cosphi;
$sinphi;
$rho;
$tp = 0.0;
$phi_l = 0.0;
$i;
*/
$halfe = 0.0;
$pi2 = 0.0;
 
if( $this->sphere ) {
/*
$c;
$rh;
$sinc;
$cosc;
*/
$rh = sqrt( $x * $x + $y * $y );
$c = 2. * atan( $rh / $this->akm1 );
$sinc = sin( $c );
$cosc = cos( $c );
$lon = 0.;
switch( $this->mode ) {
case $this->EQUIT:
if( abs( $rh ) <= Proj4php::$common->EPSLN ) {
$lat = 0.;
} else {
$lat = asin( $y * $sinc / $rh );
}
if( $cosc != 0. || $x != 0. )
$lon = atan2( $x * $sinc, $cosc * $rh );
break;
case $this->OBLIQ:
if( abs( $rh ) <= Proj4php::$common->EPSLN ) {
$lat = $this->phi0;
} else {
$lat = asin( $cosc * $this->sinph0 + $y * $sinc * $this->cosph0 / $rh );
}
$c = $cosc - $this->sinph0 * sin( $lat );
if( $c != 0. || $x != 0. ) {
$lon = atan2( $x * $sinc * $this->cosph0, $c * $rh );
}
break;
case $this->N_POLE:
$y = -$y;
case $this->S_POLE:
if( abs( $rh ) <= Proj4php::$common->EPSLN ) {
$lat = $this->phi0;
} else {
$lat = asin( $this->mode == $this->S_POLE ? -$cosc : $cosc );
}
$lon = ($x == 0. && $y == 0.) ? 0. : atan2( $x, $y );
break;
}
$p->x = Proj4php::$common->adjust_lon( $lon + $this->long0 );
$p->y = $lat;
} else {
$rho = sqrt( $x * $x + $y * $y );
switch( $this->mode ) {
case $this->OBLIQ:
case $this->EQUIT:
$tp = 2. * atan2( $rho * $this->cosX1, $this->akm1 );
$cosphi = cos( $tp );
$sinphi = sin( $tp );
if( $rho == 0.0 ) {
$phi_l = asin( $cosphi * $this->sinX1 );
} else {
$phi_l = asin( $cosphi * $this->sinX1 + ($y * $sinphi * $this->cosX1 / $rho) );
}
 
$tp = tan( .5 * (Proj4php::$common->HALF_PI + $phi_l) );
$x *= $sinphi;
$y = $rho * $this->cosX1 * $cosphi - $y * $this->sinX1 * $sinphi;
$pi2 = Proj4php::$common->HALF_PI;
$halfe = .5 * $this->e;
break;
case $this->N_POLE:
$y = -$y;
case $this->S_POLE:
$tp = - $rho / $this->akm1;
$phi_l = Proj4php::$common->HALF_PI - 2. * atan( $tp );
$pi2 = -Proj4php::$common->HALF_PI;
$halfe = -.5 * $this->e;
break;
}
for( $i = $this->NITER; $i--; $phi_l = $lat ) { //check this
$sinphi = $this->e * sin( $phi_l );
$lat = 2. * atan( $tp * pow( (1. + $sinphi) / (1. - $sinphi), $halfe ) ) - $pi2;
if( abs( phi_l - lat ) < $this->CONV ) {
if( $this->mode == $this->S_POLE )
$lat = -$lat;
$lon = ($x == 0. && $y == 0.) ? 0. : atan2( $x, $y );
$p->x = Proj4php::$common->adjust_lon( $lon + $this->long0 );
$p->y = $lat;
return $p;
}
}
}
}
 
}
 
Proj4php::$proj['stere'] = new Proj4phpProjStere();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/poly.php
New file
0,0 → 1,192
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
 
 
/* Function to compute, phi4, the latitude for the inverse of the
Polyconic projection.
------------------------------------------------------------ */
function phi4z( $eccent, $e0, $e1, $e2, $e3, $a, $b, &$c, $phi ) {
/*
$sinphi;
$sin2ph;
$tanph;
$ml;
$mlp;
$con1;
$con2;
$con3;
$dphi;
$i;
*/
 
$phi = $a;
for( $i = 1; $i <= 15; $i++ ) {
$sinphi = sin( $phi );
$tanphi = tan( $phi );
$c = $tanphi * sqrt( 1.0 - $eccent * $sinphi * $sinphi );
$sin2ph = sin( 2.0 * $phi );
/*
ml = e0 * *phi - e1 * sin2ph + e2 * sin (4.0 * *phi);
mlp = e0 - 2.0 * e1 * cos (2.0 * *phi) + 4.0 * e2 * cos (4.0 * *phi);
*/
$ml = $e0 * $phi - $e1 * $sin2ph + $e2 * sin( 4.0 * $phi ) - $e3 * sin( 6.0 * $phi );
$mlp = $e0 - 2.0 * $e1 * cos( 2.0 * $phi ) + 4.0 * $e2 * cos( 4.0 * $phi ) - 6.0 * $e3 * cos( 6.0 * $phi );
$con1 = 2.0 * $ml + $c * ($ml * $ml + $b) - 2.0 * $a * ($c * $ml + 1.0);
$con2 = $eccent * $sin2ph * ($ml * $ml + $b - 2.0 * $a * $ml) / (2.0 * $c);
$con3 = 2.0 * ($a - $ml) * ($c * $mlp - 2.0 / $sin2ph) - 2.0 * $mlp;
$dphi = $con1 / ($con2 + $con3);
$phi += $dphi;
if( abs( $dphi ) <= .0000000001 )
return($phi);
}
Proj4php::reportError( "phi4z: No convergence" );
return null;
}
 
/* Function to compute the constant e4 from the input of the eccentricity
of the spheroid, x. This constant is used in the Polar Stereographic
projection.
-------------------------------------------------------------------- */
function e4fn( $x ) {
#$con;
#$com;
$con = 1.0 + $x;
$com = 1.0 - $x;
return (sqrt( (pow( $con, $con )) * (pow( $com, $com )) ));
}
 
/* * *****************************************************************************
NAME POLYCONIC
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Polyconic projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
T. Mittan Mar, 1993
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
* ***************************************************************************** */
 
class Proj4phpProjPoly {
/* Initialize the POLYCONIC projection
---------------------------------- */
public function init() {
#$temp; /* temporary variable */
if( $this->lat0 == 0 )
$this->lat0 = 90; //$this->lat0 ca
 
/* Place parameters in static storage for common use
------------------------------------------------- */
$this->temp = $this->b / $this->a;
$this->es = 1.0 - pow( $this->temp, 2 ); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles
$this->e = sqrt( $this->es );
$this->e0 = Proj4php::$common->e0fn( $this->es );
$this->e1 = Proj4php::$common->e1fn( $this->es );
$this->e2 = Proj4php::$common->e2fn( $this->es );
$this->e3 = Proj4php::$common->e3fn( $this->es );
$this->ml0 = Proj4php::$common->mlfn( $this->e0, $this->e1, $this->e2, $this->e3, $this->lat0 ); //si que des zeros le calcul ne se fait pas
//if (!$this->ml0) {$this->ml0=0;}
}
 
/* Polyconic forward equations--mapping lat,long to x,y
--------------------------------------------------- */
public function forward( $p ) {
/*
$sinphi;
$cosphi; // sin and cos value
$al; // temporary values
$c; // temporary values
$con;
$ml; // cone constant, small m
$ms; // small m
$x;
$y;
*/
$lon = $p->x;
$lat = $p->y;
 
$con = Proj4php::$common->adjust_lon( $lon - $this->long0 );
if( abs( $lat ) <= .0000001 ) {
$x = $this->x0 + $this->a * $con;
$y = $this->y0 - $this->a * $this->ml0;
} else {
$sinphi = sin( $lat );
$cosphi = cos( $lat );
$ml = Proj4php::$common->mlfn( $this->e0, $this->e1, $this->e2, $this->e3, $lat );
$ms = Proj4php::$common->msfnz( $this->e, $sinphi, $cosphi );
$x = $this->x0 + $this->a * $ms * sin( $sinphi ) / $sinphi;
$y = $this->y0 + $this->a * ($ml - $this->ml0 + $ms * (1.0 - cos( $sinphi )) / $sinphi);
}
 
$p->x = $x;
$p->y = $y;
return $p;
}
 
/* Inverse equations
----------------- */
public function inverse( $p ) {
/*
$sin_phi;
$cos_phi; // sin and cos values
$al; // temporary values
$b; // temporary values
$c; // temporary values
$con;
$ml; // cone constant, small m
$iflg; // error flag
$lon;
$lat;
*/
$p->x -= $this->x0;
$p->y -= $this->y0;
$al = $this->ml0 + $p->y / $this->a;
$iflg = 0;
 
if( abs( $al ) <= .0000001 ) {
$lon = $p->x / $this->a + $this->long0;
$lat = 0.0;
} else {
$b = $al * $al + ($p->x / $this->a) * ($p->x / $this->a);
$iflg = phi4z( $this->es, $this->e0, $this->e1, $this->e2, $this->e3, $this->al, $b, $c, $lat );
if( $iflg != 1 )
return($iflg);
$lon = Proj4php::$common->adjust_lon( (Proj4php::$common->asinz( $p->x * $c / $this->a ) / sin( $lat )) + $this->long0 );
}
 
$p->x = $lon;
$p->y = $lat;
return $p;
}
 
}
 
Proj4php::$proj['poly'] = new Proj4phpProjPoly();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/sterea.php
New file
0,0 → 1,91
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
class Proj4phpProjSterea {
 
protected $dependsOn = 'gauss';
/**
*
* @return void
*/
public function init() {
if( !$this->rc ) {
Proj4php::reportError( "sterea:init:E_ERROR_0" );
return;
}
$this->sinc0 = sin( $this->phic0 );
$this->cosc0 = cos( $this->phic0 );
$this->R2 = 2.0 * $this->rc;
if( !$this->title )
$this->title = "Oblique Stereographic Alternative";
}
 
/**
*
* @param type $p
* @return type
*/
public function forward( $p ) {
$p->x = Proj4php::$common->adjust_lon( $p->x - $this->long0 ); /* adjust del longitude */
$p = Proj4php::$proj['gauss']->forward( $p );
$sinc = sin( $p->y );
$cosc = cos( $p->y );
$cosl = cos( $p->x );
$k = $this->k0 * $this->R2 / (1.0 + $this->sinc0 * $sinc + $this->cosc0 * $cosc * $cosl);
$p->x = $k * $cosc * sin( $p->x );
$p->y = $k * ($this->cosc0 * sinc - $this->sinc0 * $cosc * $cosl);
$p->x = $this->a * $p->x + $this->x0;
$p->y = $this->a * $p->y + $this->y0;
return $p;
}
 
/**
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
#$lon;
#$lat;
$p->x = ($p->x - $this->x0) / $this->a; /* descale and de-offset */
$p->y = ($p->y - $this->y0) / $this->a;
 
$p->x /= $this->k0;
$p->y /= $this->k0;
if( ($rho = sqrt( $p->x * $p->x + $p->y * $p->y ) ) ) {
$c = 2.0 * atan2( $rho, $this->R2 );
$sinc = sin( $c );
$cosc = cos( $c );
$lat = asin( $cosc * $this->sinc0 + $p->y * $sinc * $this->cosc0 / $rho );
$lon = atan2( $p->x * $sinc, $rho * $this->cosc0 * $cosc - $p->y * $this->sinc0 * $sinc );
} else {
$lat = $this->phic0;
$lon = 0.;
}
 
$p->x = $lon;
$p->y = $lat;
$p = Proj4php::$proj['gauss']->inverse( $p );
$p->x = Proj4php::$common->adjust_lon( $p->x + $this->long0 ); /* adjust longitude to CM */
return $p;
}
 
}
 
Proj4php::$proj['sterea'] = new Proj4phpProjSterea();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/merc.php
New file
0,0 → 1,129
<?php
 
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/* * *****************************************************************************
NAME MERCATOR
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Mercator projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
D. Steinwand, EROS Nov, 1991
T. Mittan Mar, 1993
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
* ***************************************************************************** */
 
//static double r_major = a; /* major axis */
//static double r_minor = b; /* minor axis */
//static double lon_center = long0; /* Center longitude (projection center) */
//static double lat_origin = lat0; /* center latitude */
//static double e,es; /* eccentricity constants */
//static double m1; /* small value m */
//static double false_northing = y0; /* y offset in meters */
//static double false_easting = x0; /* x offset in meters */
//scale_fact = k0
 
class Proj4phpProjMerc {
 
public function init() {
//?$this->temp = $this->r_minor / $this->r_major;
//$this->temp = $this->b / $this->a;
//$this->es = 1.0 - sqrt($this->temp);
//$this->e = sqrt( $this->es );
//?$this->m1 = cos($this->lat_origin) / (sqrt( 1.0 - $this->es * sin($this->lat_origin) * sin($this->lat_origin)));
//$this->m1 = cos(0.0) / (sqrt( 1.0 - $this->es * sin(0.0) * sin(0.0)));
if( $this->lat_ts ) {
if( $this->sphere ) {
$this->k0 = cos( $this->lat_ts );
} else {
$this->k0 = Proj4php::$common->msfnz( $this->es, sin( $this->lat_ts ), cos( $this->lat_ts ) );
}
}
}
 
/* Mercator forward equations--mapping lat,long to x,y
-------------------------------------------------- */
 
public function forward( $p ) {
//alert("ll2m coords : ".coords);
$lon = $p->x;
$lat = $p->y;
// convert to radians
if( $lat * Proj4php::$common->R2D > 90.0 &&
$lat * Proj4php::$common->R2D < -90.0 &&
$lon * Proj4php::$common->R2D > 180.0 &&
$lon * Proj4php::$common->R2D < -180.0 ) {
Proj4php::reportError( "merc:forward: llInputOutOfRange: " . $lon . " : " . $lat );
return null;
}
if( abs( abs( $lat ) - Proj4php::$common->HALF_PI ) <= Proj4php::$common->EPSLN ) {
Proj4php::reportError( "merc:forward: ll2mAtPoles" );
return null;
} else {
if( $this->sphere ) {
$x = $this->x0 + $this->a * $this->k0 * Proj4php::$common->adjust_lon( $lon - $this->long0 );
$y = $this->y0 + $this->a * $this->k0 * log( tan( Proj4php::$common->FORTPI + 0.5 * $lat ) );
} else {
$sinphi = sin( lat );
$ts = Proj4php::$common . tsfnz( $this->e, $lat, $sinphi );
$x = $this->x0 + $this->a * $this->k0 * Proj4php::$common->adjust_lon( $lon - $this->long0 );
$y = $this->y0 - $this->a * $this->k0 * log( $ts );
}
$p->x = $x;
$p->y = $y;
return $p;
}
}
 
/* Mercator inverse equations--mapping x,y to lat/long
-------------------------------------------------- */
 
public function inverse( $p ) {
 
$x = $p->x - $this->x0;
$y = $p->y - $this->y0;
if( $this->sphere ) {
$lat = Proj4php::$common->HALF_PI - 2.0 * atan( exp( -$y / $this->a * $this->k0 ) );
} else {
$ts = exp( -$y / ($this->a * $this->k0) );
$lat = Proj4php::$common->phi2z( $this->e, $ts );
if( $lat == -9999 ) {
Proj4php::reportError( "merc:inverse: lat = -9999" );
return null;
}
}
$lon = Proj4php::$common->adjust_lon( $this->long0 + $x / ($this->a * $this->k0) );
 
$p->x = $lon;
$p->y = $lat;
return $p;
}
 
}
 
Proj4php::$proj['merc'] = new Proj4phpProjMerc();
 
 
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/aea.php
New file
0,0 → 1,184
<?php
/*******************************************************************************
NAME ALBERS CONICAL EQUAL AREA
 
PURPOSE: Transforms input longitude and latitude to Easting and Northing
for the Albers Conical Equal Area projection. The longitude
and latitude must be in radians. The Easting and Northing
values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
T. Mittan, Feb, 1992
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
*******************************************************************************/
 
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
class Proj4phpProjAea {
 
/**
*
* @return void
*/
public function init() {
 
if( abs( $this->lat1 + $this->lat2 ) < Proj4php::$common->EPSLN ) {
Proj4php::reportError( "aeaInitEqualLatitudes" );
return;
}
$this->temp = $this->b / $this->a;
$this->es = 1.0 - pow( $this->temp, 2 );
$this->e3 = sqrt( $this->es );
 
$this->sin_po = sin( $this->lat1 );
$this->cos_po = cos( $this->lat1 );
$this->t1 = $this->sin_po;
$this->con = $this->sin_po;
$this->ms1 = Proj4php::$common->msfnz( $this->e3, $this->sin_po, $this->cos_po );
$this->qs1 = Proj4php::$common->qsfnz( $this->e3, $this->sin_po, $this->cos_po );
 
$this->sin_po = sin( $this->lat2 );
$this->cos_po = cos( $this->lat2 );
$this->t2 = $this->sin_po;
$this->ms2 = Proj4php::$common->msfnz( $this->e3, $this->sin_po, $this->cos_po );
$this->qs2 = Proj4php::$common->qsfnz( $this->e3, $this->sin_po, $this->cos_po );
 
$this->sin_po = sin( $this->lat0 );
$this->cos_po = cos( $this->lat0 );
$this->t3 = $this->sin_po;
$this->qs0 = Proj4php::$common->qsfnz( $this->e3, $this->sin_po, $this->cos_po );
 
if( abs( $this->lat1 - $this->lat2 ) > Proj4php::$common->EPSLN ) {
$this->ns0 = ($this->ms1 * $this->ms1 - $this->ms2 * $this->ms2) / ($this->qs2 - $this->qs1);
} else {
$this->ns0 = $this->con;
}
$this->c = $this->ms1 * $this->ms1 + $this->ns0 * $this->qs1;
$this->rh = $this->a * sqrt( $this->c - $this->ns0 * $this->qs0 ) / $this->ns0;
}
 
/**
* Albers Conical Equal Area forward equations--mapping lat,long to x,y
*
* @param Point $p
* @return Point $p
*/
public function forward( $p ) {
 
$lon = $p->x;
$lat = $p->y;
 
$this->sin_phi = sin( $lat );
$this->cos_phi = cos( $lat );
 
$qs = Proj4php::$common->qsfnz( $this->e3, $this->sin_phi, $this->cos_phi );
$rh1 = $this->a * sqrt( $this->c - $this->ns0 * $qs ) / $this->ns0;
$theta = $this->ns0 * Proj4php::$common->adjust_lon( $lon - $this->long0 );
$x = rh1 * sin( $theta ) + $this->x0;
$y = $this->rh - $rh1 * cos( $theta ) + $this->y0;
 
$p->x = $x;
$p->y = $y;
return $p;
}
 
/**
*
* @param Point $p
* @return Point $p
*/
public function inverse( $p ) {
$p->x -= $this->x0;
$p->y = $this->rh - $p->y + $this->y0;
if( $this->ns0 >= 0 ) {
$rh1 = sqrt( $p->x * $p->x + $p->y * $p->y );
$con = 1.0;
} else {
$rh1 = -sqrt( $p->x * $p->x + $p->y * $p->y );
$con = -1.0;
}
$theta = 0.0;
if( $rh1 != 0.0 ) {
$theta = atan2( $con * $p->x, $con * $p->y );
}
$con = $rh1 * $this->ns0 / $this->a;
$qs = ($this->c - $con * $con) / $this->ns0;
if( $this->e3 >= 1e-10 ) {
$con = 1 - .5 * (1.0 - $this->es) * log( (1.0 - $this->e3) / (1.0 + $this->e3) ) / $this->e3;
if( abs( abs( $con ) - abs( $qs ) ) > .0000000001 ) {
$lat = $this->phi1z( $this->e3, $qs );
} else {
if( $qs >= 0 ) {
$lat = .5 * Proj4php::$Common->PI;
} else {
$lat = -.5 * Proj4php::$Common->PI;
}
}
} else {
$lat = $this->phi1z( $this->e3, $qs );
}
 
$lon = Proj4php::$common->adjust_lon( $theta / $this->ns0 + $this->long0 );
$p->x = $lon;
$p->y = $lat;
return $p;
}
 
/**
* Function to compute phi1, the latitude for the inverse of the Albers Conical Equal-Area projection.
*
* @param type $eccent
* @param type $qs
* @return $phi or null on Convergence error
*/
public function phi1z( $eccent, $qs ) {
$phi = Proj4php::$common->asinz( .5 * $qs );
if( $eccent < Proj4php::$common->EPSLN )
return $phi;
 
$eccnts = $eccent * $eccent;
for( $i = 1; $i <= 25; ++$i ) {
$sinphi = sin( $phi );
$cosphi = cos( $phi );
$con = $eccent * $sinphi;
$com = 1.0 - $con * $con;
$dphi = .5 * $com * $com / $cosphi * ($qs / (1.0 - $eccnts) - $sinphi / $com + .5 / $eccent * log( (1.0 - $con) / (1.0 + $con) ));
$phi = $phi + $dphi;
if( abs( $dphi ) <= 1e-7 )
return $phi;
}
Proj4php::reportError( "aea:phi1z:Convergence error" );
return null;
}
 
}
 
Proj4php::$proj['aea'] = new Proj4phpProjAea();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/cea.php
New file
0,0 → 1,97
<?php
/*******************************************************************************
NAME LAMBERT CYLINDRICAL EQUAL AREA
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Lambert Cylindrical Equal Area projection.
This class of projection includes the Behrmann and
Gall-Peters Projections. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
R. Marsden August 2009
Winwaed Software Tech LLC, http://www.winwaed.com
 
This function was adapted from the Miller Cylindrical Projection in the Proj4php
library.
 
Note: This implementation assumes a Spherical Earth. The (commented) code
has been included for the ellipsoidal forward transform, but derivation of
the ellispoidal inverse transform is beyond me. Note that most of the
Proj4php implementations do NOT currently support ellipsoidal figures.
Therefore this is not seen as a problem - especially this lack of support
is explicitly stated here.
 
ALGORITHM REFERENCES
 
1. "Cartographic Projection Procedures for the UNIX Environment -
A User's Manual" by Gerald I. Evenden, USGS Open File Report 90-284
and Release 4 Interim Reports (2003)
 
2. Snyder, John P., "Flattening the Earth - Two Thousand Years of Map
Projections", Univ. Chicago Press, 1993
****************************************************************************** */
 
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
class Proj4phpProjCea {
/* Initialize the Cylindrical Equal Area projection
------------------------------------------- */
 
public function init() {
//no-op
}
 
/* Cylindrical Equal Area forward equations--mapping lat,long to x,y
------------------------------------------------------------ */
public function forward( $p ) {
$lon = $p->x;
$lat = $p->y;
/* Forward equations
----------------- */
$dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
$x = $this->x0 + $this->a * $dlon * cos( $this->lat_ts );
$y = $this->y0 + $this->a * sin( $lat ) / cos( $this->lat_ts );
/* Elliptical Forward Transform
Not implemented due to a lack of a matchign inverse function
{
$Sin_Lat = sin(lat);
$Rn = $this->a * (sqrt(1.0e0 - $this->es * Sin_Lat * Sin_Lat ));
x = $this->x0 + $this->a * dlon * cos($this->lat_ts);
y = $this->y0 + Rn * sin(lat) / cos($this->lat_ts);
}
*/
 
$p->x = $x;
$p->y = $y;
return $p;
}
 
/**
* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
$p->x -= $this->x0;
$p->y -= $this->y0;
 
$p->x = Proj4php::$common->adjust_lon( $this->long0 + ($p->x / $this->a) / cos( $this->lat_ts ) );
$p->y = asin( ($p->y / $this->a) * cos( $this->lat_ts ) );
return $p;
}
}
 
Proj4php::$proj['cea'] = new Proj4phpProjCea();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/somerc.php
New file
0,0 → 1,135
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*******************************************************************************
NAME SWISS OBLIQUE MERCATOR
 
PURPOSE: Swiss projection.
WARNING: X and Y are inverted (weird) in the swiss coordinate system. Not
here, since we want X to be horizontal and Y vertical.
 
ALGORITHM REFERENCES
1. "Formules et constantes pour le Calcul pour la
projection cylindrique conforme à axe oblique et pour la transformation entre
des systèmes de référence".
http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
 
*******************************************************************************/
 
class Proj4phpProjSomerc {
 
/**
*
*/
public function init() {
$phy0 = $this->lat0;
$this->lambda0 = $this->long0;
$sinPhy0 = sin( $phy0 );
$semiMajorAxis = $this->a;
$invF = $this->rf;
$flattening = 1 / $invF;
$e2 = 2 * $flattening - pow( $flattening, 2 );
$e = $this->e = sqrt( $e2 );
$this->R = $this->k0 * $semiMajorAxis * sqrt( 1 - $e2 ) / (1 - $e2 * pow( $sinPhy0, 2.0 ));
$this->alpha = sqrt( 1 + $e2 / (1 - $e2) * pow( cos( $phy0 ), 4.0 ) );
$this->b0 = asin( $sinPhy0 / $this->alpha );
$this->K = log( tan( $PI / 4.0 + $this->b0 / 2.0 ) )
- $this->alpha
* log( tan( $PI / 4.0 + $phy0 / 2.0 ) )
+ $this->alpha
* $e / 2
* log( (1 + $e * $sinPhy0)
/ (1 - $e * $sinPhy0) );
}
 
/**
*
* @param type $p
* @return type
*/
public function forward( $p ) {
$Sa1 = log( tan( $PI / 4.0 - $p->y / 2.0 ) );
$Sa2 = $this->e / 2.0
* log( (1 + $this->e * sin( $p->y ))
/ (1 - $this->e * sin( $p->y )) );
$S = -$this->alpha * ($Sa1 + $Sa2) + $this->K;
 
// spheric latitude
$b = 2.0 * (atan( exp( $S ) ) - proj4phpCommon::PI / 4.0);
 
// spheric longitude
$I = $this->alpha * ($p->x - $this->lambda0);
 
// psoeudo equatorial rotation
$rotI = atan( sin( $I )
/ (sin( $this->b0 ) * tan( $b ) +
cos( $this->b0 ) * cos( $I )) );
 
$rotB = asin( cos( $this->b0 ) * sin( $b ) -
sin( $this->b0 ) * cos( $b ) * cos( $I ) );
 
$p->y = $this->R / 2.0
* log( (1 + sin( $rotB )) / (1 - sin( $rotB )) )
+ $this->y0;
$p->x = $this->R * $rotI + $this->x0;
return $p;
}
 
/**
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
$Y = $p->x - $this->x0;
$X = $p->y - $this->y0;
 
$rotI = $Y / $this->R;
$rotB = 2 * (atan( exp( $X / $this->R ) ) - $PI / 4.0);
 
$b = asin( cos( $this->b0 ) * sin( $rotB )
+ sin( $this->b0 ) * cos( $rotB ) * cos( $rotI ) );
$I = atan( sin( $rotI )
/ (cos( $this->b0 ) * cos( $rotI ) - sin( $this->b0 )
* tan( $rotB )) );
 
$lambda = $this->lambda0 + $I / $this->alpha;
 
$S = 0.0;
$phy = $b;
$prevPhy = -1000.0;
$iteration = 0;
while( abs( $phy - $prevPhy ) > 0.0000001 ) {
if( ++$iteration > 20 ) {
Proj4php::reportError( "omercFwdInfinity" );
return;
}
//S = log(tan(PI / 4.0 + phy / 2.0));
$S = 1.0
/ $this->alpha
* (log( tan( $PI / 4.0 + $b / 2.0 ) ) - $this->K)
+ $this->e
* log( tan( $PI / 4.0
+ asin( $this->e * sin( $phy ) )
/ 2.0 ) );
$prevPhy = $phy;
$phy = 2.0 * atan( exp( $S ) ) - $PI / 2.0;
}
 
$p->x = $lambda;
$p->y = $phy;
return $p;
}
 
}
 
Proj4php::$proj['somerc'] = new Proj4phpProjSomerc();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/cass.php
New file
0,0 → 1,118
<?php
 
/*******************************************************************************
NAME CASSINI
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Cassini projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
Ported from PROJ.4.
 
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
****************************************************************************** */
 
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
//Proj4php.defs["EPSG:28191"] = "+proj=cass +lat_0=31.73409694444445 +lon_0=35.21208055555556 +x_0=170251.555 +y_0=126867.909 +a=6378300.789 +b=6356566.435 +towgs84=-275.722,94.7824,340.894,-8.001,-4.42,-11.821,1 +units=m +no_defs";
// Initialize the Cassini projection
// -----------------------------------------------------------------
 
class Proj4phpProjCass {
 
public function init() {
if( !$this->sphere ) {
$this->en = Proj4php::$common->pj_enfn( $this->es );
$this->m0 = Proj4php::$common->pj_mlfn( $this->lat0, sin( $this->lat0 ), cos( $this->lat0 ), $this->en );
}
}
 
protected $C1 = .16666666666666666666;
protected $C2 = .00833333333333333333;
protected $C3 = .04166666666666666666;
protected $C4 = .33333333333333333333;
protected $C5 = .06666666666666666666;
 
/* Cassini forward equations--mapping lat,long to x,y
----------------------------------------------------------------------- */
public function forward( $p ) {
 
/* Forward equations
----------------- */
#$x;
#$y;
$lam = $p->x;
$phi = $p->y;
$lam = Proj4php::$common->adjust_lon( $lam - $this->long0 );
 
if( $this->sphere ) {
$x = asin( cos( $phi ) * sin( $lam ) );
$y = atan2( tan( $phi ), cos( $lam ) ) - $this->phi0;
} else {
//ellipsoid
$this->n = sin( $phi );
$this->c = cos( $phi );
$y = $this->pj_mlfn( $phi, $this->n, $this->c, $this->en );
$this->n = 1. / sqrt( 1. - $this->es * $this->n * $this->n );
$this->tn = tan( $phi );
$this->t = $this->tn * $this->tn;
$this->a1 = $lam * $this->c;
$this->c *= $this->es * $this->c / (1 - $this->es);
$this->a2 = $this->a1 * $this->a1;
$x = $this->n * $this->a1 * (1. - $this->a2 * $this->t * ($this->C1 - (8. - $this->t + 8. * $this->c) * $this->a2 * $this->C2));
$y -= $this->m0 - $this->n * $this->tn * $this->a2 * (.5 + (5. - $this->t + 6. * $this->c) * $this->a2 * $this->C3);
}
 
$p->x = $this->a * $x + $this->x0;
$p->y = $this->a * $y + $this->y0;
return $p;
}
 
/* Inverse equations
----------------- */
public function inverse( $p ) {
$p->x -= $this->x0;
$p->y -= $this->y0;
$x = $p->x / $this->a;
$y = $p->y / $this->a;
 
if( $this->sphere ) {
$this->dd = $y + $this->lat0;
$phi = asin( sin( $this->dd ) * cos( $x ) );
$lam = atan2( tan( $x ), cos( $this->dd ) );
} else {
/* ellipsoid */
$ph1 = Proj4php::$common->pj_inv_mlfn( $this->m0 + $y, $this->es, $this->en );
$this->tn = tan( $ph1 );
$this->t = $this->tn * $this->tn;
$this->n = sin( $ph1 );
$this->r = 1. / (1. - $this->es * $this->n * $this->n);
$this->n = sqrt( $this->r );
$this->r *= (1. - $this->es) * $this->n;
$this->dd = $x / $this->n;
$this->d2 = $this->dd * $this->dd;
$phi = $ph1 - ($this->n * $this->tn / $this->r) * $this->d2 * (.5 - (1. + 3. * $this->t) * $this->d2 * $this->C3);
$lam = $this->dd * (1. + $this->t * $this->d2 * (-$this->C4 + (1. + 3. * $this->t) * $this->d2 * $this->C5)) / cos( $ph1 );
}
$p->x = Proj4php::$common->adjust_lon( $this->long0 + $lam );
$p->y = $phi;
return $p;
}
}
 
Proj4php::$proj['cass'] = new Proj4phpProjCass();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/ortho.php
New file
0,0 → 1,139
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/* * *****************************************************************************
NAME ORTHOGRAPHIC
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Orthographic projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
T. Mittan Mar, 1993
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
* ***************************************************************************** */
 
class Proj4phpProjOrtho {
/* Initialize the Orthographic projection
------------------------------------- */
public function init( $def ) {
//double temp; /* temporary variable */
 
/* Place parameters in static storage for common use
------------------------------------------------- */;
$this->sin_p14 = sin( $this->lat0 );
$this->cos_p14 = cos( $this->lat0 );
}
 
/* Orthographic forward equations--mapping lat,long to x,y
--------------------------------------------------- */
public function forward( $p ) {
/*
$sinphi;
$cosphi; // sin and cos value
$dlon; // delta longitude value
$coslon; // cos of longitude
$ksp; // scale factor
$g;
*/
$lon = $p->x;
$lat = $p->y;
/* Forward equations
----------------- */
$dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
 
$sinphi = sin( $lat );
$cosphi = cos( $lat );
 
$coslon = cos( $dlon );
$g = $this->sin_p14 * sinphi + $this->cos_p14 * $cosphi * $coslon;
$ksp = 1.0;
if( ($g > 0) || (abs( $g ) <= Proj4php::$common->EPSLN) ) {
$x = $this->a * $ksp * $cosphi * sin( $dlon );
$y = $this->y0 + $this->a * $ksp * ($this->cos_p14 * $sinphi - $this->sin_p14 * $cosphi * $coslon);
} else {
Proj4php::reportError( "orthoFwdPointError" );
}
$p->x = $x;
$p->y = $y;
return $p;
}
 
/**
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
/*
$rh; // height above ellipsoid
$z; // angle
$sinz;
$cosz; // sin of z and cos of z
$temp;
$con;
$lon;
$lat;
*/
/* Inverse equations
----------------- */
$p->x -= $this->x0;
$p->y -= $this->y0;
$rh = sqrt( $p->x * $p->x + $p->y * $p->y );
if( $rh > $this->a + .0000001 ) {
Proj4php::reportError( "orthoInvDataError" );
}
$z = Proj4php::$common . asinz( $rh / $this->a );
 
$sinz = sin( $z );
$cosz = cos( $z );
 
$lon = $this->long0;
if( abs( $rh ) <= Proj4php::$common->EPSLN ) {
$lat = $this->lat0;
}
$lat = Proj4php::$common . asinz( $cosz * $this->sin_p14 + ($p->y * $sinz * $this->cos_p14) / $rh );
$con = abs( $this->lat0 ) - Proj4php::$common->HALF_PI;
if( abs( con ) <= Proj4php::$common->EPSLN ) {
if( $this->lat0 >= 0 ) {
$lon = Proj4php::$common->adjust_lon( $this->long0 + atan2( $p->x, -$p->y ) );
} else {
$lon = Proj4php::$common->adjust_lon( $this->long0 - atan2( -$p->x, $p->y ) );
}
}
$con = $cosz - $this->sin_p14 * sin( $lat );
$p->x = $lon;
$p->y = $lat;
return $p;
}
 
}
 
Proj4php::$proj['ortho'] = new Proj4phpProjOrtho();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/krovak.php
New file
0,0 → 1,156
<?php
 
/**
NOTES: According to EPSG the full Krovak projection method should have
the following parameters. Within PROJ.4 the azimuth, and pseudo
standard parallel are hardcoded in the algorithm and can't be
altered from outside. The others all have defaults to match the
common usage with Krovak projection.
 
lat_0 = latitude of centre of the projection
 
lon_0 = longitude of centre of the projection
 
* * = azimuth (true) of the centre line passing through the centre of the projection
 
* * = latitude of pseudo standard parallel
 
k = scale factor on the pseudo standard parallel
 
x_0 = False Easting of the centre of the projection at the apex of the cone
 
y_0 = False Northing of the centre of the projection at the apex of the cone
 
**/
class Proj4phpProjKrovak {
 
/**
*
*/
public function init() {
/* we want Bessel as fixed ellipsoid */
$this->a = 6377397.155;
$this->es = 0.006674372230614;
$this->e = sqrt( $this->es );
/* if latitude of projection center is not set, use 49d30'N */
if( !$this->lat0 ) {
$this->lat0 = 0.863937979737193;
}
if( !$this->long0 ) {
$this->long0 = 0.7417649320975901 - 0.308341501185665;
}
/* if scale not set default to 0.9999 */
if( !$this->k0 ) {
$this->k0 = 0.9999;
}
$this->s45 = 0.785398163397448; /* 45° */
$this->s90 = 2 * $this->s45;
$this->fi0 = $this->lat0; /* Latitude of projection centre 49° 30' */
/* Ellipsoid Bessel 1841 a = 6377397.155m 1/f = 299.1528128,
e2=0.006674372230614;
*/
$this->e2 = $this->es; /* 0.006674372230614; */
$this->e = sqrt( $this->e2 );
$this->alfa = sqrt( 1. + ($this->e2 * pow( cos( $this->fi0 ), 4 )) / (1. - $this->e2) );
$this->uq = 1.04216856380474; /* DU(2, 59, 42, 42.69689) */
$this->u0 = asin( sin( $this->fi0 ) / $this->alfa );
$this->g = pow( (1. + $this->e * sin( $this->fi0 )) / (1. - $this->e * sin( $this->fi0 )), $this->alfa * $this->e / 2. );
$this->k = tan( $this->u0 / 2. + $this->s45 ) / pow( tan( $this->fi0 / 2. + $this->s45 ), $this->alfa ) * $this->g;
$this->k1 = $this->k0;
$this->n0 = $this->a * sqrt( 1. - $this->e2 ) / (1. - $this->e2 * pow( sin( $this->fi0 ), 2 ));
$this->s0 = 1.37008346281555; /* Latitude of pseudo standard parallel 78° 30'00" N */
$this->n = sin( $this->s0 );
$this->ro0 = $this->k1 * $this->n0 / tan( $this->s0 );
$this->ad = $this->s90 - $this->uq;
}
/**
* ellipsoid
* calculate xy from lat/lon
* Constants, identical to inverse transform function
*
* @param type $p
* @return type
*/
public function forward( $p ) {
$lon = $p->x;
$lat = $p->y;
$delta_lon = Proj4php::$common->adjust_lon( $lon - $this->long0 ); // Delta longitude
/* Transformation */
$gfi = pow( ((1. + $this->e * sin( $lat )) / (1. - $this->e * sin( $lat )) ), ($this->alfa * $this->e / 2. ) );
$u = 2. * (atan( $this->k * pow( tan( $lat / 2. + $this->s45 ), $this->alfa ) / $gfi ) - $this->s45);
$deltav = - $delta_lon * $this->alfa;
$s = asin( cos( $this->ad ) * sin( $u ) + sin( $this->ad ) * cos( $u ) * cos( $deltav ) );
$d = asin( cos( $u ) * sin( $deltav ) / cos( $s ) );
$eps = $this->n * $d;
$ro = $this->ro0 * pow( tan( $this->s0 / 2. + $this->s45 ), $this->n ) / pow( tan( $s / 2. + $this->s45 ), $this->n );
/* x and y are reverted! */
//$p->y = ro * cos(eps) / a;
//$p->x = ro * sin(eps) / a;
$p->y = $ro * cos( $eps ) / 1.0;
$p->x = $ro * sin( $eps ) / 1.0;
 
if( $this->czech ) {
$p->y *= -1.0;
$p->x *= -1.0;
}
return $p;
}
/**
* calculate lat/lon from xy
*
* @param Point $p
* @return Point $p
*/
public function inverse( $p ) {
/* Transformation */
/* revert y, x */
$tmp = $p->x;
$p->x = $p->y;
$p->y = $tmp;
if( $this->czech ) {
$p->y *= -1.0;
$p->x *= -1.0;
}
$ro = sqrt( $p->x * $p->x + $p->y * $p->y );
$eps = atan2( $p->y, $p->x );
$d = $eps / sin( $this->s0 );
$s = 2. * (atan( pow( $this->ro0 / $ro, 1. / $this->n ) * tan( $this->s0 / 2. + $this->s45 ) ) - $this->s45);
$u = asin( cos( $this->ad ) * sin( s ) - sin( $this->ad ) * cos( s ) * cos( d ) );
$deltav = asin( cos( $s ) * sin( $d ) / cos( $u ) );
$p->x = $this->long0 - $deltav / $this->alfa;
/* ITERATION FOR $lat */
$fi1 = $u;
$ok = 0;
$iter = 0;
do {
$p->y = 2. * ( atan( pow( $this->k, -1. / $this->alfa ) *
pow( tan( $u / 2. + $this->s45 ), 1. / $this->alfa ) *
pow( (1. + $this->e * sin( $fi1 )) / (1. - $this->e * sin( $fi1 )), $this->e / 2. )
) - $this->s45);
if( abs( $fi1 - $p->y ) < 0.0000000001 )
$ok = 1;
$fi1 = $p->y;
$iter += 1;
} while( $ok == 0 && $iter < 15 );
if( $iter >= 15 ) {
Proj4php::reportError( "PHI3Z-CONV:Latitude failed to converge after 15 iterations" );
//console.log('iter:', iter);
return null;
}
 
return $p;
}
 
}
 
Proj4php::$proj['krovak'] = new Proj4phpProjKrovak();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/mill.php
New file
0,0 → 1,82
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*******************************************************************************
NAME MILLER CYLINDRICAL
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Miller Cylindrical projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
T. Mittan March, 1993
 
This function was adapted from the Lambert Azimuthal Equal Area projection
code (FORTRAN) in the General Cartographic Transformation Package software
which is available from the U.S. Geological Survey National Mapping Division.
 
ALGORITHM REFERENCES
 
1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
 
2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
3. "Software Documentation for GCTP General Cartographic Transformation
Package", U.S. Geological Survey National Mapping Division, May 1982.
* ***************************************************************************** */
 
class Proj4phpProjMill {
/* Initialize the Miller Cylindrical projection
------------------------------------------- */
 
public function init() {
//no-op
}
 
/* Miller Cylindrical forward equations--mapping lat,long to x,y
------------------------------------------------------------ */
public function forward( $p ) {
$lon = $p->x;
$lat = $p->y;
/* Forward equations
----------------- */
$dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
$x = $this->x0 + $this->a * $dlon;
$y = $this->y0 + $this->a * log( tan( (Proj4php::$common->PI / 4.0) + ($lat / 2.5) ) ) * 1.25;
 
$p->x = $x;
$p->y = $y;
return $p;
}
 
/* Miller Cylindrical inverse equations--mapping x,y to lat/long
------------------------------------------------------------ */
public function inverse( $p ) {
$p->x -= $this->x0;
$p->y -= $this->y0;
 
$lon = Proj4php::$common->adjust_lon( $this->long0 + $p->x / $this->a );
$lat = 2.5 * (atan( exp( 0.8 * $p->y / $this->a ) ) - Proj4php::$common->PI / 4.0);
 
$p->x = $lon;
$p->y = $lat;
return $p;
}
}
 
Proj4php::$proj['mill'] = new Proj4phpProjMill();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/vandg.php
New file
0,0 → 1,167
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*******************************************************************************
NAME VAN DER GRINTEN
 
PURPOSE: Transforms input Easting and Northing to longitude and
latitude for the Van der Grinten projection. The
Easting and Northing must be in meters. The longitude
and latitude values will be returned in radians.
 
PROGRAMMER DATE
---------- ----
T. Mittan March, 1993
 
This function was adapted from the Van Der Grinten projection code
(FORTRAN) in the General Cartographic Transformation Package software
which is available from the U.S. Geological Survey National Mapping Division.
 
ALGORITHM REFERENCES
 
1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
 
2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
3. "Software Documentation for GCTP General Cartographic Transformation
Package", U.S. Geological Survey National Mapping Division, May 1982.
* ***************************************************************************** */
 
class Proj4phpProjVandg {
/* Initialize the Van Der Grinten projection
---------------------------------------- */
public function init() {
$this->R = 6370997.0; //Radius of earth
}
 
/**
*
* @param type $p
* @return type
*/
public function forward( $p ) {
 
$lon = $p->x;
$lat = $p->y;
 
/* Forward equations
----------------- */
$dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
$x;
$y;
 
if( abs( $lat ) <= Proj4php::$common->EPSLN ) {
$x = $this->x0 + $this->R * $dlon;
$y = $this->y0;
}
$theta = Proj4php::$common . asinz( 2.0 * abs( $lat / Proj4php::$common->PI ) );
if( (abs( $dlon ) <= Proj4php::$common->EPSLN) || (abs( abs( $lat ) - Proj4php::$common->HALF_PI ) <= Proj4php::$common->EPSLN) ) {
$x = $this->x0;
if( $lat >= 0 ) {
$y = $this->y0 + Proj4php::$common->PI * $this->R * tan( .5 * $theta );
} else {
$y = $this->y0 + Proj4php::$common->PI * $this->R * - tan( .5 * $theta );
}
// return(OK);
}
$al = .5 * abs( (Proj4php::$common->PI / $dlon) - ($dlon / Proj4php::$common->PI) );
$asq = $al * $al;
$sinth = sin( $theta );
$costh = cos( $theta );
 
$g = $costh / ($sinth + $costh - 1.0);
$gsq = $g * $g;
$m = $g * (2.0 / $sinth - 1.0);
$msq = $m * $m;
$con = Proj4php::$common->PI * $this->R * ($al * ($g - $msq) + sqrt( $asq * ($g - $sq) * ($g - $msq) - ($msq + $asq) * ($gsq - $msq) )) / ($msq + $asq);
if( $dlon < 0 ) {
$con = -$con;
}
$x = $this->x0 + $con;
$con = abs( $con / (Proj4php::$common->PI * $this->R) );
if( $lat >= 0 ) {
$y = $this->y0 + Proj4php::$common->PI * $this->R * sqrt( 1.0 - $con * $con - 2.0 * $al * $con );
} else {
$y = $this->y0 - Proj4php::$common->PI * $this->R * sqrt( 1.0 - $con * $con - 2.0 * $al * $con );
}
$p->x = $x;
$p->y = $y;
return $p;
}
 
/* Van Der Grinten inverse equations--mapping x,y to lat/long
--------------------------------------------------------- */
 
public function inverse( $p ) {
/*
$dlon;
$xx;
$yy;
$xys;
$c1;
$c2;
$c3;
$al;
$asq;
$a1;
$m1;
$con;
$th1;
$d;
*/
/* inverse equations
----------------- */
$p->x -= $this->x0;
$p->y -= $this->y0;
$con = Proj4php::$common->PI * $this->R;
$xx = $p->x / $con;
$yy = $p->y / $con;
$xys = $xx * $xx + $yy * $yy;
$c1 = -abs( $yy ) * (1.0 + $xys);
$c2 = $c1 - 2.0 * $yy * $yy + $xx * $xx;
$c3 = -2.0 * $c1 + 1.0 + 2.0 * $yy * $yy + $xys * $xys;
$d = $yy * $yy / $c3 + (2.0 * $c2 * $c2 * $c2 / $c3 / $c3 / $c3 - 9.0 * $c1 * $c2 / $c3 / $c3) / 27.0;
$a1 = ($c1 - $c2 * $c2 / 3.0 / $c3) / $c3;
$m1 = 2.0 * sqrt( -$a1 / 3.0 );
$con = ((3.0 * $d) / $a1) / $m1;
if( abs( $con ) > 1.0 ) {
if( $con >= 0.0 ) {
$con = 1.0;
} else {
$con = -1.0;
}
}
$th1 = acos( $con ) / 3.0;
if( $p->$y >= 0 ) {
$lat = (-$m1 * cos( $th1 + Proj4php::$common->PI / 3.0 ) - $c2 / 3.0 / $c3) * Proj4php::$common->PI;
} else {
$lat = -(-m1 * cos( $th1 + Proj4php::$common->PI / 3.0 ) - $c2 / 3.0 / $c3) * Proj4php::$common->PI;
}
 
if( abs( $xx ) < Proj4php::$common->EPSLN ) {
$lon = $this->$long0;
}
$lon = Proj4php::$common->adjust_lon( $this->long0 + Proj4php::$common->PI * ($xys - 1.0 + sqrt( 1.0 + 2.0 * ($xx * $xx - $yy * $yy) + $xys * $xys )) / 2.0 / $xx );
 
$p->x = $lon;
$p->y = $lat;
return $p;
}
 
}
 
Proj4php::$proj['vandg'] = new Proj4phpProjVandg();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/gnom.php
New file
0,0 → 1,145
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*****************************************************************************
NAME GNOMONIC
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Gnomonic Projection.
Implementation based on the existing sterea and ortho
implementations.
 
PROGRAMMER DATE
---------- ----
Richard Marsden November 2009
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Flattening the Earth - Two Thousand Years of Map
Projections", University of Chicago Press 1993
 
2. Wolfram Mathworld "Gnomonic Projection"
http://mathworld.wolfram.com/GnomonicProjection.html
Accessed: 12th November 2009
******************************************************************************/
 
class Proj4phpProjGnom {
/**
* Initialize the Gnomonic projection
*
* @todo $def not used in context...?
* @param type $def
*/
public function init( $def ) {
 
/* Place parameters in static storage for common use
------------------------------------------------- */
$this->sin_p14 = sin( $this->lat0 );
$this->cos_p14 = cos( $this->lat0 );
// Approximation for projecting points to the horizon (infinity)
$this->infinity_dist = 1000 * $this->a;
$this->rc = 1;
}
 
/* Gnomonic forward equations--mapping lat,long to x,y
--------------------------------------------------- */
public function forward( $p ) {
/*
$sinphi;
$cosphi; // sin and cos value
$dlon; // delta longitude value
$coslon; // cos of longitude
$ksp; // scale factor
$g;
*/
$lon = $p->x;
$lat = $p->y;
/* Forward equations
----------------- */
$dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
 
$sinphi = sin( $lat );
$cosphi = cos( $lat );
 
$coslon = cos( $dlon );
$g = $this->sin_p14 * $sinphi + $this->cos_p14 * $cosphi * $coslon;
$ksp = 1.0;
if( (g > 0) || (abs( g ) <= Proj4php::$common->EPSLN) ) {
$x = $this->x0 + $this->a * $ksp * $cosphi * sin( $dlon ) / $g;
$y = $this->y0 + $this->a * $ksp * ($this->cos_p14 * $sinphi - $this->sin_p14 * $cosphi * $coslon) / $g;
} else {
Proj4php::reportError( "orthoFwdPointError" );
 
// Point is in the opposing hemisphere and is unprojectable
// We still need to return a reasonable point, so we project
// to infinity, on a bearing
// equivalent to the northern hemisphere equivalent
// This is a reasonable approximation for short shapes and lines that
// straddle the horizon.
 
$x = $this->x0 + $this->infinity_dist * $cosphi * sin( $dlon );
$y = $this->y0 + $this->infinity_dist * ($this->cos_p14 * $sinphi - $this->sin_p14 * $cosphi * $coslon);
}
$p->x = $x;
$p->y = $y;
return $p;
}
 
/**
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
/*
$rh; // Rho
$z; // angle
$sinc;
$cosc;
$c;
$lon;
$lat;
*/
/* Inverse equations
----------------- */
$p->x = ($p->x - $this->x0) / $this->a;
$p->y = ($p->y - $this->y0) / $this->a;
 
$p->x /= $this->k0;
$p->y /= $this->k0;
 
if( ($rh = sqrt( $p->x * $p->x + $p->y * $p->y ) ) ) {
$c = atan2( $rh, $this->rc );
$sinc = sin( $c );
$cosc = cos( $c );
 
$lat = Proj4php::$common->asinz( $cosc * $this->sin_p14 + ($p->y * $sinc * $this->cos_p14) / $rh );
$lon = atan2( $p->x * sinc, rh * $this->cos_p14 * $cosc - $p->y * $this->sin_p14 * $sinc );
$lon = Proj4php::$common->adjust_lon( $this->long0 + $lon );
} else {
$lat = $this->phic0;
$lon = 0.0;
}
 
$p->x = $lon;
$p->y = $lat;
return $p;
}
}
 
Proj4php::$proj['gnom'] = new Proj4phpProjGnom();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/lcc.php
New file
0,0 → 1,166
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*******************************************************************************
NAME LAMBERT CONFORMAL CONIC
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Lambert Conformal Conic projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
*******************************************************************************/
 
 
//<2104> +proj=lcc +lat_1=10.16666666666667 +lat_0=10.16666666666667 +lon_0=-71.60561777777777 +k_0=1 +x0=-17044 +x0=-23139.97 +ellps=intl +units=m +no_defs no_defs
// Initialize the Lambert Conformal conic projection
// -----------------------------------------------------------------
//class Proj4phpProjlcc = Class.create();
class Proj4phpProjLcc {
 
public function init() {
// array of: r_maj,r_min,lat1,lat2,c_lon,c_lat,false_east,false_north
//double c_lat; /* center latitude */
//double c_lon; /* center longitude */
//double lat1; /* first standard parallel */
//double lat2; /* second standard parallel */
//double r_maj; /* major axis */
//double r_min; /* minor axis */
//double false_east; /* x offset in meters */
//double false_north; /* y offset in meters */
 
//if lat2 is not defined
if( !isset($this->lat2) ) {
$this->lat2 = $this->lat0;
}
//if k0 is not defined
if( !isset($this->k0) )
$this->k0 = 1.0;
 
// Standard Parallels cannot be equal and on opposite sides of the equator
if( abs( $this->lat1 + $this->lat2 ) < Proj4php::$common->EPSLN ) {
Proj4php::reportError( "lcc:init: Equal Latitudes" );
return;
}
 
$temp = $this->b / $this->a;
$this->e = sqrt( 1.0 - $temp * $temp );
 
$sin1 = sin( $this->lat1 );
$cos1 = cos( $this->lat1 );
$ms1 = Proj4php::$common->msfnz( $this->e, $sin1, $cos1 );
$ts1 = Proj4php::$common->tsfnz( $this->e, $this->lat1, $sin1 );
 
$sin2 = sin( $this->lat2 );
$cos2 = cos( $this->lat2 );
$ms2 = Proj4php::$common->msfnz( $this->e, $sin2, $cos2 );
$ts2 = Proj4php::$common->tsfnz( $this->e, $this->lat2, $sin2 );
 
$ts0 = Proj4php::$common->tsfnz( $this->e, $this->lat0, sin( $this->lat0 ) );
 
if( abs( $this->lat1 - $this->lat2 ) > Proj4php::$common->EPSLN ) {
$this->ns = log( $ms1 / $ms2 ) / log( $ts1 / $ts2 );
} else {
$this->ns = $sin1;
}
$this->f0 = $ms1 / ($this->ns * pow( $ts1, $this->ns ));
$this->rh = $this->a * $this->f0 * pow( $ts0, $this->ns );
if( !isset($this->title) )
$this->title = "Lambert Conformal Conic";
}
 
// Lambert Conformal conic forward equations--mapping lat,long to x,y
// -----------------------------------------------------------------
public function forward( $p ) {
 
$lon = $p->x;
$lat = $p->y;
 
// convert to radians
if( $lat <= 90.0 && $lat >= -90.0 && $lon <= 180.0 && $lon >= -180.0 ) {
//lon = lon * Proj4php::$common.D2R;
//lat = lat * Proj4php::$common.D2R;
} else {
Proj4php::reportError( "lcc:forward: llInputOutOfRange: " . $lon . " : " . $lat );
return null;
}
 
$con = abs( abs( $lat ) - Proj4php::$common->HALF_PI );
if( $con > Proj4php::$common->EPSLN ) {
$ts = Proj4php::$common->tsfnz( $this->e, $lat, sin( $lat ) );
$rh1 = $this->a * $this->f0 * pow( $ts, $this->ns );
} else {
$con = $lat * $this->ns;
if( $con <= 0 ) {
Proj4php::reportError( "lcc:forward: No Projection" );
return null;
}
$rh1 = 0;
}
$theta = $this->ns * Proj4php::$common->adjust_lon( $lon - $this->long0 );
$p->x = $this->k0 * ($rh1 * sin( $theta )) + $this->x0;
$p->y = $this->k0 * ($this->rh - $rh1 * cos( $theta )) + $this->y0;
 
return $p;
}
/**
* Lambert Conformal Conic inverse equations--mapping x,y to lat/long
*
* @param type $p
* @return null
*/
public function inverse( $p ) {
$x = ($p->x - $this->x0) / $this->k0;
$y = ($this->rh - ($p->y - $this->y0) / $this->k0);
if( $this->ns > 0 ) {
$rh1 = sqrt( $x * $x + $y * $y );
$con = 1.0;
} else {
$rh1 = -sqrt( $x * $x + $y * $y );
$con = -1.0;
}
$theta = 0.0;
if( $rh1 != 0 ) {
$theta = atan2( ($con * $x ), ($con * $y ) );
}
if( ($rh1 != 0) || ($this->ns > 0.0) ) {
$con = 1.0 / $this->ns;
$ts = pow( ($rh1 / ($this->a * $this->f0) ), $con );
$lat = Proj4php::$common->phi2z( $this->e, $ts );
if( $lat == -9999 )
return null;
} else {
$lat = -Proj4php::$common->HALF_PI;
}
$lon = Proj4php::$common->adjust_lon( $theta / $this->ns + $this->long0 );
 
$p->x = $lon;
$p->y = $lat;
return $p;
}
}
 
Proj4php::$proj['lcc'] = new Proj4phpProjLcc();
 
 
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/laea.php
New file
0,0 → 1,398
<?php
 
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/* * *****************************************************************************
NAME LAMBERT AZIMUTHAL EQUAL-AREA
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Lambert Azimuthal Equal-Area projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
D. Steinwand, EROS March, 1991
 
This function was adapted from the Lambert Azimuthal Equal Area projection
code (FORTRAN) in the General Cartographic Transformation Package software
which is available from the U.S. Geological Survey National Mapping Division.
 
ALGORITHM REFERENCES
 
1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
 
2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
3. "Software Documentation for GCTP General Cartographic Transformation
Package", U.S. Geological Survey National Mapping Division, May 1982.
* ***************************************************************************** */
 
class Proj4phpProjLaea {
 
protected $S_POLE = 1;
protected $N_POLE = 2;
protected $EQUIT = 3;
protected $OBLIQ = 4;
 
protected $P00 = .33333333333333333333;
protected $P01 = .17222222222222222222;
protected $P02 = .10257936507936507936;
protected $P10 = .06388888888888888888;
protected $P11 = .06640211640211640211;
protected $P20 = .01641501294219154443;
/* Initialize the Lambert Azimuthal Equal Area projection
------------------------------------------------------ */
public function init() {
$t = abs( $this->lat0 );
if( abs( $t - Proj4php::$common->HALF_PI ) < Proj4php::$common->EPSLN ) {
$this->mode = $this->lat0 < 0. ? $this->S_POLE : $this->N_POLE;
} else if( abs( $t ) < Proj4php::$common->EPSLN ) {
$this->mode = $this->EQUIT;
} else {
$this->mode = $this->OBLIQ;
}
if( $this->es > 0 ) {
#$sinphi;
 
$this->qp = Proj4php::$common->qsfnz( $this->e, 1.0 );
$this->mmf = .5 / (1. - $this->es);
$this->apa = $this->authset( $this->es );
switch( $this->mode ) {
case $this->N_POLE:
case $this->S_POLE:
$this->dd = 1.;
break;
case $this->EQUIT:
$this->rq = sqrt( .5 * $this->qp );
$this->dd = 1. / $this->rq;
$this->xmf = 1.;
$this->ymf = .5 * $this->qp;
break;
case $this->OBLIQ:
$this->rq = sqrt( .5 * $this->qp );
$sinphi = sin( $this->lat0 );
$this->sinb1 = Proj4php::$common->qsfnz( $this->e, $sinphi ) / $this->qp;
$this->cosb1 = sqrt( 1. - $this->sinb1 * $this->sinb1 );
$this->dd = cos( $this->lat0 ) / (sqrt( 1. - $this->es * $sinphi * $sinphi ) * $this->rq * $this->cosb1);
$this->ymf = ($this->xmf = $this->rq) / $this->dd;
$this->xmf *= $this->dd;
break;
}
} else {
if( $this->mode == $this->OBLIQ ) {
$this->sinph0 = sin( $this->lat0 );
$this->cosph0 = cos( $this->lat0 );
}
}
}
 
/* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
----------------------------------------------------------------------- */
public function forward( $p ) {
 
/* Forward equations
----------------- */
#$x;
#$y;
$lam = $p->x;
$phi = $p->y;
$lam = Proj4php::$common->adjust_lon( $lam - $this->long0 );
 
if( $this->sphere ) {
/*
$coslam;
$cosphi;
$sinphi;
*/
$sinphi = sin( $phi );
$cosphi = cos( $phi );
$coslam = cos( $lam );
switch( $this->mode ) {
case $this->OBLIQ:
case $this->EQUIT:
$y = ($this->mode == $this->EQUIT) ? 1. + $cosphi * $coslam : 1. + $this->sinph0 * $sinphi + $this->cosph0 * $cosphi * $coslam;
if( y <= Proj4php::$common->EPSLN ) {
Proj4php::reportError( "laea:fwd:y less than eps" );
return null;
}
$y = sqrt( 2. / $y );
$x = $y * cosphi * sin( $lam );
$y *= ($this->mode == $this->EQUIT) ? $sinphi : $this->cosph0 * $sinphi - $this->sinph0 * $cosphi * $coslam;
break;
case $this->N_POLE:
$coslam = -$coslam;
case $this->S_POLE:
if( abs( $phi + $this->phi0 ) < Proj4php::$common->EPSLN ) {
Proj4php::reportError( "laea:fwd:phi < eps" );
return null;
}
$y = Proj4php::$common->FORTPI - $phi * .5;
$y = 2. * (($this->mode == $this->S_POLE) ? cos( $y ) : sin( $y ));
$x = $y * sin( $lam );
$y *= $coslam;
break;
}
} else {
/*
$coslam;
$sinlam;
$sinphi;
$q;
*/
$sinb = 0.0;
$cosb = 0.0;
$b = 0.0;
 
$coslam = cos( $lam );
$sinlam = sin( $lam );
$sinphi = sin( $phi );
$q = Proj4php::$common->qsfnz( $this->e, $sinphi );
if( $this->mode == $this->OBLIQ || $this->mode == $this->EQUIT ) {
$sinb = $q / $this->qp;
$cosb = sqrt( 1. - $sinb * $sinb );
}
switch( $this->mode ) {
case $this->OBLIQ:
$b = 1. + $this->sinb1 * $sinb + $this->cosb1 * $cosb * $coslam;
break;
case $this->EQUIT:
$b = 1. + $cosb * $coslam;
break;
case $this->N_POLE:
$b = Proj4php::$common->HALF_PI + $phi;
$q = $this->qp - $q;
break;
case $this->S_POLE:
$b = $phi - Proj4php::$common->HALF_PI;
$q = $this->qp + $q;
break;
}
if( abs( $b ) < Proj4php::$common->EPSLN ) {
Proj4php::reportError( "laea:fwd:b < eps" );
return null;
}
switch( $this->mode ) {
case $this->OBLIQ:
case $this->EQUIT:
$b = sqrt( 2. / $b );
if( $this->mode == $this->OBLIQ ) {
$y = $this->ymf * $b * ($this->cosb1 * $sinb - $this->sinb1 * $cosb * $coslam);
} else {
$y = ($b = sqrt( 2. / (1. + $cosb * $coslam) )) * $sinb * $this->ymf;
}
$x = $this->xmf * $b * $cosb * $sinlam;
break;
case $this->N_POLE:
case $this->S_POLE:
if( q >= 0. ) {
$x = ($b = sqrt( $q )) * $sinlam;
$y = $coslam * (($this->mode == $this->S_POLE) ? $b : -$b);
} else {
$x = $y = 0.;
}
break;
}
}
 
//v 1.0
/*
$sin_lat=sin(lat);
$cos_lat=cos(lat);
 
$sin_delta_lon=sin(delta_lon);
$cos_delta_lon=cos(delta_lon);
 
$g =$this->sin_lat_o * sin_lat +$this->cos_lat_o * cos_lat * cos_delta_lon;
if (g == -1.0) {
Proj4php::reportError("laea:fwd:Point projects to a circle of radius "+ 2.0 * R);
return null;
}
$ksp = $this->a * sqrt(2.0 / (1.0 + g));
$x = ksp * cos_lat * sin_delta_lon + $this->x0;
$y = ksp * ($this->cos_lat_o * sin_lat - $this->sin_lat_o * cos_lat * cos_delta_lon) + $this->y0;
*/
$p->x = $this->a * $x + $this->x0;
$p->y = $this->a * $y + $this->y0;
return $p;
}
/* Inverse equations
----------------- */
public function inverse( $p ) {
$p->x -= $this->x0;
$p->y -= $this->y0;
$x = $p->x / $this->a;
$y = $p->y / $this->a;
 
if( $this->sphere ) {
$cosz = 0.0;
#$rh;
$sinz = 0.0;
 
$rh = sqrt( $x * $x + $y * $y );
$phi = $rh * .5;
if( $phi > 1. ) {
Proj4php::reportError( "laea:Inv:DataError" );
return null;
}
$phi = 2. * asin( $phi );
if( $this->mode == $this->OBLIQ || $this->mode == $this->EQUIT ) {
$sinz = sin( $phi );
$cosz = cos( $phi );
}
switch( $this->mode ) {
case $this->EQUIT:
$phi = (abs( $rh ) <= Proj4php::$common->EPSLN) ? 0. : asin( $y * $sinz / $rh );
$x *= $sinz;
$y = $cosz * $rh;
break;
case $this->OBLIQ:
$phi = (abs( $rh ) <= Proj4php::$common->EPSLN) ? $this->phi0 : asin( $cosz * $this->sinph0 + $y * $sinz * $this->cosph0 / $rh );
$x *= $sinz * $this->cosph0;
$y = ($cosz - sin( $phi ) * $this->sinph0) * $rh;
break;
case $this->N_POLE:
$y = -$y;
$phi = Proj4php::$common->HALF_PI - $phi;
break;
case $this->S_POLE:
$phi -= Proj4php::$common->HALF_PI;
break;
}
$lam = ($y == 0. && ($this->mode == $this->EQUIT || $this->mode == $this->OBLIQ)) ? 0. : atan2( $x, $y );
} else {
/*
$cCe;
$sCe;
$q;
$rho;
*/
$ab = 0.0;
 
switch( $this->mode ) {
case $this->EQUIT:
case $this->OBLIQ:
$x /= $this->dd;
$y *= $this->dd;
$rho = sqrt( $x * $x + $y * $y );
if( $rho < Proj4php::$common->EPSLN ) {
$p->x = 0.;
$p->y = $this->phi0;
return $p;
}
$sCe = 2. * asin( .5 * $rho / $this->rq );
$cCe = cos( $sCe );
$x *= ($sCe = sin( $sCe ));
if( $this->mode == $this->OBLIQ ) {
$ab = $cCe * $this->sinb1 + $y * $sCe * $this->cosb1 / $rho;
$q = $this->qp * $ab;
$y = $rho * $this->cosb1 * $cCe - $y * $this->sinb1 * $sCe;
} else {
$ab = $y * $sCe / $rho;
$q = $this->qp * $ab;
$y = $rho * $cCe;
}
break;
case $this->N_POLE:
$y = -$y;
case $this->S_POLE:
$q = ($x * $x + $y * $y);
if( !$q ) {
$p->x = 0.;
$p->y = $this->phi0;
return $p;
}
/*
q = $this->qp - q;
*/
$ab = 1. - $q / $this->qp;
if( $this->mode == $this->S_POLE ) {
$ab = - $ab;
}
break;
}
$lam = atan2( $x, $y );
$phi = $this->authlat( asin( $ab ), $this->apa );
}
 
/*
$Rh = sqrt($p->x *$p->x +$p->y * $p->y);
$temp = Rh / (2.0 * $this->a);
 
if (temp > 1) {
Proj4php::reportError("laea:Inv:DataError");
return null;
}
 
$z = 2.0 * Proj4php::$common.asinz(temp);
$sin_z=sin(z);
$cos_z=cos(z);
 
$lon =$this->long0;
if (abs(Rh) > Proj4php::$common->EPSLN) {
$lat = Proj4php::$common.asinz($this->sin_lat_o * cos_z +$this-> cos_lat_o * sin_z *$p->y / Rh);
$temp =abs($this->lat0) - Proj4php::$common->HALF_PI;
if (abs(temp) > Proj4php::$common->EPSLN) {
temp = cos_z -$this->sin_lat_o * sin(lat);
if(temp!=0.0) lon=Proj4php::$common->adjust_lon($this->long0+atan2($p->x*sin_z*$this->cos_lat_o,temp*Rh));
} else if ($this->lat0 < 0.0) {
lon = Proj4php::$common->adjust_lon($this->long0 - atan2(-$p->x,$p->y));
} else {
lon = Proj4php::$common->adjust_lon($this->long0 + atan2($p->x, -$p->y));
}
} else {
lat = $this->lat0;
}
*/
//return(OK);
$p->x = Proj4php::$common->adjust_lon( $this->long0 + $lam );
$p->y = $phi;
return $p;
}
 
/**
* determine latitude from authalic latitude
*
* @param type $es
* @return type
*/
public function authset( $es ) {
#$t;
$APA = array( );
$APA[0] = $es * $this->P00;
$t = $es * $es;
$APA[0] += $t * $this->P01;
$APA[1] = $t * $this->P10;
$t *= $es;
$APA[0] += $t * $this->P02;
$APA[1] += $t * $this->P11;
$APA[2] = $t * $this->P20;
return $APA;
}
 
/**
*
* @param type $beta
* @param type $APA
* @return type
*/
public function authlat( $beta, $APA ) {
$t = $beta + $beta;
return($beta + $APA[0] * sin( $t ) + $APA[1] * sin( $t + $t ) + $APA[2] * sin( $t + $t + $t ));
}
 
}
 
Proj4php::$proj['laea'] = new Proj4phpProjLaea();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/equi.php
New file
0,0 → 1,80
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*******************************************************************************
NAME EQUIRECTANGULAR
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Equirectangular projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
T. Mittan Mar, 1993
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
*******************************************************************************/
class Proj4phpProjEqui {
 
public function init() {
if( !$this->x0 )
$this->x0 = 0;
if( !$this->y0 )
$this->y0 = 0;
if( !$this->lat0 )
$this->lat0 = 0;
if( !$this->long0 )
$this->long0 = 0;
///$this->t2;
}
 
/* Equirectangular forward equations--mapping lat,long to x,y
--------------------------------------------------------- */
public function forward( $p ) {
 
$lon = $p->x;
$lat = $p->y;
 
$dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
$x = $this->x0 + $this->a * $dlon * cos( $this->lat0 );
$y = $this->y0 + $this->a * $lat;
 
$this->t1 = $x;
$this->t2 = cos( $this->lat0 );
$p->x = $x;
$p->y = $y;
return $p;
}
 
/* Equirectangular inverse equations--mapping x,y to lat/long
--------------------------------------------------------- */
public function inverse( $p ) {
 
$p->x -= $this->x0;
$p->y -= $this->y0;
$lat = $p->y / $this->a;
 
if( abs( $lat ) > Proj4php::$common->HALF_PI ) {
Proj4php::reportError( "equi:Inv:DataError" );
}
$lon = Proj4php::$common->adjust_lon( $this->long0 + $p->x / ($this->a * cos( $this->lat0 )) );
$p->x = $lon;
$p->y = $lat;
}
}
 
Proj4php::$proj['equi'] = new Proj4phpProjEqui();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/moll.php
New file
0,0 → 1,121
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*******************************************************************************
NAME MOLLWEIDE
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the MOllweide projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
D. Steinwand, EROS May, 1991; Updated Sept, 1992; Updated Feb, 1993
S. Nelson, EDC Jun, 2993; Made corrections in precision and
number of iterations.
 
ALGORITHM REFERENCES
 
1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
 
2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
****************************************************************************** */
 
class Proj4phpProjMoll {
/* Initialize the Mollweide projection
------------------------------------ */
 
public function init() {
//no-op
}
 
/* Mollweide forward equations--mapping lat,long to x,y
---------------------------------------------------- */
public function forward( $p ) {
 
/* Forward equations
----------------- */
$lon = $p->x;
$lat = $p->y;
 
$delta_lon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
$theta = $lat;
$con = Proj4php::$common->PI * sin( $lat );
 
/* Iterate using the Newton-Raphson method to find theta
----------------------------------------------------- */
for( $i = 0; true; ++$i ) {
$delta_theta = -($theta + sin( $theta ) - $con) / (1.0 + cos( $theta ));
$theta += $delta_theta;
if( abs( $delta_theta ) < Proj4php::$common->EPSLN )
break;
if( $i >= 50 ) {
Proj4php::reportError( "moll:Fwd:IterationError" );
//return(241);
}
}
$theta /= 2.0;
 
/* If the latitude is 90 deg, force the x coordinate to be "0 . false easting"
this is done here because of precision problems with "cos(theta)"
-------------------------------------------------------------------------- */
if( Proj4php::$common->PI / 2 - abs( $lat ) < Proj4php::$common->EPSLN )
$delta_lon = 0;
$x = 0.900316316158 * $this->a * $delta_lon * cos( $theta ) + $this->x0;
$y = 1.4142135623731 * $this->a * sin( $theta ) + $this->y0;
 
$p->x = $x;
$p->y = $y;
return $p;
}
 
/**
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
#$theta;
#$arg;
 
/* Inverse equations
----------------- */
$p->x-= $this->x0;
//~ $p->y -= $this->y0;
$arg = $p->y / (1.4142135623731 * $this->a);
 
/* Because of division by zero problems, 'arg' can not be 1.0. Therefore
a number very close to one is used instead.
------------------------------------------------------------------- */
if( abs( $arg ) > 0.999999999999 )
$arg = 0.999999999999;
$theta = asin( $arg );
$lon = Proj4php::$common->adjust_lon( $this->long0 + ($p->x / (0.900316316158 * $this->a * cos( $theta ))) );
if( $lon < (-Proj4php::$common->PI) )
$lon = -Proj4php::$common->PI;
if( $lon > Proj4php::$common->PI )
$lon = Proj4php::$common->PI;
$arg = (2.0 * $theta + sin( 2.0 * $theta )) / Proj4php::$common->PI;
if( abs( $arg ) > 1.0 )
$arg = 1.0;
$lat = asin( $arg );
//return(OK);
 
$p->x = $lon;
$p->y = $lat;
return $p;
}
}
 
Proj4php::$proj['moll'] = new Proj4phpProjMoll();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/gstmerc.php
New file
0,0 → 1,63
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
class Proj4phpProjGstmerc {
 
public function init() {
 
// array of: a, b, lon0, lat0, k0, x0, y0
$temp = $this->b / $this->a;
$this->e = sqrt( 1.0 - $temp * $temp );
$this->lc = $this->long0;
$this->rs = sqrt( 1.0 + $this->e * $this->e * pow( cos( $this->lat0 ), 4.0 ) / (1.0 - $this->e * $this->e) );
$sinz = sin( $this->lat0 );
$pc = asin( $sinz / $this->rs );
$sinzpc = sin( $pc );
$this->cp = Proj4php::$common->latiso( 0.0, $pc, $sinzpc ) - $this->rs * Proj4php::$common->latiso( $this->e, $this->lat0, $sinz );
$this->n2 = $this->k0 * $this->a * sqrt( 1.0 - $this->e * $this->e ) / (1.0 - $this->e * $this->e * $sinz * $sinz);
$this->xs = $this->x0;
$this->ys = $this->y0 - $this->n2 * $pc;
 
if( !$this->title )
$this->title = "Gauss Schreiber transverse mercator";
}
 
// forward equations--mapping lat,long to x,y
// -----------------------------------------------------------------
public function forward( $p ) {
 
$lon = $p->x;
$lat = $p->y;
 
$L = $this->rs * ($lon - $this->lc);
$Ls = $this->cp + ($this->rs * Proj4php::$common->latiso( $this->e, $lat, sin( $lat ) ));
$lat1 = asin( sin( $L ) / Proj4php::$common . cosh( $Ls ) );
$Ls1 = Proj4php::$common . latiso( 0.0, $lat1, sin( $lat1 ) );
$p->x = $this->xs + ($this->n2 * $Ls1);
$p->y = $this->ys + ($this->n2 * atan( Proj4php::$common->sinh( $Ls ) / cos( $L ) ));
return $p;
}
 
// inverse equations--mapping x,y to lat/long
// -----------------------------------------------------------------
public function inverse( $p ) {
 
$x = $p->x;
$y = $p->y;
 
$L = atan( Proj4php::$common . sinh( ($x - $this->xs) / $this->n2 ) / cos( ($y - $this->ys) / $this->n2 ) );
$lat1 = asin( sin( ($y - $this->ys) / $this->n2 ) / Proj4php::$common . cosh( ($x - $this->xs) / $this->n2 ) );
$LC = Proj4php::$common . latiso( 0.0, $lat1, sin( $lat1 ) );
$p->x = $this->lc + $L / $this->rs;
$p->y = Proj4php::$common . invlatiso( $this->e, ($LC - $this->cp) / $this->rs );
return $p;
}
 
}
 
Proj4php::$proj['gstmerc'] = new Proj4phpProjGestmerc();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/utm.php
New file
0,0 → 1,74
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*******************************************************************************
NAME TRANSVERSE MERCATOR
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Transverse Mercator projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
*******************************************************************************/
 
/**
Initialize Transverse Mercator projection
*/
class Proj4phpProjUtm {
 
public $dependsOn = 'tmerc';
public $utmSouth = false; // UTM north/south
/**
*
* @return void
*/
public function init() {
if( !isset($this->zone) ) {
Proj4php::reportError( "utm:init: zone must be specified for UTM" );
return;
}
$this->lat0 = 0.0;
$this->long0 = ((6 * abs( $this->zone )) - 183) * Proj4php::$common->D2R;
$this->x0 = 500000.0;
$this->y0 = $this->utmSouth ? 10000000.0 : 0.0;
$this->k0 = 0.9996;
}
/**
*
* @param type $p
* @return type
*/
public function forward( $p ) {
return Proj4php::$proj['tmerc']->forward( $p );
}
 
/**
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
return Proj4php::$proj['tmerc']->inverse( $p );
}
}
 
Proj4php::$proj['utm'] = new Proj4phpProjUtm();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/omerc.php
New file
0,0 → 1,301
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/* * *****************************************************************************
NAME OBLIQUE MERCATOR (HOTINE)
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Oblique Mercator projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
PROGRAMMER DATE
---------- ----
T. Mittan Mar, 1993
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
* ***************************************************************************** */
 
class Proj4phpProjOmerc {
/* Initialize the Oblique Mercator projection
------------------------------------------ */
 
public function init() {
if( !$this->mode )
$this->mode = 0;
if( !$this->lon1 ) {
$this->lon1 = 0;
$this->mode = 1;
}
if( !$this->lon2 )
$this->lon2 = 0;
if( !$this->lat2 )
$this->lat2 = 0;
 
/* Place parameters in static storage for common use
------------------------------------------------- */
$temp = $this->b / $this->a;
$es = 1.0 - pow( $temp, 2 );
$e = sqrt( $es );
 
$this->sin_p20 = sin( $this->lat0 );
$this->cos_p20 = cos( $this->lat0 );
 
$this->con = 1.0 - $this->es * $this->sin_p20 * $this->sin_p20;
$this->com = sqrt( 1.0 - $es );
$this->bl = sqrt( 1.0 + $this->es * pow( $this->cos_p20, 4.0 ) / (1.0 - $es) );
$this->al = $this->a * $this->bl * $this->k0 * $this->com / $this->con;
if( abs( $this->lat0 ) < Proj4php::$common->EPSLN ) {
$this->ts = 1.0;
$this->d = 1.0;
$this->el = 1.0;
} else {
$this->ts = Proj4php::$common->tsfnz( $this->e, $this->lat0, $this->sin_p20 );
$this->con = sqrt( $this->con );
$this->d = $this->bl * $this->com / ($this->cos_p20 * $this->con);
if( ($this->d * $this->d - 1.0) > 0.0 ) {
if( $this->lat0 >= 0.0 ) {
$this->f = $this->d + sqrt( $this->d * $this->d - 1.0 );
} else {
$this->f = $this->d - sqrt( $this->d * $this->d - 1.0 );
}
} else {
$this->f = $this->d;
}
$this->el = $this->f * pow( $this->ts, $this->bl );
}
 
//$this->longc=52.60353916666667;
 
if( $this->mode != 0 ) {
$this->g = .5 * ($this->f - 1.0 / $this->f);
$this->gama = Proj4php::$common->asinz( sin( $this->alpha ) / $this->d );
$this->longc = $this->longc - Proj4php::$common->asinz( $this->g * tan( $this->gama ) ) / $this->bl;
 
/* Report parameters common to format B
------------------------------------- */
//genrpt(azimuth * R2D,"Azimuth of Central Line: ");
//cenlon(lon_origin);
// cenlat(lat_origin);
 
$this->con = abs( $this->lat0 );
if( ($this->con > Proj4php::$common->EPSLN) && (abs( $this->con - Proj4php::$common->HALF_PI ) > Proj4php::$common->EPSLN) ) {
$this->singam = sin( $this->gama );
$this->cosgam = cos( $this->gama );
 
$this->sinaz = sin( $this->alpha );
$this->cosaz = cos( $this->alpha );
 
if( $this->lat0 >= 0 ) {
$this->u = ($this->al / $this->bl) * atan( sqrt( $this->d * $this->d - 1.0 ) / $this->cosaz );
} else {
$this->u = -($this->al / $this->bl) * atan( sqrt( $this->d * $this->d - 1.0 ) / $this->cosaz );
}
} else {
Proj4php::reportError( "omerc:Init:DataError" );
}
} else {
$this->sinphi = sin( $this->at1 );
$this->ts1 = Proj4php::$common->tsfnz( $this->e, $this->lat1, $this->sinphi );
$this->sinphi = sin( $this->lat2 );
$this->ts2 = Proj4php::$common->tsfnz( $this->e, $this->lat2, $this->sinphi );
$this->h = pow( $this->ts1, $this->bl );
$this->l = pow( $this->ts2, $this->bl );
$this->f = $this->el / $this->h;
$this->g = .5 * ($this->f - 1.0 / $this->f);
$this->j = ($this->el * $this->el - $this->l * $this->h) / ($this->el * $this->el + $this->l * $this->h);
$this->p = ($this->l - $this->h) / ($this->l + $this->h);
$this->dlon = $this->lon1 - $this->lon2;
if( $this->dlon < -Proj4php::$common->PI )
$this->lon2 = $this->lon2 - 2.0 * Proj4php::$common->PI;
if( $this->dlon > Proj4php::$common->PI )
$this->lon2 = $this->lon2 + 2.0 * Proj4php::$common->PI;
$this->dlon = $this->lon1 - $this->lon2;
$this->longc = .5 * ($this->lon1 + $this->lon2) - atan( $this->j * tan( .5 * $this->bl * $this->dlon ) / $this->p ) / $this->bl;
$this->dlon = Proj4php::$common->adjust_lon( $this->lon1 - $this->longc );
$this->gama = atan( sin( $this->bl * $this->dlon ) / $this->g );
$this->alpha = Proj4php::$common->asinz( $this->d * sin( $this->gama ) );
 
/* Report parameters common to format A
------------------------------------- */
if( abs( $this->lat1 - $this->lat2 ) <= Proj4php::$common->EPSLN ) {
Proj4php::reportError( "omercInitDataError" );
//return(202);
} else {
$this->con = abs( $this->lat1 );
}
if( ($this->con <= Proj4php::$common->EPSLN) || (abs( $this->con - Proj4php::$common->HALF_PI ) <= Proj4php::$common->EPSLN) ) {
Proj4php::reportError( "omercInitDataError" );
//return(202);
} else {
if( abs( abs( $this->lat0 ) - Proj4php::$common->HALF_PI ) <= Proj4php::$common->EPSLN ) {
Proj4php::reportError( "omercInitDataError" );
//return(202);
}
}
 
$this->singam = sin( $this->gam );
$this->cosgam = cos( $this->gam );
 
$this->sinaz = sin( $this->alpha );
$this->cosaz = cos( $this->alpha );
 
 
if( $this->lat0 >= 0 ) {
$this->u = ($this->al / $this->bl) * atan( sqrt( $this->d * $this->d - 1.0 ) / $this->cosaz );
} else {
$this->u = -($this->al / $this->bl) * atan( sqrt( $this->d * $this->d - 1.0 ) / $this->cosaz );
}
}
}
 
/* Oblique Mercator forward equations--mapping lat,long to x,y
---------------------------------------------------------- */
public function forward( $p ) {
/*
$theta; // angle
$sin_phi;
$cos_phi; // sin and cos value
$b; // temporary values
$c;
$t;
$tq; // temporary values
$con;
$n;
$ml; // cone constant, small m
$q;
$us;
$vl;
$ul;
$vs;
$s;
$dlon;
$ts1;
*/
 
$lon = $p->x;
$lat = $p->y;
/* Forward equations
----------------- */
$sin_phi = sin( $lat );
$dlon = Proj4php::$common->adjust_lon( $lon - $this->longc );
$vl = sin( $this->bl * $dlon );
if( abs( abs( $lat ) - Proj4php::$common->HALF_PI ) > Proj4php::$common->EPSLN ) {
$ts1 = Proj4php::$common->tsfnz( $this->e, $lat, $sin_phi );
$q = $this->el / (pow( $ts1, $this->bl ));
$s = .5 * ($q - 1.0 / $q);
$t = .5 * ($q + 1.0 / $q);
$ul = ($s * $this->singam - $vl * $this->cosgam) / $t;
$con = cos( $this->bl * $dlon );
if( abs( con ) < .0000001 ) {
$us = $this->al * $this->bl * $dlon;
} else {
$us = $this->al * atan( ($s * $this->cosgam + $vl * $this->singam) / $con ) / $this->bl;
if( $con < 0 )
$us = $us + Proj4php::$common->PI * $this->al / $this->bl;
}
} else {
if( $lat >= 0 ) {
$ul = $this->singam;
} else {
$ul = -$this->singam;
}
$us = $this->al * $lat / $this->bl;
}
if( abs( abs( $ul ) - 1.0 ) <= Proj4php::$common->EPSLN ) {
//alert("Point projects into infinity","omer-for");
Proj4php::reportError( "omercFwdInfinity" );
//return(205);
}
$vs = .5 * $this->al * log( (1.0 - $ul) / (1.0 + $ul) ) / $this->bl;
$us = $us - $this->u;
$p->x = $this->x0 + $vs * $this->cosaz + $us * $this->sinaz;
$p->y = $this->y0 + $us * $this->cosaz - $vs * $this->sinaz;
 
return $p;
}
 
/**
*
* @param type $p
* @return type
*/
public function inverse( $p ) {
/*
$delta_lon; /* Delta longitude (Given longitude - center
$theta; /* angle
$delta_theta; /* adjusted longitude
$sin_phi;
$cos_phi; /* sin and cos value
$b; /* temporary values
$c;
$t;
$tq; /* temporary values
$con;
$n;
$ml; /* cone constant, small m
$vs;
$us;
$q;
$s;
$ts1;
$vl;
$ul;
$bs;
$dlon;
$flag;
*/
/* Inverse equations
----------------- */
$p->x -= $this->x0;
$p->y -= $this->y0;
#$flag = 0;
$vs = $p->x * $this->cosaz - $p->y * $this->sinaz;
$us = $p->y * $this->cosaz + $p->x * $this->sinaz;
$us = $us + $this->u;
$q = exp( -$this->bl * $vs / $this->al );
$s = .5 * ($q - 1.0 / $q);
$t = .5 * ($q + 1.0 / $q);
$vl = sin( $this->bl * $us / $this->al );
$ul = ($vl * $this->cosgam + $s * $this->singam) / $t;
if( abs( abs( $ul ) - 1.0 ) <= Proj4php::$common->EPSLN ) {
$lon = $this->longc;
if( ul >= 0.0 ) {
$lat = Proj4php::$common->HALF_PI;
} else {
$lat = -Proj4php::$common->HALF_PI;
}
} else {
$con = 1.0 / $this->bl;
$ts1 = pow( ($this->el / sqrt( (1.0 + $ul) / (1.0 - $ul) ) ), $con );
$lat = Proj4php::$common->phi2z( $this->e, $ts1 );
//if ($flag != 0)
//return($flag);
//~ con = cos($this->bl * us /al);
$theta = $this->longc - atan2( ($s * $this->cosgam - $vl * $this->singam ), $con ) / $this->bl;
$lon = Proj4php::$common->adjust_lon( $theta );
}
$p->x = $lon;
$p->y = $lat;
return $p;
}
 
}
 
Proj4php::$proj['omerc'] = new Proj4phpProjOmerc();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/eqc.php
New file
0,0 → 1,58
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/* similar to equi.js FIXME proj4 uses eqc */
class Proj4phpProjEqc {
 
public function init() {
 
if( !$this->x0 )
$this->x0 = 0;
if( !$this->y0 )
$this->y0 = 0;
if( !$this->lat0 )
$this->lat0 = 0;
if( !$this->long0 )
$this->long0 = 0;
if( !$this->lat_ts )
$this->lat_ts = 0;
if( !$this->title )
$this->title = "Equidistant Cylindrical (Plate Carre)";
 
$this->rc = cos( $this->lat_ts );
}
 
// forward equations--mapping lat,long to x,y
// -----------------------------------------------------------------
public function forward( $p ) {
 
$lon = $p->x;
$lat = $p->y;
 
$dlon = Proj4php::$common->adjust_lon( $lon - $this->long0 );
$dlat = Proj4php::$common . adjust_lat( $lat - $this->lat0 );
$p->x = $this->x0 + ($this->a * $dlon * $this->rc);
$p->y = $this->y0 + ($this->a * $dlat );
return $p;
}
 
// inverse equations--mapping x,y to lat/long
// -----------------------------------------------------------------
public function inverse( $p ) {
 
$x = $p->x;
$y = $p->y;
 
$p->x = Proj4php::$common->adjust_lon( $this->long0 + (($x - $this->x0) / ($this->a * $this->rc)) );
$p->y = Proj4php::$common->adjust_lat( $this->lat0 + (($y - $this->y0) / ($this->a )) );
return $p;
}
 
}
 
Proj4php::$proj['eqc'] = new Proj4phpProjEqc();
/tags/v5.7-arrayanal/scripts/modules/ifn/bibliotheque/proj4php/projCode/tmerc.php
New file
0,0 → 1,166
<?php
/**
* Author : Julien Moquet
*
* Inspired by Proj4php from Mike Adair madairATdmsolutions.ca
* and Richard Greenwood rich@greenwoodma$p->com
* License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
*/
/*******************************************************************************
NAME TRANSVERSE MERCATOR
 
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Transverse Mercator projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
 
ALGORITHM REFERENCES
 
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
 
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
*******************************************************************************/
 
/**
Initialize Transverse Mercator projection
*/
class Proj4phpProjTmerc {
private $e0, $e1, $e2, $e3, $ml0;
/**
*
*/
public function init() {
$this->e0 = Proj4php::$common->e0fn( $this->es );
$this->e1 = Proj4php::$common->e1fn( $this->es );
$this->e2 = Proj4php::$common->e2fn( $this->es );
$this->e3 = Proj4php::$common->e3fn( $this->es );
$this->ml0 = $this->a * Proj4php::$common->mlfn( $this->e0, $this->e1, $this->e2, $this->e3, $this->lat0 );
}
 
/**
Transverse Mercator Forward - long/lat to x/y
long/lat in radians
*/
public function forward( $p ) {
$lon = $p->x;
$lat = $p->y;
 
$delta_lon = Proj4php::$common->adjust_lon( $lon - $this->long0 ); // Delta longitude
#$con = 0; // cone constant
#$x = 0;
#$y = 0;
$sin_phi = sin( $lat );
$cos_phi = cos( $lat );
 
if( isset($this->sphere) && $this->sphere === true ) { /* spherical form */
$b = $cos_phi * sin( $delta_lon );
if( (abs( abs( $b ) - 1.0 )) < .0000000001 ) {
Proj4php::reportError( "tmerc:forward: Point projects into infinity" );
return(93);
} else {
$x = .5 * $this->a * $this->k0 * log( (1.0 + $b) / (1.0 - $b) );
$con = acos( $cos_phi * cos( $delta_lon ) / sqrt( 1.0 - $b * $b ) );
if( $lat < 0 )
$con = - $con;
$y = $this->a * $this->k0 * ($con - $this->lat0);
}
} else {
$al = $cos_phi * $delta_lon;
$als = pow( $al, 2 );
$c = $this->ep2 * pow( $cos_phi, 2 );
$tq = tan( $lat );
$t = pow( $tq, 2 );
$con = 1.0 - $this->es * pow( $sin_phi, 2 );
$n = $this->a / sqrt( $con );
$ml = $this->a * Proj4php::$common->mlfn( $this->e0, $this->e1, $this->e2, $this->e3, $lat );
 
$x = $this->k0 * $n * $al * (1.0 + $als / 6.0 * (1.0 - $t + $c + $als / 20.0 * (5.0 - 18.0 * $t + pow( $t, 2 ) + 72.0 * $c - 58.0 * $this->ep2))) + $this->x0;
$y = $this->k0 * ($ml - $this->ml0 + $n * $tq * ($als * (0.5 + $als / 24.0 * (5.0 - $t + 9.0 * $c + 4.0 * pow( $c, 2 ) + $als / 30.0 * (61.0 - 58.0 * $t + pow( $t, 2 ) + 600.0 * $c - 330.0 * $this->ep2))))) + $this->y0;
}
$p->x = $x;
$p->y = $y;
return $p;
}
 
/**
Transverse Mercator Inverse - x/y to long/lat
*/
public function inverse( $p ) {
#$phi; /* temporary angles */
#$delta_phi; /* difference between longitudes */
$max_iter = 6; /* maximun number of iterations */
 
if( isset($this->sphere) && $this->sphere === true ) { /* spherical form */
$f = exp( $p->x / ($this->a * $this->k0) );
$g = .5 * ($f - 1 / $f);
$temp = $this->lat0 + $p->y / ($this->a * $this->k0);
$h = cos( $temp );
$con = sqrt( (1.0 - $h * $h) / (1.0 + $g * $g) );
$lat = Proj4php::$common->asinz( $con );
if( $temp < 0 )
$lat = -$lat;
if( ($g == 0) && ($h == 0) ) {
$lon = $this->long0;
} else {
$lon = Proj4php::$common->adjust_lon( atan2( $g, $h ) + $this->long0 );
}