Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 1124 → Rev 1123

/trunk/services/configurations/config_chorodep.ini
30,7 → 30,7
; +------------------------------------------------------------------------------------------------------+
; Config spécifique au projet
; Noms des services disponibles pour ce projet
servicesDispo = "meta-donnees,aide,ontologies,observations,cartes,noms,infos-espece,noms-plus"
servicesDispo = "meta-donnees,aide,ontologies,observations,cartes,noms,infos-espece"
 
[Cartes]
; Chemin de base des cartes
46,12 → 46,4
; table des noms vernaculaires
table_nv = "nvjfl_v2007"
; URL des status de protection
url_service_sptb = "http://localhost/service:eflore:0.1/sptb/statuts?masque.nn=%s"
 
[NomsPlus]
; table des noms vernaculaires
table_chorologie_nv = "chorologie_nv"
; table des statuts de protection
table_chorologie_sp = "chorologie_sp"
; squelette d'url pour les codes INSEE des régions
insee_d_url_tpl = http://localhost/service:eflore:0.1/insee-d/zone-geo/%s
url_service_sptb = "http://localhost/service:eflore:0.1/sptb/statuts?masque.nn=%s"
/trunk/services/modules/0.1/chorodep/NomsPlus.php
File deleted
\ No newline at end of file
/trunk/services/modules/0.1/chorodep/Observations.php
215,6 → 215,15
if ($nom_champ == 'station') {
if (!preg_match('/^\s*([0-9]{2})\s*$/', $valeur, $colonne)) { // si le nom est passé
$this->requete_condition[] = '1';
/* $url = $this->ajouterHrefAutreProjet('zone-geo',$key,'INSEE-D');// d'apres nom
$dept = $this->rest_client->consulter($url);
$entete = $this->rest_client->getReponseEntetes();
if (isset($entete['wrapper_data'])) {
$colonne = json_decode($relation);
} else {
$this->renvoyerErreur(RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE,
'Le service '.$this->service.' de ce projet comporte des erreurs. url lancée : '.$url);
}*/
} else {
$this->requete_condition[] = '`'.$valeur."` != '' ";
$this->requete_champ .= ', `'.$valeur.'` ';
/trunk/services/modules/0.1/chorodep/Noms.php
101,13 → 101,13
$donnees['entete']['href.precedent'] = $url_base . '/' . $this->serviceNom . '?'
. 'navigation.depart=' . max(0, ($this->depart - $this->limite)) . '&navigation.limite=' . $this->limite
. '&retour.tri=' . $this->tri . '&retour.ordre=' . $this->tri_dir
. ($masqueEnParams ? '&' . $masqueEnParams : '');
. '&' . $masqueEnParams;
}
if (($this->depart + $this->limite) < $total ) {
$donnees['entete']['href.suivant'] = $url_base . '/' . $this->serviceNom . '?'
. 'navigation.depart=' . ($this->depart + $this->limite) . '&navigation.limite=' . $this->limite
. '&retour.tri=' . $this->tri . '&retour.ordre=' . $this->tri_dir
. ($masqueEnParams ? '&' . $masqueEnParams : '');
. '&' . $masqueEnParams;
}
$donnees['resultat'] = $noms;
 
/trunk/scripts/bibliotheque/EfloreScript.php
18,13 → 18,7
 
private $Bdd = null;
private $projetNom = null;
protected $conteneur; // mélange cracra, n'était pas utilisé jusqu'à présent (2014-09-29)
 
public function __construct($script_nom, $parametres_cli) {
parent::__construct($script_nom, $parametres_cli);
$this->conteneur = new Conteneur();
}
 
public function getProjetNom() {
return $this->projetNom;
}
91,28 → 85,5
}
return $stop;
}
 
/**
* Consulte une URL et retourne le résultat (ou déclenche une erreur), en
* admettant qu'il soit au format JSON
*
* @param string $url l'URL du service
*/
protected function chargerDonnees($url, $decoderJSON = true) {
$resultat = $this->conteneur->getRestClient()->consulter($url);
$entete = $this->conteneur->getRestClient()->getReponseEntetes();
 
// Si le service meta-donnees fonctionne correctement, l'entete comprend la clé wrapper_data
if (isset($entete['wrapper_data'])) {
if ($decoderJSON) {
$resultat = json_decode($resultat, true);
$this->entete = (isset($resultat['entete'])) ? $resultat['entete'] : null;
}
} else {
$m = "L'url <a href=\"$url\">$url</a> lancée via RestClient renvoie une erreur";
trigger_error($m, E_USER_WARNING);
}
return $resultat;
}
}
?>
/trunk/scripts/modules/chorodep/Chorodep.php
55,25 → 55,6
case 'supprimerTous' :
$this->supprimerTous();
break;
// noms vernaculaires et statuts de protection
case 'NVSP' :
$this->nettoyageNVSP();
$this->chargerStructureNVSP();
$this->rabouterNomsVernaculaires();
$this->rabouterStatutsProtection();
break;
case 'nettoyageNVSP' :
$this->nettoyageNVSP();
break;
case 'chargerStructureNVSP' :
$this->chargerStructureNVSP();
break;
case 'nomsVernaculaires' :
$this->rabouterNomsVernaculaires();
break;
case 'statutsProtection' :
$this->rabouterStatutsProtection();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
161,7 → 142,7
private function initialiserTraitement() {
//------------------------------------------------------------------------------------------------------------//
// Récupération des informations à vérifier
$table = $this->getNomTableDerniereVersion();
$table = $this->getNomTableDernierVersion();
$requete = 'SELECT * '.
"FROM $table ";
$taxons = $this->getBdd()->recupererTous($requete);
505,7 → 486,7
return $tablesChorodep;
}
 
private function getNomTableDerniereVersion() {
private function getNomTableDernierVersion() {
$version = $this->getDerniereVersion();
$table = sprintf(Config::get('tables.chorodepTpl'), $version);
return $table;
515,123 → 496,6
$version = array_pop(explode(',', Config::get('versions')));
return $version;
}
 
// ----------
// intégration des noms vernaculaires et statuts de protection (NVSP) dans
// une table dédiée, pour permettre le service intégratif de l'applciation "chorologie"
// (basé sur les scripts de "gentiana-services")
// ----------
 
/**
* Dézingue tout le bousin
* @TODO chaque méthode devrait s'autonettoyer au début afin d'être répétable
* sans avoir à tout reprendre depuis le début (principe du dump)
*/
protected function nettoyageNVSP() {
echo "---- suppression des tables\n";
$tableStatutsProtection = Config::get('tables.statuts_protection');
$tableNomsVernaculaires = Config::get('tables.noms_vernaculaires');
$req = "DROP TABLE IF EXISTS `" . $tableStatutsProtection . "`";
$this->getBdd()->requeter($req);
$req = "DROP TABLE IF EXISTS `" . $tableNomsVernaculaires . "`;";
$this->getBdd()->requeter($req);
}
 
/**
* Crée les tables vides
*/
protected function chargerStructureNVSP() {
echo "---- création des tables\n";
$contenuSql = $this->recupererContenu(Config::get('chemins.structureNVSP'));
$this->executerScripSql($contenuSql);
}
 
/**
* Va chercher les noms vernaculaires pour chaque espèce, et les rajoute
* dans la table dédiée
*/
protected function rabouterNomsVernaculaires() {
$tableNomsVernaculaires = Config::get('tables.noms_vernaculaires');
restore_error_handler();
restore_exception_handler();
ini_set("display_errors", true);
error_reporting(E_ALL);
$squeletteUrlNvjfl = Config::get("url_nvjfl");
echo "---- récupération des noms vernaculaires depuis eFlore\n";
$depart = 0;
$nbInsertions = 0;
$yenaencore = true;
$tailleTranche = 1000;
while ($yenaencore) {
$url = sprintf($squeletteUrlNvjfl, $depart, $tailleTranche);
$noms = $this->chargerDonnees($url);
// Si quelqu'un parvient à dédoublonner les $valeurs, on enlève le IGNORE
$req = "INSERT IGNORE INTO " . $tableNomsVernaculaires . " VALUES ";
$valeurs = array();
// insertion des données
foreach ($noms['resultat'] as $res) {
$numTaxons = explode(',', $res['num_taxon']);
$nvP = $this->getBdd()->proteger($res['nom']);
foreach ($numTaxons as $numTaxon) {
$valeurs[] = "(" . $numTaxon . ", " . $nvP . ")";
}
}
$req .= implode(",", $valeurs);
$this->getBdd()->executer($req);
// prochain tour
$nbInsertions += count($valeurs); // Faux car INSERT IGNORE - dédoublonner ou compter les insertions réelles
$depart += $tailleTranche;
$total = $noms['entete']['total'];
$yenaencore = $depart <= $total;
echo "insérés: " . min($depart, $total) . " noms, " . $nbInsertions . " attributions\n";
}
}
 
/**
* Va chercher les statuts de protection pour chaque espèce et les rajoute
* à la table; importe un fichier dump SQL des lois
*/
protected function rabouterStatutsProtection() {
$tableChorologie = $this->getNomTableDerniereVersion();
$tableStatutsProtection = Config::get('tables.statuts_protection');
echo "---- récupération des statuts de protection depuis eFlore\n";
$req = "SELECT distinct num_nom FROM " . $tableChorologie;
$resultat = $this->getBdd()->recupererTous($req);
// pour chaque taxon mentionné (inefficace mais évite d'implémenter un
// mode liste sur le service eflore/sptb
$squeletteUrlSptb = Config::get("url_sptb");
foreach ($resultat as $res) {
$nn = $res['num_nom'];
//echo "NN: $nn\n";
if ($nn != 0) {
$url = sprintf($squeletteUrlSptb, $nn);
//echo "URL: $url\n";
$statuts = $this->chargerDonnees($url);
//echo "STATUTS: " . print_r($statuts, true) . "\n";
if (count($statuts) > 0) {
$json = array();
foreach ($statuts as $statut) {
$nouveauStatut = array();
$nouveauStatut['zone'] = $statut['code_zone_application'];
$nouveauStatut['lien'] = $statut['hyperlien_legifrance'];
$json[] = $nouveauStatut;
}
// Si au moins un statut
if (count($json) > 0) {
$json = json_encode($json);
//echo "JSON: " . print_r($json, true) . "\n";
// Insertion d'un bout de JSON
$jsonP = $this->getBdd()->proteger($json);
$nnP = $this->getBdd()->proteger($nn);
$reqIns = "INSERT INTO " . $tableStatutsProtection
. " values($nnP, $jsonP)";
//echo "ReqIns: $reqIns\n";
$this->getBdd()->executer($reqIns);
}
}
}
}
}
}
 
class ZgFrDepartements {
762,4 → 626,4
return (int)self::$departements[$n][3];
}
}
?>
?>
/trunk/scripts/modules/chorodep/chorodep.ini
1,5 → 1,5
; Ajouter les nouvelles version à la suite dans versions et versionsDonnees.
versions = "2011_04,2012_01,2013_07,2013_08,2013_11"
versions = "2011_04,2012_01,2013_07,2013_08,2013_11,2014_08"
versionsDonnees="2011-04-05,2012-01-01,2013-07-22,2013-08-05,2013-11-13,2014-08-15"
dossierTsv = "{ref:dossierDonneesEflore}chorodep/{ref:versionDonnees}/"
dossierTsvTpl = "{ref:dossierDonneesEflore}chorodep/%s/"
19,9 → 19,6
chorodepOntologies = "chorodep_ontologies"
chorodep = "chorodep_v{ref:version}"
chorodepTpl = "chorodep_v%s"
; Noms vernaculaires et status de protection :
statuts_protection = "chorologie_sp"
noms_vernaculaires = "chorologie_nv"
 
[fichiers]
structureSql = "chorodep.sql"
32,8 → 29,6
chorodepOntologies = "chorodep_ontologies.tsv"
chorodep = "chorodep_v{ref:versionDonnees}.tsv"
chorodepTpl = "chorodep_v%s.tsv"
; Noms vernaculaires et status de protection :
structureNVSP = "nvsp.sql"
 
[chemins]
structureSql = "{ref:dossierSql}{ref:fichiers.structureSql}"
43,12 → 38,4
chorodepSources = "{ref:dossierSql}{ref:fichiers.chorodepSources}"
chorodepOntologies = "{ref:dossierSql}{ref:fichiers.chorodepOntologies}"
chorodep = "{ref:dossierTsv}{ref:fichiers.chorodep}"
chorodepTpl = "{ref:dossierTsvTpl}{ref:fichiers.chorodepTpl}"
; Noms vernaculaires et status de protection :
structureNVSP = "{ref:dossierSql}{ref:fichiers.structureNVSP}"
 
[services]
;base_url_service_eflore = "http://api.tela-botanica.org/service:eflore:0.1/";
base_url_service_eflore = "http://localhost/service:eflore:0.1/";
url_nvjfl = "{ref:base_url_service_eflore}nvjfl/noms-vernaculaires?masque.lg=fra&retour.champs=num_taxon&retour.tri=num_taxon&navigation.depart=%s&navigation.limite=%s"
url_sptb = "{ref:base_url_service_eflore}sptb/statuts?masque.nn=%s"
chorodepTpl = "{ref:dossierTsvTpl}{ref:fichiers.chorodepTpl}"
/trunk/docs/projets/cel/bdd/cel_v1_00.sql
New file
0,0 → 1,179
-- Structure de la BDD du CEL au 10-11-2011 (version 1.00)
--
-- Structure de la table 'cel_images'
--
CREATE TABLE IF NOT EXISTS cel_images (
ci_id_image bigint(20) NOT NULL AUTO_INCREMENT,
ci_ordre bigint(20) NOT NULL,
ci_ce_utilisateur varchar(60) NOT NULL,
ci_publiable_eflore tinyint(1) NOT NULL,
ci_note_image tinyint(5) NOT NULL DEFAULT '-1',
ci_meta_height int(11) NOT NULL,
ci_meta_width int(11) NOT NULL,
ci_meta_make varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_model varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_x_resolution varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_y_resolution varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_date_time varchar(30) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_date date DEFAULT NULL,
ci_meta_date_ajout datetime NOT NULL,
ci_meta_gps varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_user_comment longtext CHARACTER SET ascii,
ci_meta_comment longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ci_meta_mots_cles varchar(800) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_exposure_time varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_f_number varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_exif_version int(11) DEFAULT NULL,
ci_meta_exif_compressed_bits_per_pixel varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_shutter_speed_value varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_aperture_value varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_exposure_bias_value varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_max_aperture_value varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_metering_mode int(5) DEFAULT NULL,
ci_meta_exif_light_source varchar(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_flash int(5) DEFAULT NULL,
ci_meta_exif_focal_length varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_flash_pix_version int(10) DEFAULT NULL,
ci_meta_exif_color_space int(5) DEFAULT NULL,
ci_meta_exif_interoperability_offset int(10) DEFAULT NULL,
ci_meta_exif_focal_plane_x_resolution varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_focal_plane_y_resolution varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_focal_plane_resolution_unit int(5) DEFAULT NULL,
ci_meta_exif_sensing_method int(5) DEFAULT NULL,
ci_meta_exif_file_source text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ci_meta_exif_custom_rendered int(5) DEFAULT NULL,
ci_meta_exif_exposure_mode int(5) DEFAULT NULL,
ci_meta_exif_white_balance int(5) DEFAULT NULL,
ci_meta_exif_digital_zoom_ratio varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_exif_scene_capture_type int(5) DEFAULT NULL,
ci_meta_exif_gain_control int(5) DEFAULT NULL,
ci_meta_exif_contrast int(5) DEFAULT NULL,
ci_meta_exif_saturation int(5) DEFAULT NULL,
ci_meta_exif_sharpness int(5) DEFAULT NULL,
ci_meta_exif_subject_distance_range int(5) DEFAULT NULL,
ci_meta_exif_autres longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ci_meta_iptc_category varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_mots_cles longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ci_meta_iptc_by_line varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_by_line_title varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_city varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_sub_location varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_province_state varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_country_primary_location_code varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_country_name varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_headline varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_credit varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_copyright_notice varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_contact varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_meta_iptc_autres longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ci_nom_original varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
ci_md5 varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (ci_id_image),
KEY ci_id_image (ci_id_image,ci_ordre,ci_ce_utilisateur),
KEY ci_ce_utilisateur (ci_ce_utilisateur)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=51035 ;
 
--
-- Structure de la table 'cel_inventory'
--
CREATE TABLE IF NOT EXISTS cel_inventory (
id bigint(20) NOT NULL AUTO_INCREMENT,
identifiant varchar(128) NOT NULL,
prenom_utilisateur varchar(255) DEFAULT NULL COMMENT 'Prénom de l''utilisateur ayant saisi l''observation.',
nom_utilisateur varchar(255) DEFAULT NULL COMMENT 'Nom de l''utilisateur ayant saisi l''observation.',
ordre bigint(20) NOT NULL,
nom_sel varchar(255) NOT NULL,
num_nom_sel int(11) NOT NULL,
nom_ret varchar(255) NOT NULL,
num_nom_ret int(11) NOT NULL,
num_taxon int(11) NOT NULL,
famille varchar(255) NOT NULL,
location varchar(50) NOT NULL,
id_location varchar(10) NOT NULL,
date_observation datetime NOT NULL,
lieudit varchar(255) NOT NULL,
station varchar(255) NOT NULL,
milieu varchar(255) NOT NULL,
commentaire varchar(1024) NOT NULL,
transmission tinyint(4) NOT NULL,
date_creation datetime NOT NULL,
date_modification datetime NOT NULL,
date_transmission datetime NOT NULL,
mots_cles longtext NOT NULL,
mots_cles_texte text,
coord_x varchar(50) NOT NULL,
coord_y varchar(50) NOT NULL,
ref_geo varchar(25) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY identifiant_ordre (identifiant,ordre),
KEY identifiant_date_creation (identifiant,date_creation),
KEY id_location (id_location),
KEY location (location),
KEY date_observation (date_observation),
KEY nom_ret (nom_ret),
KEY identifiant (identifiant),
KEY coordonnees (coord_x,coord_y)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=426372 ;
 
--
-- Structure de la table 'cel_mots_cles_images'
--
CREATE TABLE IF NOT EXISTS cel_mots_cles_images (
cmc_mot_cle varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_bg int(10) NOT NULL,
cmc_bd int(10) NOT NULL,
cmc_id_mot_cle_general varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_id_mot_cle_utilisateur varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_id_proprietaire varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_id_parent varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_niveau int(10) NOT NULL,
PRIMARY KEY (cmc_id_mot_cle_utilisateur,cmc_id_proprietaire)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
--
-- Structure de la table 'cel_mots_cles_obs'
--
CREATE TABLE IF NOT EXISTS cel_mots_cles_obs (
cmc_mot_cle varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_bg int(20) NOT NULL,
cmc_bd int(20) NOT NULL,
cmc_id_mot_cle_general varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_id_mot_cle_utilisateur varchar(128) COLLATE utf8_unicode_ci NOT NULL,
cmc_id_proprietaire varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_id_parent varchar(50) COLLATE utf8_unicode_ci NOT NULL,
cmc_niveau int(11) NOT NULL,
PRIMARY KEY (cmc_id_mot_cle_utilisateur,cmc_id_proprietaire)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT COMMENT='Table des mots clés, à utiliser avec des transactions !';
 
--
-- Structure de la table 'cel_obs_images'
--
CREATE TABLE IF NOT EXISTS cel_obs_images (
coi_ce_image int(11) NOT NULL,
coi_ce_utilisateur varchar(100) CHARACTER SET utf8 NOT NULL,
coi_ce_observation int(11) NOT NULL,
coi_date_liaison datetime NOT NULL,
PRIMARY KEY (coi_ce_image,coi_ce_observation),
KEY coi_ce_utilisateur (coi_ce_utilisateur),
KEY coi_ce_observation (coi_ce_observation),
KEY coi_ce_image (coi_ce_image)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
--
-- Structure de la table 'locations'
--
CREATE TABLE IF NOT EXISTS locations (
`name` varchar(50) NOT NULL,
maj_name varchar(50) NOT NULL,
`code` varchar(3) NOT NULL DEFAULT '0',
insee_code varchar(5) NOT NULL DEFAULT '0',
sector varchar(3) NOT NULL,
x_utm varchar(10) NOT NULL DEFAULT '0',
y_utm varchar(10) NOT NULL DEFAULT '0',
wgs84_latitude double NOT NULL,
wgs84_longitude double NOT NULL,
update_date datetime NOT NULL,
PRIMARY KEY (`name`,`code`),
KEY MAJ (maj_name,`code`),
KEY sector (sector,x_utm,y_utm)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;