Subversion Repositories Sites.obs-saisons.fr

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 1

/obs_saisons/SPIP-v1-8-3/modules/observations/commune.php
New file
0,0 → 1,34
<form name="form_observation" method="post" action="<?= $url_page ?>">
 
<?
 
if (( !isset($_POST['valid_station']))) {
 
/***** Demande d'envoi d'observations *****/
 
if (!$choixCommune) {
//Récupération des stations d'observation
$requete_stations = mysql_query("select distinct STATION.STATION_NOM, STATION.STATION_ID from STATION where STATION.PARTICIPANT_ID=".$_SESSION['participant']);
$num=0;
while ($station = mysql_fetch_row($requete_stations)) {
echo mysql_error();
?>
<input type="radio" name="station" value="<?= $station[1] ?>" ><?= $station[0] ?><br>
<?
}
}
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
?>
 
 
<center>
<input type="submit" class="submit" name="valid_station" value="Choisir cette station">
</center>
<input type="hidden" name="etape" value="<?= $etape ?>">
<input type="hidden" name="<?= $provenance ?>" value="1">
<input type="hidden" name="<?= $provenance ?>etape" value="<?= $etape ?>">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/espece.php
New file
0,0 → 1,27
<?
 
if (!isset($_POST['valid_espece']) || sizeof($erreurs)>0) {
 
/***** Demande d'envoi d'observations *****/
 
$requete_espece = mysql_query("select ESPECE.ESPECE_ID, ESPECE_NOM_VERNACULAIRE, ESPECE_NOM_SCIENTIFIQUE from ESPECE,CARACTERISTIQUE_ESP_LIEN where CARACTERISTIQUE_ESP_ID=1 and CARACTERISTIQUE_ESP_VALEUR_ID=".$_SESSION['observation']['type_espece_id']." and ESPECE.ESPECE_ID=CARACTERISTIQUE_ESP_LIEN.ESPECE_ID and ESPECE_ACTIVE=1 order by ESPECE_NOM_VERNACULAIRE");
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
?>
 
<form name="form_espece" method="post" action="<?= $url_page ?>">
 
Espèce
<select name='espece<?= $multiple ? "[]' multiple size='4'" : "'" ?>>
<? while ($esp = mysql_fetch_row($requete_espece)) { ?>
<option value="<?= $esp[0] ?>"><?= $esp[1] ?>
<? } ?>
</select>
<input type="submit" class="submit" name="valid_espece" value="Choisir <?= $multiple ? "ces espèces" : "cette espèce" ?>">
<input type="hidden" name="etape" value="<?= $etape ?>">
<input type="hidden" name="<?= $provenance ?>" value="1">
<input type="hidden" name="<?= $provenance ?>etape" value="<?= $etape ?>">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/type_espece.php
New file
0,0 → 1,39
<?
 
if (!isset($_POST['valid_typesp']) || $_POST[$provenance]!='1') {
 
/***** Demande d'envoi d'observations *****/
 
$requete_type_espece = mysql_query("select CARACTERISTIQUE_ESP_VALEUR_ID, CARACTERISTIQUE_ESP_VALEUR_LIB from CARACTERISTIQUE_ESP_VALEUR where CARACTERISTIQUE_ESP_ID=1");
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
?>
 
<form name="form_typespece" method="post" action="<?= $url_page ?>">
 
Type d'espèce
 
<?
$ity=0;
while ($typesp = mysql_fetch_row($requete_type_espece)) {
if ($ity >0) {
?>
<input type="radio" name="typespece" value="<?= $typesp[0] ?>"><?= $typesp[1] ?>
<?
}
else { // Premier checked
?>
<input type="radio" name="typespece" value="<?= $typesp[0] ?>" checked><?= $typesp[1] ?>
<?
}
$ity++;
} ?>
<br></br>
<input type="submit" class="submit" name="valid_typesp" value="Choisir ce type d'espèce">
<input type="hidden" name="etape" value="<?= $etape ?>">
<input type="hidden" name="<?= $provenance ?>" value="1">
<input type="hidden" name="<?= $provenance ?>etape" value="<?= $etape ?>">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/altitude.php
New file
0,0 → 1,22
<?
 
if (!isset($_POST['valid_alt']) || sizeof($erreurs)>0) {
 
/***** Demande d'envoi d'observations *****/
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
?>
 
<form name="form_altitude" method="post" action="<?= $url_page ?>">
Entrez l'altitude d'observation ci-dessous. <br>
Vous pouvez rechercher l'altitude de votre commune d'observation sur le site de <a href="http://www.fallingrain.com/world/FR/">Falling Rain</a> ou utiliser la carte au 1/25000e
que vous trouverez sur le <a href="http://www.geoportail.fr/index.php?action=&langue=fr&event=VisitorConnected">Geoportail de l'IGN</a>.
Pour plus d'information, reportez-vous à la 1ère étape des <a href="article.php3?id_article=15">Protocoles d'observation</a> ?
<input type="text" name="altitude" value="<?= $_POST['altitude'] ?>">
<input type="submit" class="submit" name="valid_alt" value="Choisir cette altitude">
<input type="hidden" name="etape" value="3">
<input type="hidden" name="provenance" value="<?= $provenance ?>">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/saisie.php
New file
0,0 → 1,116
<?
if (!isset($_POST['valid_saisie']) || sizeof($erreurs)>0) {
 
/***** Demande d'envoi d'observations *****/
 
$requete_evenement= mysql_query("select EVENEMENT.EVENEMENT_ID, EVENEMENT_NOM from ESPECE_EVENEMENT, EVENEMENT where ESPECE_ID=".$_SESSION['observation']['espece_id']." and EVENEMENT.EVENEMENT_ID=ESPECE_EVENEMENT.EVENEMENT_ID and EVENEMENT_ACTIVE=1");
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
$MOIS_RENTREE = '09';
 
$mois = date('m');
$anneeEnCours = date('Y');
$anneeCrte = $anneeEnCours;
 
//if ($mois >= $MOIS_RENTREE)
//$anneeEnCours = $anneeEnCours+1;
 
 
// Recherche du nombre d'evenement associe a l'espece
$evenements_nombre=0;
$requete_nb_evenement= mysql_query("select count(*) FROM ESPECE_EVENEMENT where ESPECE_ID=".$_SESSION['observation']['espece_id']);
while ($evn = mysql_fetch_row($requete_nb_evenement)) {
$evenements_nombre = $evn[0];
}
 
 
?>
 
<form name="form_saisie" method="post" action="<?= $url_page ?>">
 
<?
// Un seul évenenement ? On ne saisit qu'un seul individu
if ($evenements_nombre==1) {
?>
<table class="spip">
<tr class="row_even" style="font-weight: bold; font-size: 11px;">
<td width="100">Evènement</td>
<td>1er individu</td>
</tr>
Pour chaque individu de cette espèce, indiquez la date observée pour chaque événement  : 1ère fleur épanouie pour herbacée,  1ère apparition de l'espèce pour oiseaux et insectes.
 
<?
}
else {
?>
 
<table class="spip">
<tr class="row_even" style="font-weight: bold; font-size: 11px;">
<td width="100">Evènement</td>
<td>1er individu</td>
<td>2ème individu</td>
<td>3ème individu</td>
<td>4ème individu</td>
<td>5ème individu</td>
</tr>
Pour chaque individu de cette espèce, indiquez la date observée pour chaque événement :<br>
<?
}
?>
 
 
<?
while ($ev = mysql_fetch_row($requete_evenement)) {
$evenements_poss[] = array($ev[0],$ev[1]);
}
?>
</td>
<?
$styleligne = array("odd","even");
$l = 0;
foreach ($evenements_poss as $eve_poss) {
?>
<tr class="row_<?= $styleligne[$l] ?>">
<td>
<?= $eve_poss[1] ?> :
</td>
<?
 
 
// Un seul évenenement ? On ne saisit qu'un seul individu
if ($evenements_nombre==1) {
$lim=1;
}
else {
$lim=5;
}
 
for ($i=0; $i<$lim; $i++) {
$anneeSelect = $anneeEnCrte;
if (sizeof($erreurs)>0)
$anneeSelect = $_POST['evenements'][$eve_poss[0]][$i][2];
?>
<td>
<input type="text" name="evenements[<?= $eve_poss[0] ?>][<?= $i ?>][0]" size="2" value="<?= sizeof($erreurs)>0 ? $_POST['evenements'][$eve_poss[0]][$i][0] : "jj" ?>">
<input type="text" name="evenements[<?= $eve_poss[0] ?>][<?= $i ?>][1]" size="2" value="<?= sizeof($erreurs)>0 ? $_POST['evenements'][$eve_poss[0]][$i][1] : "mm" ?>">
<select name="evenements[<?= $eve_poss[0] ?>][<?= $i ?>][2]">
<option value="<?= ($anneeEnCours-1) ?>" <?= ($anneeSelect==$anneeEnCours-1) ? "selected" :"" ?>>
<?= ($anneeEnCours-1) ?>
<option value="<?= $anneeEnCours ?>" <?= ($anneeSelect==$anneeEnCours) ? "selected" :"" ?>>
<?= $anneeEnCours ?>
</select>
</td>
<? } ?>
</tr>
<? $l++;
if ($l==2)
$l=0;
} ?>
</table>
<input type="submit" class="submit" name="valid_saisie" value="Valider">
<input type="hidden" name="etape" value="4">
</form>
<? }
?>
/obs_saisons/SPIP-v1-8-3/modules/observations/encours.php
New file
0,0 → 1,38
<?
$MOIS_EN_COURS = '09';
$mois = date('m');
$annee = date('Y');
 
if ($mois > $MOIS_RENTREE)
$annee = $annee+1;
 
$requete_obs_annee = mysql_query("select distinct SEQUENCE.SEQUENCE_ID, ESPECE_NOM_VERNACULAIRE, STATION_NOM from SEQUENCE,ESPECE,STATION,MESURE ".
"where ESPECE.ESPECE_ID=SEQUENCE.ESPECE_ID".
" and MESURE.SEQUENCE_ID=SEQUENCE.SEQUENCE_ID".
" and SEQUENCE.PARTICIPANT_ID=".$_SESSION['participant'].
" and STATION.STATION_ID=SEQUENCE.STATION_ID".
" AND MESURE_DATE!='0000-00-00' and MESURE_DATE>'".($annee-1)."-01-01'".
" and MESURE_DATE<'$annee-01-01'".
" order by STATION_NOM, ESPECE_NOM_VERNACULAIRE");
 
$station_encours = "";
if (mysql_num_rows($requete_obs_annee)>0)
echo "<br><br>Vos observations effectuées cette année :<br>";
?>
<form name="form_modif_obs" method="post" action="<?= $url_page ?>">
<table border="0">
<?
while ($obs = mysql_fetch_row($requete_obs_annee)) {
if ($obs[2]!=$station_encours) {
echo "<tr><td colspan=3>&nbsp;</td></tr>";
echo "<tr><th colspan=3 align=left>Station : ".$obs[2]."</th></tr>";
}
//if ($obs[1]!=$espece_encours)
echo "<tr><td>Espèce : </td><td>".$obs[1]."&nbsp;</td><td><input type='submit' class='submit' name='modifev_".$obs[0]."' value='Ajouter/modifier des observations'></td></tr>";
 
//$espece_encours=$obs[1];
$station_encours=$obs[2];
}
?>
</table>
</form>
/obs_saisons/SPIP-v1-8-3/modules/observations/commune.php2308
New file
0,0 → 1,78
<?
 
if (isset($_POST['valid_cp']) || isset($POST['valid_commune'])) {
if (strlen($_POST['code_postal'])==0) {
$erreurs[] = $cp_manquant;
}
}
 
if (isset($_POST['valid_cp']) && sizeof($erreurs)==0 && !isset($_POST['commune'])) {
//Vérification de la commune
$requete_commune = mysql_query("select COMMUNE_ID, COMMUNE_NOM from COMMUNE where COMMUNE_CODEPOSTAL LIKE '%".$_POST['code_postal']."'");
$nb_communes_poss = mysql_num_rows($requete_commune);
if ($nb_communes_poss > 1)
$choixCommune = true;
else if ($nb_communes_poss>0) {
$commune_tab = mysql_fetch_row($requete_commune);
$commune = $commune_tab[0];
$choixCommune = true;
} else {
$erreurs[] = $commune_invalide;
}
}
 
/*if (isset($_POST['valid_cp']) && sizeof($erreurs)==0) {
$erreurs[] = "Clique sur Choisir cette commune pour valider";
}*/
 
/*
//S'il n'y a qu'une commune correspondant au code postal choisi
if (isset($_POST['valid_cp']) && sizeof($erreurs)==0 && !$choixCommune) {
//Récupération de la commune
if (!$commune)
$commune = $_POST['commune'];
}
*/
 
if (!(isset($_POST['valid_cp']) && sizeof($erreurs)==0) || $choixCommune) {
 
/***** Demande d'envoi d'observations *****/
 
if (!$choixCommune) {
//Récupération de la commune d'inscription
$requete_commune_inscr = mysql_query("select COMMUNE.COMMUNE_NOM, COMMUNE_CODEPOSTAL from COMMUNE, PARTICIPANT where PARTICIPANT.PARTICIPANT_ID=".$_SESSION['participant']." and PARTICIPANT.COMMUNE_ID=COMMUNE.COMMUNE_ID");
echo mysql_error();
$commune_inscr_ligne = mysql_fetch_row($requete_commune_inscr);
if ($commune_inscr_ligne) {
$cp = $commune_inscr_ligne[1];
$commune_inscription = $commune_inscr_ligne[0];
}
}
else {
$cp = $_POST['code_postal'];
$requete_communes_cp = mysql_query("select COMMUNE_ID, COMMUNE_NOM from COMMUNE where COMMUNE_CODEPOSTAL='$cp'");
}
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
?>
 
<form name="form_observation" method="post" action="#">
 
Code postal de ta commune d'observation : &nbsp;<input type="text" name="code_postal" value="<?= $cp ?>">
<? if (!$choixCommune) {
echo "(".$commune_inscription.")<br>";
} else { ?>
<br>Le code postal que tu as entré correspond à plusieurs communes, choisis la tienne dans la liste :<br>
<? while ($commune = mysql_fetch_row($requete_communes_cp)) { echo mysql_error(); ?>
<input type="radio" name="commune" value="<?= $commune[0] ?>" <?= $commune_inscription==$commune[0] ? "checked" : "" ?>><?= $commune[1] ?><br>
<? } ?>
<? } ?>
<center>
<input type="submit" class="submit" name="valid_cp" value="Changer de commune">
<input type="submit" class="submit" name="valid_commune" value="Choisir cette commune">
</center>
<input type="hidden" name="etape" value="1">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/station.php
New file
0,0 → 1,982
<?
 
 
if (!isset($_POST['valid_station']) || sizeof($erreurs)>0) {
 
?>
 
Définissez vos stations d'observation :
 
<br>
<form id="addr" action="#" method="get" onsubmit="return showAddress(this);" style="float:left;">
<ul style="list-style-type:none;margin:0;padding:0;">
<li>
<label for="lieu">Selectionnez la commune la plus proche de votre station :</label>
<input id="lieu" type="text" size="30" name="lieu" value=""/>
<input type="submit" value="Localiser" />
</li>
<li>
Ensuite, positionnez la pastille rouge sur votre station et donnez lui un nom.
</li
</ul>
</fieldset>
</form>
 
<div id="map" style="width:600px;height:400px;border:2px solid grey;margin:10px 0;clear:both;"></div>
 
<?php
 
//Récupération des stations existantes
 
//FONCTIONNEMENT_TESTE_ET_OK
 
 
// les stations de l'observateur :
 
$requete_stations = mysql_query("select STATION_ID, STATION_NOM, STATION_LATITUDE, STATION_LONGITUDE, STATION_ALTITUDE, STATION_ENVIRONNEMENT_ID, ENVIRONNEMENT_NOM from STATION, ENVIRONNEMENT where STATION.PARTICIPANT_ID=".$_SESSION['participant']." AND ENVIRONNEMENT_ID=STATION_ENVIRONNEMENT_ID ORDER BY STATION_NOM");
 
 
 
$nb_requete_stations = @mysql_num_rows($requete_stations);
 
 
 
 
 
 
$stations=array();
 
 
echo "<br>";
echo "</br>\n";
echo "<b>Vos stations enregistrées (Cliquez sur le nom de la station pour ajouter de nouvelles espèces) :</b> <br>";
 
 
?>
<form name="form_station" method="post" action="<?= $url_page ?>">
<input type="hidden" name="etape" value="<?= $etape ?>">
<input type="hidden" name="<?= $provenance ?>" value="1">
<input type="hidden" name="<?= $provenance ?>etape" value="<?= $etape ?>">
<?php
 
echo "<table id='tabstations'>";
 
 
 
if ($nb_requete_stations > 0) {
 
 
// Liste des stations
 
$MOIS_EN_COURS = '09';
$MOIS_RENTREE = '09'; // FIXME : quelle difference avec la variable precedente ?
$mois = date('m');
$annee = date('Y');
 
//$annee=$annee+1;
/*
if ($mois > $MOIS_RENTREE) {
$annee = $annee+1;
}
*/
 
while ($station = mysql_fetch_assoc($requete_stations)) {
 
 
$stations [] = $station;
echo "<tr>";
echo "<td><strong>Station : <a title=\"Ajouter de nouvelles espèces\" href=\"".$url_page."&station_id=".$station['STATION_ID']."\">".$station['STATION_NOM']."</a><strong></td>";
 
 
 
// echo "<td>".$station['STATION_LATITUDE']."</td>";
//echo "<td>".$station['STATION_LONGITUDE']."</td>";
//echo "<td>".$station['STATION_ALTITUDE']."</td>";
//echo "<td>"."<input type=\"submit\" class=\"submit\" name=\"".$station['STATION_ID']."\" value=\"Choisir cette station\"></td>";
 
// A t-on des mesures associe a cette station ? Si oui on ne peut pas la modifier ni supprimer
 
$requete_mesure = mysql_query("SELECT MESURE.SEQUENCE_ID FROM MESURE,SEQUENCE,STATION where MESURE.SEQUENCE_ID=SEQUENCE.SEQUENCE_ID AND STATION.STATION_ID=SEQUENCE.STATION_ID AND STATION.PARTICIPANT_ID=".$_SESSION['participant']." AND STATION.STATION_ID=".$station['STATION_ID']);
$nb_requete_mesure = mysql_num_rows($requete_mesure);
 
$obs_existe=false;
 
if ($nb_requete_mesure == 0) { // Pas de mesure on peut modifier
echo "<td>"."<input type=\"submit\" class=\"submit\" name=\"".$station['STATION_ID']."\" value=\"Modifier\"></td>";
}
else {
$obs_existe=true;
echo "<td></td>";
}
 
echo "</tr>";
 
 
 
 
$requete_obs_annee = mysql_query("select distinct SEQUENCE.SEQUENCE_ID, ESPECE_NOM_VERNACULAIRE, STATION_NOM from SEQUENCE,ESPECE,STATION,MESURE ".
"where ESPECE.ESPECE_ID=SEQUENCE.ESPECE_ID".
" and MESURE.SEQUENCE_ID=SEQUENCE.SEQUENCE_ID".
" and SEQUENCE.PARTICIPANT_ID=".$_SESSION['participant'].
" and STATION.STATION_ID=". $station['STATION_ID'] .
" and STATION.STATION_ID=SEQUENCE.STATION_ID".
" AND MESURE_DATE!='0000-00-00' and MESURE_DATE>'".($annee-2).'-'.($mois)."-01'".
" and MESURE_DATE<'".($annee).'-'.($mois)."-01'".
" order by STATION_NOM, ESPECE_NOM_VERNACULAIRE");
 
$nb_requete_obs_annee = mysql_num_rows($requete_obs_annee);
 
if (($nb_requete_obs_annee == 0) && ($obs_existe)) {
echo "<tr>";
echo "<td>Observations archivées </td>";
echo "</tr>";
 
}
 
while ($obs = mysql_fetch_assoc($requete_obs_annee)) {
echo "<tr>";
echo "<td>Espèce : <a title=\"Ajouter/modifier des observations\" href=\"".$url_page."&sequence_id=".$obs['SEQUENCE_ID']."\">".$obs['ESPECE_NOM_VERNACULAIRE']."</a></td>";
echo "</tr>";
}
 
echo "<tr>";
echo "</tr>";
echo "<tr>";
echo "</tr>";
 
}
 
 
 
// On retient la premiere station pour centrage
 
$init_lat=$stations[0]['STATION_LATITUDE'];
$init_lon=$stations[0]['STATION_LONGITUDE'];
 
 
}
else {
 
// Pas de stations : affichage centre carte france
// FONCTIONNEMENT_TESTE_ET_OK
 
 
$init_lat=45.545;
$init_lon=3.249722;
 
echo "<td><strong>Pas de station enregistr&eacute;e</strong></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "</tr>";
 
 
 
}
 
echo "</table>";
echo "</form>";
 
 
 
 
 
//$espece_encours=$obs[1];
$commune_encours=$obs[2];
 
 
 
/***** Selection des stations *****/
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
?>
 
 
 
 
<form id="form_coordonnee" action="<?= $url_page ?>" method="post" style="float:left;">
<input id="ll_latitude" name="ll_latitude" type="hidden" value="" />
<input id="ll_latitude_dms" name="ll_latitude_dms" type="hidden" value="" />
<input id="ll_longitude" name="ll_longitude" type="hidden" value="" />
<input id="ll_longitude_dms" name="ll_longitude_dms" type="hidden" value="" />
<input id="ll_altitude" name="ll_altitude" type="hidden" value="" />
<input id="form_coordonnee_valider" name="valid_station" class="submit" type="hidden" value="Poursuivre" />
<input type="hidden" name="etape" value="3">
<input type="hidden" name="provenance" value="<?= $provenance ?>">
</li>
</ul>
 
</form>
 
 
 
<?php
 
include_once 'modules/configuration/car_config.inc.php' ;
 
if (PARTICIPANT_EST_ADULTE) {
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAnm2MSMmwsDuoh7THcVDnlBQH9AL26AfEfaraxwo1G6_adyVjPRRQE4Gx2u7MomK9DJWf9kMLJ9y-ZA" type="text/javascript"></script>
<?php
}
else {
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAFMANWib9GSm7T4W6AN9qzxRmHYqXwt_BUwczny2vFmnHz3sr3BTy_SMRJ-NzWXDUynHHSWQ7_aEZ6Q" type="text/javascript"></script>
<?php
}
 
 
// Centrage initial : premiere station ou ville d'inscription
 
echo "<script type=\"text/javascript\">";
echo "\n//<![CDATA[\n";
echo "var init_lat = ".$init_lat.";\n";
echo "var init_long = ".$init_lon.";\n";
 
?>
 
 
var largeur_carte = 690;
var haureur_retrait = 330;
 
var init_zoom = 10;
 
// Contient la carte GoogleMap
var map;
// Contient l'utilitaire permettant de trouver une adresse.
var EfGeocoder;
// Point de l'adresse saisie et à passer au GeoCoder
var addrpnt;
// L'icône à afficher sur la carte
var icon;
 
function load() {
// Vérification de la compatibilité du navigateur
if (GBrowserIsCompatible()) {
// Création de la carte
map = new GMap2(document.getElementById("map"));
// Positionnement de la carte
map.setCenter(new GLatLng(init_lat, init_long), init_zoom);
// Types de carte disponibles :
map.addMapType(G_NORMAL_MAP);
map.addMapType(G_SATELLITE_MAP);
map.addMapType(G_PHYSICAL_MAP);
// Bouton pour changer de type de carte (mixte, satellite, plan)
map.addControl(new GMapTypeControl(1));
// Définition du type de la carte par défaut
map.setMapType(G_HYBRID_MAP);
// Bouton large de déplancement et zoom apparaissant dans le coin haut gauche
map.addControl(new GLargeMapControl());
// Pour hierarchiser les types de carte --> pas encore dans la version stable...
//var mapControl = new GHierarchicalMapTypeControl();
// Définition des relations des types de menus
//mapControl.clearRelationships();
//mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, 'Labels', false);
// Ajout du controle après avoir spécifié les relations
//map.addControl(mapControl);
// Vue d'ensemble apparaissant dans le coin bas droit
var EfOverViewMap = new GOverviewMapControl();
map.addControl(EfOverViewMap);
var mini = EfOverViewMap.getOverviewMap();
// ?
map.enableContinuousZoom();
// Zoom avec la molette de la souris
map.enableScrollWheelZoom();
// Zoom avec le double clic de la souris
map.enableDoubleClickZoom();
 
// Création du GéoCoder
EfGeocoder = new GClientGeocoder() ;
 
// Icone station enregistrees (vert)
icon = new GIcon();
icon.image = "http://www.google.com/mapfiles/ms/micons/green-dot.png";
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
icon.iconSize = new GSize(34, 34);
icon.shadowSize = new GSize(37, 34);
icon.iconAnchor = new GPoint(16, 34);
// Pour affichage infobulle
icon.infoWindowAnchor = new GPoint(5,1);
 
 
// Icone nouvelle station (rouge) ou station en modification
Nicon = new GIcon();
Nicon.image = "http://www.google.com/mapfiles/ms/micons/red-dot.png";
Nicon.shadow = "http://www.google.com/mapfiles/shadow50.png";
Nicon.iconSize = new GSize(34, 34);
Nicon.shadowSize = new GSize(37, 34);
Nicon.iconAnchor = new GPoint(16, 34);
// Pour affichage infobulle
Nicon.infoWindowAnchor = new GPoint(5,1);
 
 
 
 
// Creates a marker at the given point with the given number label
 
function createMarker(point, text, altitude, envir) {
var marker = new GMarker(point,icon);
var html = text;
GEvent.addListener(marker, "click", function() {
map.setCenter(marker.getPoint());
afficherInfo(marker.getPoint());
afficherMasque(marker,text,altitude,envir);
});
return marker;
}
 
// Affichage des stations presentes TODO : et si plusieurs stations au meme endroit ? Utiliser cluster ?
 
<? foreach($stations as $station) { ?>
var point = new GLatLng(<?= $station['STATION_LATITUDE'] ?>, <?= $station['STATION_LONGITUDE'] ?>);
map.addOverlay(createMarker(point, "<?= $station['STATION_NOM'] ?>","<?= $station['STATION_ALTITUDE'] ?>", "<?= $station['ENVIRONNEMENT_NOM'] ?>"));
<? } ?>
 
 
}
}
 
 
 
function showAddress(form) {
if (form.lieu.value != '') {
var lieu = form.lieu.value;
EfGeocoder.getLatLng(lieu, function(position) {
if (!position) {
alert('Le lieu "'+lieu+'" est introuvable! Veuillez essayer un autre nom.')
} else {
placerMarkeur(position);
map.setCenter(position, 14) ;
}
// Vidage du champ du formulaire
form.lieu.value = '';
});
} else {
var position = new GLatLng(form.lati.value, form.longi.value);
placerMarkeur(position);
map.setCenter(position, 14);
// Vidage des champs du formulaire
form.lati.value = '';
form.longi.value = '';
}
return false;
}
 
// Ajout d'un nouveau marqueur dragable , depuis le geocodage uniquement (blocage du clic depuis la carte)
 
function placerMarkeur(position) {
if (addrpnt) {
map.removeOverlay(addrpnt);
}
addrpnt = new GMarker(position, {icon: Nicon, draggable: true, title: 'Click sur la carte!'}) ;
addrpnt.enableDragging() ;
map.addOverlay(addrpnt) ;
GEvent.addListener(addrpnt,'dragend',function() {
map.setCenter(addrpnt.getPoint());
afficherInfo(addrpnt.getPoint());
afficherMasque(addrpnt,"");
 
}) ;
 
GEvent.addListener(addrpnt, "click", function() {
map.setCenter(addrpnt.getPoint());
afficherInfo(addrpnt.getPoint());
afficherMasque(addrpnt,"");
});
 
afficherInfo(position);
}
 
// Masque de mise a jour station :
 
function afficherMasque(position,nom,altitude,envir) {
 
// On recupere les données du formulaire (caché) , notamment pour traiter simplement l'appel asynchrone de recup altitude
 
var html = "<table>";
if (nom.length>0) {
html = html + "<tr><td>Station :</td> <td>" + nom + "</td> </tr>";
 
 
 
 
html = html + "<tr><td>Environnement :</td> <td>" + envir + "</td> </tr>";
 
html = html + "</td></tr>";
 
 
 
}
else {
html = html + "<tr><td>Station</td> <td><input type='text' id='nom_station' value=''/> </td> </tr>";
<?
$requete_environnement = mysql_query("select ENVIRONNEMENT_ID, ENVIRONNEMENT_NOM from ENVIRONNEMENT");
?>
 
html = html + "<tr><td>Environnement :</td>";
html = html + "<td><select id='environnement_id' name='environnement'>";
 
<? while ($env = mysql_fetch_row($requete_environnement)) { ?>
html = html + "<option value='<?= $env[0] ?>'><?= $env[1] ?>";
<? } ?>
 
html = html + "</select></td></tr>";
 
}
 
 
 
 
html = html + "<tr><td>Latitude :</td> <td>" +document.getElementById('ll_latitude').value + "</td> </tr>" ;
html = html + "<tr><td>Latitude :</td> <td>" +document.getElementById('ll_latitude').value + "</td> </tr>" ;
html = html + "<tr><td>Longitude :</td> <td>" + document.getElementById('ll_longitude').value + "</td> </tr>";
if (altitude) {
html = html + "<tr><td>Altitude :</td> <td>" + altitude + "</td> </tr>";
}
else {
html = html + "<tr><td>Altitude :</td> <td>" + document.getElementById('ll_altitude').value + "</td> </tr>";
}
if (nom.length==0) {
html = html + "<tr><td></td><td><input type='button' value='Enregistrer' onclick='saveData()'/></td></tr>";
}
 
 
position.openInfoWindow(html);
 
}
 
 
// Sauvegarde station
 
// TODO : Retrouver marker depuis lat/lon
 
function saveData() {
 
var nom_station = escape(document.getElementById("nom_station").value);
var lat_station = document.getElementById("ll_latitude").value;
var lon_station = document.getElementById("ll_longitude").value;
var alt_station = document.getElementById("ll_altitude").value;
var environnement_id = document.getElementById("environnement_id").value;
 
var url = "modules/observations/sauvegarde_station.php?nom_station=" + nom_station + "&action=C" + "&lat_station=" + lat_station +
"&lon_station=" + lon_station + "&environnement_id=" + environnement_id + "&alt_station=" + alt_station + "&participant_id=<?= $_SESSION['participant'] ?>";
 
GDownloadUrl(url, function(data, responseCode) {
if (responseCode == 200 && data.length <= 1) {
window.location = "<?= $url_page ?>";
}
});
}
 
function afficherInfo(position) {
var form = document.getElementById('form_coordonnee');
afficherCoordonnees(position.lat().toString(), position.lng().toString());
}
 
function afficherCoordonnees(lati, longi) {
var ellipsoid = 21;// 21 = WGS-84 (voir geo_constants)
var xtm = 0;// 0 = UTM et 1= MTM
var Coordonnee = calculer_coordonnee(lati, longi, ellipsoid, xtm);
 
// Nous affichons des informations.
document.getElementById('ll_latitude').value = Coordonnee.latitude.toFixed(4);
document.getElementById('ll_longitude').value = Coordonnee.longitude.toFixed(4);
document.getElementById('ll_latitude_dms').value = Coordonnee.latitude_dms;
document.getElementById('ll_longitude_dms').value = Coordonnee.longitude_dms;
 
// Calcul altitude
var script = document.createElement('script');
document.body.appendChild(script);
script.src = 'http://ws.geonames.org/' + "srtm3" + 'JSON?lat=' + lati + '&lng=' + longi + '&callback=GetAltitude';
 
 
}
 
function GetAltitude(result ) {
document.getElementById('ll_altitude').value = result.srtm3;
}
 
window.onload = load
window.onunload = GUnload
 
/* A supprimer ? */
 
/* Source : Code provenant du site http://pages.globetrotter.net/roule/utmgoogle.htm
*/
 
var deg2rad = Math.PI / 180;
 
/*
* Fonction de transformation de coordonnées géographiques entre ellipsoide.
* Source : http://home.hiwaay.net/~taylorc/bookshelf/math-science/geodesy/datum/transform/molodensky/
* Licence : "The source code in the listing below may be copied and reused without restriction, but it is offered AS-IS with NO WARRANTY."
*
* Parameters:
* from: The geodetic position to be translated. (objet : GeodeticPosition)
* from_a: The semi-major axis of the "from" ellipsoid. (double)
* from_f: Flattening of the "from" ellipsoid. (double)
* from_esq: Eccentricity-squared of the "from" ellipsoid. (double)
* da: Change in semi-major axis length (meters); "to" minus "from"
* df: Change in flattening; "to" minus "from" (double)
* dx: Change in x between "from" and "to" datum. (double)
* dy: Change in y between "from" and "to" datum. (double)
* dz: Change in z between "from" and "to" datum. (double)
*
* Paramêtres :
* from : l'objet GeodesiquePosition à transformer (contient latitute, longitude et hauteur)
* from_a : le demi grand axe (=a) de l'ellipsoïde utilisé pour la position géodésique contenu dans l'objet "from".
* from_f : l'applatissement (=f) = 1/valeur... de l'ellipsoïde de l'objet "from"
* from_esq : l'excentricité au carré de l'ellipsoïde de l'objet "from"
* da : différence de demi grand axe (en metres) entre l'ellipsoïde "to" et "from".
* df : différence d'applatissement entre l'ellipsoïde "to" et "from".
* dx : différence pour l'axe x entre l'ellipsoïde "to" et "from".
* dy : différence pour l'axe y entre l'ellipsoïde "to" et "from".
* dz : différence pour l'axe z entre l'ellipsoïde "to" et "from".
*/
function transform(from, from_a, from_f, from_esq, da, df, dx, dy, dz) {
var slat = Math.sin (from.lat);
var clat = Math.cos (from.lat);
var slon = Math.sin (from.lon);
var clon = Math.cos (from.lon);
var ssqlat = slat * slat;
// "a divided by b"
var adb = 1.0 / (1.0 - from_f);
var dlat, dlon, dh;
 
var rn = from_a / Math.sqrt (1.0 - from_esq * ssqlat);
var rm = from_a * (1. - from_esq) / Math.pow ((1.0 - from_esq * ssqlat), 1.5);
 
dlat = (((((-dx * slat * clon - dy * slat * slon) + dz * clat) + (da * ((rn * from_esq * slat * clat) / from_a))) + (df * (rm * adb + rn / adb) * slat * clat))) / (rm + from.h);
 
dlon = (-dx * slon + dy * clon) / ((rn + from.h) * clat);
 
dh = (dx * clat * clon) + (dy * clat * slon) + (dz * slat) - (da * (from_a / rn)) + ((df * rn * ssqlat) / adb);
 
// Retour des données sous forme d'objet
var GeodeticPosition = { lon: from.lon + dlon,
lat: from.lat + dlat,
h: from.h + dh
};
 
return GeodeticPosition;
}
 
function test_transform() {
var PositionNtf = { lon: 7.7372, lat: 48.6, h: 0 };
var PositionWGS84 = transform(PositionNtf, 6378249.2, 0.00340755, 0.0068034881, -112.2, 0.00005474, -168, -60, 320);
alert('Longitude : ' + PositionWGS84.lon + 'Latitude : ' + PositionWGS84.lat + 'Hauteur : ' + PositionWGS84.h);
}
 
// Indiquer l'ellipsoid par son index dans le table et pour le xtm mettre 0 pour l'UTM et 1 pour le MTM (?)
function geo_constants(ellipsoid, xtm) {
// returns ellipsoid values
ellipsoid_axis = new Array(); // valeur du demi grand axe (a) de l'ellipsoïde
ellipsoid_eccen = new Array(); // valeur de l'excentricité au carré (e²) de l'ellipsoïde
ellipsoid_axis[0] = 6377563.396; ellipsoid_eccen[0] = 0.00667054; //airy
ellipsoid_axis[1] = 6377340.189; ellipsoid_eccen[1] = 0.00667054; // mod airy
ellipsoid_axis[2] = 6378160; ellipsoid_eccen[2] = 0.006694542; //aust national
ellipsoid_axis[3] = 6377397.155; ellipsoid_eccen[3] = 0.006674372; //bessel 1841
ellipsoid_axis[4] = 6378206.4; ellipsoid_eccen[4] = 0.006768658; //clarke 1866 == NAD 27 (TBC)
ellipsoid_axis[5] = 6378249.145; ellipsoid_eccen[5] = 0.006803511; //clarke 1880
ellipsoid_axis[6] = 6377276.345; ellipsoid_eccen[6] = 0.00637847; //everest
ellipsoid_axis[7] = 6377304.063; ellipsoid_eccen[7] = 0.006637847; // mod everest
ellipsoid_axis[8] = 6378166; ellipsoid_eccen[8] = 0.006693422; //fischer 1960
ellipsoid_axis[9] = 6378150; ellipsoid_eccen[9] = 0.006693422; //fischer 1968
ellipsoid_axis[10] = 6378155; ellipsoid_eccen[10] = 0.006693422; // mod fischer
ellipsoid_axis[11] = 6378160; ellipsoid_eccen[11] = 0.006694605; //grs 1967
ellipsoid_axis[12] = 6378137; ellipsoid_eccen[12] = 0.00669438; // grs 1980
ellipsoid_axis[13] = 6378200; ellipsoid_eccen[13] = 0.006693422; // helmert 1906
ellipsoid_axis[14] = 6378270; ellipsoid_eccen[14] = 0.006693422; // hough
ellipsoid_axis[15] = 6378388; ellipsoid_eccen[15] = 0.00672267; // int24
ellipsoid_axis[16] = 6378245; ellipsoid_eccen[16] = 0.006693422; // krassovsky
ellipsoid_axis[17] = 6378160; ellipsoid_eccen[17] = 0.006694542; // s america
ellipsoid_axis[18] = 6378165; ellipsoid_eccen[18] = 0.006693422; // wgs-60
ellipsoid_axis[19] = 6378145; ellipsoid_eccen[19] = 0.006694542; // wgs-66
ellipsoid_axis[20] = 6378135; ellipsoid_eccen[20] = 0.006694318; // wgs-72
ellipsoid_axis[21] = 6378137; ellipsoid_eccen[21] = 0.00669438; //wgs-84 (et NAD83 : pourquoi mis avec WGS84 ?)
 
if (ellipsoid == 0) {
ellipsoid = 22;
}
 
--ellipsoid; // table indexed differently
 
if (xtm == 1) {
// WAS: if (ellipsoid > 22)
scaleTm = 0.9999;
eastingOrg = 304800.;
} else {
scaleTm = 0.9996;
eastingOrg = 500000.;
}
 
// Retour des données sous forme d'objet
var ellipsoid = { axis: ellipsoid_axis[ellipsoid],
eccentricity: ellipsoid_eccen[ellipsoid],
eastingOrg: eastingOrg,
scaleTm: scaleTm
};
return ellipsoid;
}
 
/**This routine determines the correct UTM letter designator for the given latitude
* returns 'Z' if latitude is outside the UTM limits of 84N to 80S
*/
function get_zoneletter(lat) {
var zoneletter;
if ((84 >= lat) && (lat >= 72)) zoneletter = 'X';
else if ((72 > lat) && (lat >= 64)) zoneletter = 'W';
else if ((64 > lat) && (lat >= 56)) zoneletter = 'V';
else if ((56 > lat) && (lat >= 48)) zoneletter = 'U';
else if ((48 > lat) && (lat >= 40)) zoneletter = 'T';
else if ((40 > lat) && (lat >= 32)) zoneletter = 'S';
else if ((32 > lat) && (lat >= 24)) zoneletter = 'R';
else if ((24 > lat) && (lat >= 16)) zoneletter = 'Q';
else if ((16 > lat) && (lat >= 8)) zoneletter = 'P';
else if (( 8 > lat) && (lat >= 0)) zoneletter = 'N';
else if (( 0 > lat) && (lat >= -8)) zoneletter = 'M';
else if ((-8> lat) && (lat >= -16)) zoneletter = 'L';
else if ((-16 > lat) && (lat >= -24)) zoneletter = 'K';
else if ((-24 > lat) && (lat >= -32)) zoneletter = 'J';
else if ((-32 > lat) && (lat >= -40)) zoneletter = 'H';
else if ((-40 > lat) && (lat >= -48)) zoneletter = 'G';
else if ((-48 > lat) && (lat >= -56)) zoneletter = 'F';
else if ((-56 > lat) && (lat >= -64)) zoneletter = 'E';
else if ((-64 > lat) && (lat >= -72)) zoneletter = 'D';
else if ((-72 > lat) && (lat >= -80)) zoneletter = 'C';
else zoneletter = chr(32 + 66); //This is here as an error flag to show that the Latitude is outside the UTM limits
return zoneletter;
}
 
function parseCoordinate(coordinate, type, format, spaced) {
var coordd;
var coordm;
var coords;
var coordh = 0;
 
if (coordinate.search(/(^ *-|[WOS])/i) >= 0) {
coordh = -1;
}
if (coordinate.search(/(^ *\+|[NE])/i) >= 0) {
coordh = 1;
}
 
// if (coordinate.search(/[EW]/i) >= 0 && !type) { type = 'lon'; }
// if (coordinate.search(/[NS]/i) >= 0 && !type) { type = 'lat'; }
 
coordinate = coordinate.replace(/,/g, '.'); // french commas
// not sure really needed.
coordinate = coordinate.replace(/[NESWO+\-]/gi,' '); // add also: °, ', " -- or replace everything that is not a number or a dot
 
// alert("coordinate = " + coordinate);
if (coordinate.search(/[0-9]/i) < 0) {
alert("Can't parse input field");
coordd = "";
return;
}
 
// http://www.gpsvisualizer.com/calculators
// http://www.javascriptkit.com/javatutors/redev2.shtml
var parts = coordinate.match(/([0-9\.\-]+)[^0-9\.]*([0-9\.]+)?[^0-9\.]*([0-9\.]+)?/);
// / (one or more) /
// ([0-9\.\-]+) digits, dot or -, one set
// [^0-9\.]* separator
// ([0-9\.]+)? digits, dot, zero or one set
// [^0-9\.]* separator
// ([0-9\.]+)? digits, dot, zero or one set
 
// *: 0|more +: 1|more ?: 0|1 http://www.javascriptkit.com/javatutors/redev2.shtml
if (!parts[1]) {
alert("Can't parse input field");
coordd = '';
return;
} else {
coordd = parts[1];
if (parts[2]) {
coordm = parts[2];
} else {
coordm = 0;
}
if (parts[3]) {
coords = parts[3];
} else {
coords = 0;
}
// n = parseFloat(parts[1]);
// if (parts[2]) { n = n + parseFloat(parts[2])/60; }
// if (parts[3]) { n = n + parseFloat(parts[3])/3600; }
}
 
// Retour des données sous forme d'objet
var Coordonnee = { coordd: coordd,
coordm: coordm,
coords: coords,
coordh: coordh
};
return Coordonnee;
}
 
function validate_dms(latd, latm, lats, latb, lonm, lond, lons, lonb) {
var valid = 1;
if (Math.abs(Number(latd)) >= 90)
valid = 0;
if (Number(latm) >= 60)
valid = 0;
if (Number(lats) >= 60)
valid = 0;
if (Math.abs(Number(lond)) >= 180)
valid = 0;
if (Number(lonm) >= 60)
valid = 0;
if (Number(lons) >= 60)
valid = 0;
 
return(valid);
}
 
// convert decimal degrees to dms
function convertir_en_dms(lat, lon) {
var latbrg = 1;
var lonbrg = 2;
if (lat < 0)
latbrg = 2
if (lon < 0)
lonbrg = 1;
// LEW: have to round here, else could end up with 60 seconds :-)
var tlat = Math.abs(lat) + 0.5 / 360000; // round up 0.005 seconds (1/100th)
var tlon = Math.abs(lon) + 0.5 / 360000;
 
var tlatdm = Math.abs(lat) + 0.5 / 60000; // round up 0.0005 minutes (1/1000th)
var tlondm = Math.abs(lon) + 0.5 / 60000;
 
var deglat = Math.floor(tlat);
var t = (tlat - deglat) * 60;
var minlat = Math.floor(t);
 
var minlatdm = Math.floor((tlatdm - Math.floor(tlatdm)) * 60 * 1000) / 1000;
 
var seclat = (t - minlat) * 60;
seclat = Math.floor(seclat * 100) / 100; // works in js 1.4
// seclat = seclat.toFixed(2); // 2 decimal places js 1.5 and later
 
var deglon = Math.floor(tlon);
 
t = (tlon - deglon) * 60;
var minlon = Math.floor(t);
 
var minlondm = Math.floor((tlondm - Math.floor(tlondm)) * 60 * 1000) / 1000;
 
var seclon = (t - minlon) * 60;
seclon = Math.floor(seclon * 100) / 100; // js 1.4
// seclon = seclon.toFixed(2); // js 1.5 and later
 
var latb = '';
if (latbrg > 0) {
latb = 'N';// 1 = N (nord)
} else {
latb = 'S';// 2 = S (sud)
}
var latdms = deglat + "° " + minlat + "' " + seclat + "\"";
 
var lonb = '';
if (lonbrg > 0) {
lonb = 'E'; // 2 = E (est)
} else {
lonb = 'W';// 1 = W (west)
}
var londms = deglon + "° " + minlon + "' " + seclon + "\"";
 
var chaine_latlon_dms = latdms + ' ' + latb + ' ' + londms + ' ' + lonb;
 
// Retour des données sous forme d'objet
var LatLongDms = { lat: lat,
lat_degre: Math.floor(tlatdm),
lat_min: minlatdm,
lat_s: seclat,
lat_direction:latb,
lat_dms:latdms,
lon: lon,
lon_degre: Math.floor(tlondm),
lon_min: minlondm,
lon_s: seclon,
lon_direction:lonb,
lon_dms:londms,
ll_dms:chaine_latlon_dms
};
return LatLongDms;
}
 
function calculer_coordonnee(lati, longi, ellips, xtm) {
// Récupération de l'ellipsoide
var ellipsoid = geo_constants(ellips, xtm);
var axis = ellipsoid.axis;
var eccent = ellipsoid.eccentricity;
var scaleTm = ellipsoid.scaleTm;
var eastingOrg = ellipsoid.eastingOrg;
 
// Nous parsons la latitude saisie
var CoordonneeLat = parseCoordinate(lati);
var latb = '';// vide
if (CoordonneeLat.coordh != 0) {
if (CoordonneeLat.coordh > 0) {
latb = 'N';// 1 = N (nord)
} else {
latb = 'S';// 2 = S (sud)
}
}
var latd = CoordonneeLat.coordd;
var latm = CoordonneeLat.coordm;
var lats = CoordonneeLat.coords;
 
// Nous parsons la longitude saisie
var CoordonneeLon = parseCoordinate(longi);
var lonb = '';// vide
if (CoordonneeLon.coordh != 0) {
if (CoordonneeLon.coordh > 0) {
lonb = 'E'; // 2 = E (est)
} else {
lonb = 'W';// 1 = W (west)
}
}
var lond = CoordonneeLon.coordd;
var lonm = CoordonneeLon.coordm;
var lons = CoordonneeLon.coords;
 
// cope with blank fields
if (latd == '' || lond == '') {
alert("Latitude and longitude degrees must be entered");
return;
}
 
// Indication de la direction par défaut pour la latitude et la longitude en France
if (latb == '') {
latb = 'N';// 1 = N (Nord)
}
if (lonb == '') {
lonb = 'E';// 2 = E (Est)
}
 
// Validation
var valid = validate_dms(latd, latm, lats, latb, lonm, lond, lons, lonb);
if (valid == 0) {
alert("Invalid degrees, minutes or seconds");
return;
}
 
var lat = Number(latd);
lat = lat + Number(latm) / 60;
lat = lat + Number(lats) / 3600;
if (latb == 'S') { // 2 = S
lat = lat * -1;
}
var lon = Number(lond);
lon = lon + Number(lonm) / 60;
lon = lon + Number(lons) / 3600;
if (lonb == 'W') { // 1 = W
lon = lon * -1;
}
 
if (lat >= 84 || lat <= -80) {
alert("UTM latitudes should be between 84N and 80S\nCalculation will proceed anyway as locator will be valid.");
}
 
var k0 = scaleTm;
var latrad = lat * deg2rad;
var longrad = lon * deg2rad;
var zonenum = Math.floor((lon + 180) / 6) + 1;
// @dc (180 - (-70.5))/3 - 76
if (eastingOrg == 304800.) {
zonenum = Math.floor((180 - lon) / 3) - 76; // MTM, only in Quebec
if (zonenum < 3 || zonenum > 10) {
alert("MTM zone numbers only confirmed for 3-10, province of Quebec\nContinuing anyway");
}
}
 
if (lat >= 56.0 && lat < 64.0 && lon >= 3.0 && lon < 12.0 ) {
zonenum = 32;
}
// Zones speciales pour Svalbard
if( lat >= 72.0 && lat < 84.0 ) {
if (lon >= 0.0 && lon < 9.0 ) zonenum = 31;
else if ( lon >= 9.0 && lon < 21.0 ) zonenum = 33;
else if ( lon >= 21.0 && lon < 33.0 ) zonenum = 35;
else if ( lon >= 33.0 && lon < 42.0 ) zonenum = 37;
}
 
var lonorig = (zonenum - 1) * 6 - 180 + 3; //+3 puts origin in middle of zone
// @dc 180 - (7+76) * 3 - 1.5
if (eastingOrg == 304800.) {
lonorig = 180 - (zonenum + 76) * 3 - 1.5;
}
var lonorigrad = lonorig * deg2rad;
 
//Récupération de la lettre du fuseau xTM
var letter = get_zoneletter(lat);
 
// Calcul xTM
var eccPrimeSquared = (eccent) / (1 - eccent);
var N = axis / Math.sqrt(1 - eccent * Math.sin(latrad) * Math.sin(latrad));
var T = Math.tan(latrad) * Math.tan(latrad);
var C = eccPrimeSquared * Math.cos(latrad) * Math.cos(latrad);
var A = Math.cos(latrad) * (longrad - lonorigrad);
var M = axis * ((1 - eccent / 4 - 3 * eccent * eccent / 64 - 5 * eccent * eccent * eccent / 256) * latrad - (3 * eccent / 8 + 3 * eccent * eccent / 32 + 45 * eccent * eccent *eccent / 1024) * Math.sin(2 * latrad) + (15 * eccent * eccent / 256 + 45 * eccent * eccent * eccent / 1024) * Math.sin(4 * latrad) - (35 * eccent * eccent * eccent / 3072) * Math.sin(6 * latrad));
 
var easting = (k0 * N * (A + (1 - T + C) * A * A * A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120) + eastingOrg);
var northing = (k0 * (M + N * Math.tan(latrad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720)));
if (lat < 0) {
northing += 10000000.0; //10000000 meter offset for southern hemisphere
}
 
// xTM
// Arrondi au nombre supérieur
// alert("easting = " + easting);
preciseEasting = easting;
easting = Math.floor(easting + .5);
// alert("easting = " + easting);
// alert("northing = " + northing);
preciseNorthing = northing;
northing = Math.floor(northing + .5);
// alert("northing = " + northing);
var chaine_xtm = '';
var x_tm = '';
if (eastingOrg == 304800.) {
chaine_xtm = zonenum + ' ' + easting + 'm E ' + northing + 'm N';
x_tm = 'MTM';
} else {
chaine_xtm = zonenum + letter + ' ' + easting + 'm E ' + northing + 'm N';
x_tm = 'UTM';
}
 
// Latitude/Longitude
var chaine_latlon = lat + ' ' + latb + ' ' + lon + ' ' + lonb;
var LatLongDms = convertir_en_dms(lat,lon);
 
// Retour des données sous forme d'objet
var Coordonnee = { xtm: x_tm,
nord: northing,
est: easting,
zone_numero: zonenum,
zone_lettre: letter,
xtm_chaine: chaine_xtm,
latitude:lat,
longitude:lon,
ll_chaine: chaine_latlon,
latitude_dms:LatLongDms.lat_dms,
longitude_dms:LatLongDms.lon_dms,
ll_chaine_dms: LatLongDms.ll_dms
};
return Coordonnee;
}
//]]>
 
</script>
 
<?
}
?>
 
 
/obs_saisons/SPIP-v1-8-3/modules/observations/annee.php
New file
0,0 → 1,20
<?
 
if (!isset($_POST['valid_annee']) || sizeof($erreurs)>0) {
 
/***** Demande d'envoi d'observations *****/
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
?>
 
<form name="form_annee" method="post" action="<?= $url_page ?>">
Saisissez l'année qui vous intéresse
<input type="text" name="annee" value="<?= $_POST['annee'] ?>">
<input type="submit" class="submit" name="valid_annee" value="Choisir cette année">
<input type="hidden" name="etape" value="<?= $etape ?>">
<input type="hidden" name="<?= $provenance ?>" value="1">
<input type="hidden" name="<?= $provenance ?>etape" value="<?= $etape ?>">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/evenement.php
New file
0,0 → 1,33
<?
 
//if (!isset($_POST['valid_evenement']) || sizeof($erreurs)>0) {
 
/***** Demande d'envoi d'observations *****/
 
$requete_evenement = mysql_query("select EVENEMENT.EVENEMENT_ID, EVENEMENT_NOM from EVENEMENT,ESPECE_EVENEMENT where ESPECE_ID=".$_SESSION['observation']['espece_id']." and EVENEMENT.EVENEMENT_ID=ESPECE_EVENEMENT.EVENEMENT_ID and EVENEMENT_ACTIVE=1");
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
if (isset($_POST['evenement']))
$id_ev=$_POST['evenement'];
else
$id_ev=$_SESSION['observation']['evenement_id'];
 
?>
 
<form name="form_evenement" method="post" action="<?= $url_page ?>">
 
Evènement
<select name='evenement'>
<? while ($ev = mysql_fetch_row($requete_evenement)) { ?>
<option value="<?= $ev[0] ?>" <?= ($ev[0]==$id_ev) ? "selected" : "" ?>><?= $ev[1] ?>
<? } ?>
</select>
<input type="submit" class="submit" name="valid_evenement" value="Choisir cet évènement">
<input type="hidden" name="etape" value="<?= $etape ?>">
<input type="hidden" name="<?= $provenance ?>" value="1">
<input type="hidden" name="<?= $provenance ?>etape" value="<?= $etape ?>">
</form>
<? //}
?>
/obs_saisons/SPIP-v1-8-3/modules/observations/environnement.php
New file
0,0 → 1,26
<?
 
if (!isset($_POST['valid_env'])) {
 
/***** Demande d'envoi d'observations *****/
 
$requete_environnement = mysql_query("select ENVIRONNEMENT_ID, ENVIRONNEMENT_NOM from ENVIRONNEMENT");
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
?>
 
<form name="form_environnement" method="post" action="<?= $url_page ?>">
 
Environnement du site d'observation
<select name="environnement">
<? while ($env = mysql_fetch_row($requete_environnement)) { ?>
<option value="<?= $env[0] ?>"><?= $env[1] ?>
<? } ?>
</select>
<input type="submit" class="submit" name="valid_env" value="Choisir cet environnement">
<input type="hidden" name="etape" value="2">
<input type="hidden" name="provenance" value="<?= $provenance ?>">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/sauvegarde_station.php
New file
0,0 → 1,75
<?php
 
include("../connect.php");
 
$nom_station = $_GET['nom_station'];
$environnement_id = $_GET['environnement_id'];
$lat_station = $_GET['lat_station'];
$lon_station = $_GET['lon_station'];
$alt_station = $_GET['alt_station'];
$participant_id = $_GET['participant_id'];
$action = $_GET['action'];
$station_id = $_GET['station_id'];
 
if ($action=='C') { // Creation
 
// Insert new row with user data
$query = sprintf("INSERT INTO STATION " .
" (STATION_ID, PARTICIPANT_ID, STATION_NOM, STATION_LATITUDE, STATION_LONGITUDE, STATION_ALTITUDE, STATION_ENVIRONNEMENT_ID ) " .
" VALUES (NULL, '%s', '%s', '%s', '%s', '%s', '%s');",
mysql_real_escape_string($participant_id),
mysql_real_escape_string($nom_station),
mysql_real_escape_string($lat_station),
mysql_real_escape_string($lon_station),
mysql_real_escape_string($alt_station),
mysql_real_escape_string($environnement_id));
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
}
if ($action=='U') { // Mise a jour
 
// Update new row with user data
$query = sprintf("UPDATE STATION SET" .
" PARTICIPANT_ID='%s'," .
" STATION_NOM='%s'," .
" STATION_LATITUDE='%s'," .
" STATION_LONGITUDE='%s', " .
" STATION_ALTITUDE='%s'," .
" STATION_ENVIRONNEMENT_ID='%s' WHERE STATION_ID='%s'; ",
mysql_real_escape_string($participant_id),
mysql_real_escape_string($nom_station),
mysql_real_escape_string($lat_station),
mysql_real_escape_string($lon_station),
mysql_real_escape_string($alt_station),
mysql_real_escape_string($environnement_id),
mysql_real_escape_string($station_id));
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
}
 
if ($action=='D') { // Suppression
 
 
$query = sprintf("DELETE FROM STATION " .
" WHERE STATION_ID='%s'; ",
mysql_real_escape_string($station_id));
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
}
 
 
?>
/obs_saisons/SPIP-v1-8-3/modules/observations/modif_encours_old.php
New file
0,0 → 1,133
<?
$evenements = $_POST['evenements'];
if (sizeof($evenements)>0) {
foreach ($evenements as $numev => $datev) {
if (is_numeric($numev) && !estDate($datev[0],$datev[1],$datev[2]) && !estDateEnAttente($datev[0],$datev[1],$datev[2]))
$erreurs[] = "Certains évènements n'ont pas de date correcte.";
}
}
 
//on traite le formu
if (isset($_POST['valid_modif']) && sizeof($erreurs)==0) {
 
foreach ($evenements as $numev => $datev) {
if (is_numeric($numev) && estDate($datev[0],$datev[1],$datev[2])) {
//doit-on mettre à jour une date ou en ajouter une une ?
$requete_verif = mysql_query("select MESURE_ID from MESURE where SEQUENCE_ID=".$_POST['sequence_id']." and EVENEMENT_ID=".$numev);
if ($verif = mysql_fetch_row($requete_verif)) {
//Cas de la maj
$requete_insert = "update MESURE set MESURE_DATE='".$datev[2]."-".$datev[1]."-".$datev[0]."' where MESURE_ID=".$verif[0];
}
else {
//cas de l'insertion
$requete_insert = "insert into MESURE (SEQUENCE_ID, EVENEMENT_ID, MESURE_DATE) values (".$_POST['sequence_id'].", $numev, '".$datev[2]."-".$datev[1]."-".$datev[0]."')";
}
 
if (!mysql_query($requete_insert))
$erreurs[] = "La prise en compte de tes observations n'a pas marché, essaye encore!";
}
}
if (sizeof($erreurs)==0)
echo "Tes dates d'observation ont bien été prises en compte.";
foreach($erreurs as $err)
echo $err."<br>";
}
 
else {
if (sizeof($erreurs)>0)
foreach($erreurs as $err)
echo $err."<br>";
 
//on récupère les évènements observables sur l'espèce choisie
$requete_ev_txt = "select distinct ESPECE_EVENEMENT.EVENEMENT_ID, EVENEMENT_NOM FROM ESPECE_EVENEMENT, ESPECE, EVENEMENT, SEQUENCE where ESPECE_EVENEMENT.EVENEMENT_ID=EVENEMENT.EVENEMENT_ID and ESPECE_EVENEMENT.ESPECE_ID=ESPECE.ESPECE_ID and SEQUENCE.ESPECE_ID=ESPECE.ESPECE_ID and SEQUENCE_ID=$numseq order by EVENEMENT_ID";
 
$requete_ev = mysql_query($requete_ev_txt);
 
while ($evenements_ligne = mysql_fetch_row($requete_ev))
$evenements[] = $evenements_ligne[0];
 
//on récupère les évènements déjà observés sur cette espèce
$requete_obs_annee = mysql_query("select MESURE_ID, EVENEMENT.EVENEMENT_ID, EVENEMENT_NOM, DATE_FORMAT(MESURE_DATE,'%d/%m/%Y'), MESURE_INDIVIDU from MESURE,EVENEMENT ".
"where EVENEMENT.EVENEMENT_ID=MESURE.EVENEMENT_ID".
" and MESURE.SEQUENCE_ID=$numseq".
" and DATE_FORMAT(MESURE_DATE,'%Y')=DATE_FORMAT(NOW(),'%Y') order by EVENEMENT.EVENEMENT_ID, MESURE_INDIVIDU");
?>
<form name="form_modif" method="post" action="#">
 
Pour chaque évènement donne la date moyenne d'observation :<br>
<?
while ($ev = mysql_fetch_row($requete_obs_annee)) {
 
//si l'évènement observé a été effectivement observé, on l'enlève de la liste des observables
if (is_numeric($i = array_search($ev[1],$evenements))) {
unset($evenements[$i]);
}
 
if (strlen($ev[3])>0) {
$jour = substr($ev[3],0,2);
$mois = substr($ev[3],3,2);
$annee = substr($ev[3],6,4);
} else {
$jour ='jj';
$mois = 'mm';
$annee = 'aaaa';
}
 
if (isset($_POST['evenements'][$ev[1]][0])) {
$jour = $_POST['evenements'][$ev[1]][0];
}
if (isset($_POST['evenements'][$ev[1]][1])) {
$mois = $_POST['evenements'][$ev[1]][1];
}
if (isset($_POST['evenements'][$ev[1]][2])) {
$annee = $_POST['evenements'][$ev[1]][2];
}
 
?>
<?= $ev[2] ?> :
<input type="text" name="evenements[<?= $ev[1] ?>][0]" size="2" value="<?= $jour ?>">
 
<input type="text" name="evenements[<?= $ev[1] ?>][1]" size="2" value="<?= $mois ?>">
 
<input type="text" name="evenements[<?= $ev[1] ?>][2]" size="4" value="<?= $annee ?>">
<br>
 
<? }
$requete_ev = mysql_query($requete_ev_txt);
 
//à la fin il ne reste que les évènements non observés
while ($ev = mysql_fetch_row($requete_ev)) {
 
if (in_array($ev[0],$evenements)) {
 
$jour ='jj';
$mois = 'mm';
$annee = 'aaaa';
 
if (isset($_POST['evenements'][$ev[0]][0])) {
$jour = $_POST['evenements'][$ev[0]][0];
}
if (isset($_POST['evenements'][$ev[0]][1])) {
$mois = $_POST['evenements'][$ev[0]][1];
}
if (isset($_POST['evenements'][$ev[0]][2])) {
$annee = $_POST['evenements'][$ev[0]][2];
}
 
?>
<?= $ev[1] ?> :
<input type="text" name="evenements[<?= $ev[0] ?>][0]" size="2" value="<?= $jour ?>">
<input type="text" name="evenements[<?= $ev[0] ?>][1]" size="2" value="<?= $mois ?>">
 
<input type="text" name="evenements[<?= $ev[0] ?>][2]" size="4" value="<?= $annee ?>">
<br>
<?
}
}
?>
<input type="hidden" name="sequence_id" value="<?= $numseq ?>">
<input type="submit" class="submit" name="valid_modif" value="Valider mes dates">
<input type="hidden" name="etape" value="1">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/modif_encours.php
New file
0,0 → 1,171
<?
$evenements = $_POST['evenements'];
 
//annee en cours
$anneeEnCours = date('Y');
 
if (sizeof($evenements)>0) {
 
$nbCases = 0;
$nbDatesNulles = 0;
foreach ($evenements as $numind => $individu) {
if (is_array($individu)) {
foreach ($individu as $numev => $datev) {
//foreach ($evenements as $numev => $datev) {
if (is_numeric($numev)) {
if (!estDate($datev[0],$datev[1],$datev[2]) && !estDateEnAttente($datev[0],$datev[1],$datev[2]))
$erreurs[0] = "Certains évènements n'ont pas de date correcte.";
else if (estDateEnAttente($datev[0],$datev[1],$datev[2]))
$nbsDatesNulles++;
$nbCases++;
}
}
}
}
/* if ($nbCases == $nbsDatesNulles)
$erreurs[] = "Il faut entrer au moins une date.";
*/}
 
//on traite le formu
if (isset($_POST['valid_modif']) && sizeof($erreurs)==0) {
 
foreach ($evenements as $numind => $individu) {
if (is_array($individu)) {
foreach ($individu as $numev => $datev) {
if (is_numeric($numev)) {
//doit-on mettre à jour une date ou en ajouter une une ?
$requete_verif = mysql_query("select MESURE_ID from MESURE where SEQUENCE_ID=".$_POST['sequence_id']." and EVENEMENT_ID=".$numind." and MESURE_INDIVIDU=$numev".
" AND MESURE_DATE!='0000-00-00' and MESURE_DATE>'".($anneeEnCours - 2)."-01-01'".
" and MESURE_DATE<'".($anneeEnCours+1)."-01-01'");
if ($verif = mysql_fetch_row($requete_verif)) {
//une obs à cette date pour cet individu existait déjà
if (estDate($datev[0],$datev[1],$datev[2])) {
//Cas de la maj
$requete_insert = "update MESURE set MESURE_DATE='".$datev[2]."-".$datev[1]."-".$datev[0]."' where MESURE_ID=".$verif[0];
} else if (estDateEnAttente($datev[0],$datev[1],$datev[2])) {
//Cas de la suppr
$requete_insert = "delete from MESURE where MESURE_ID=".$verif[0];
}
}
else if (estDate($datev[0],$datev[1],$datev[2])) {
//cas de l'insertion
$requete_insert = "insert into MESURE (SEQUENCE_ID, EVENEMENT_ID, MESURE_DATE, MESURE_INDIVIDU) values (".$_POST['sequence_id'].", $numind, '".$datev[2]."-".$datev[1]."-".$datev[0]."', $numev)";
}
 
if ($requete_insert && !mysql_query($requete_insert))
$erreurs[] = "La prise en compte de vos observations échoué, merci de réessayer.";
else if ($nbCases==$nbsDatesNulles) {
$requete_suppr = "delete from SEQUENCE where SEQUENCE_ID=".$_POST['sequence_id'];
if (!mysql_query($requete_suppr))
$erreurs[] = "Vos observations ont bien été supprimées mais il reste un problème.";
}
unset($requete_insert);
}
}
}
}
if (sizeof($erreurs)==0) {
$_SESSION['obsOK'] = 'ok';
 
// FIXME : ne fonctionne pas car des headers ont deja été envoyés, mais ou ?
//header("Location: article.php3?id_article=2");
redirect("article.php3?id_article=2");
}
afficherErreurs($erreurs);
 
}
 
else {
afficherErreurs($erreurs);
 
//on récupère les évènements observables sur l'espèce choisie
$requete_ev_txt = "select distinct ESPECE_EVENEMENT.EVENEMENT_ID, EVENEMENT_NOM FROM ESPECE_EVENEMENT, ESPECE, EVENEMENT, SEQUENCE where ESPECE_EVENEMENT.EVENEMENT_ID=EVENEMENT.EVENEMENT_ID and ESPECE_EVENEMENT.ESPECE_ID=ESPECE.ESPECE_ID and SEQUENCE.ESPECE_ID=ESPECE.ESPECE_ID and SEQUENCE_ID=$numseq and EVENEMENT_ACTIVE=1 order by EVENEMENT_ID";
 
$requete_ev = mysql_query($requete_ev_txt);
 
//on récupère les évènements déjà observés sur cette espèce
$requete_obs_annee = mysql_query("select MESURE_ID, EVENEMENT.EVENEMENT_ID, EVENEMENT_NOM, DATE_FORMAT(MESURE_DATE,'%d/%m/%Y'), MESURE_INDIVIDU from MESURE,EVENEMENT ".
"where EVENEMENT.EVENEMENT_ID=MESURE.EVENEMENT_ID".
" and MESURE.SEQUENCE_ID=$numseq".
" AND MESURE_DATE!='0000-00-00' and MESURE_DATE>'".($anneeEnCours - 2)."-01-01'".
" and MESURE_DATE<'".($anneeEnCours+1)."-01-01'".
" order by EVENEMENT.EVENEMENT_ID, MESURE_INDIVIDU");
 
 
while ($obs_annee = mysql_fetch_row($requete_obs_annee)) {
$observations[$obs_annee[1]][$obs_annee[4]] = $obs_annee;
}
 
?>
<form name="form_modif" method="post" action="<?= $url_page ?>">
 
<table class="spip">
<tr class="row_even" style="font-weight: bold; font-size: 11px;">
<td>Evènement</td>
<td>1er individu</td>
<td>2ème individu</td>
<td>3ème individu</td>
<td>4ème individu</td>
<td>5ème individu</td>
</tr>
Pour chaque évènement entrez la date moyenne d'observation :<br><br>
<?
$numligne=0;
$lignes = array("odd","even");
while ($ev = mysql_fetch_row($requete_ev)) {
?>
<tr class="row_<?= $lignes[$numligne] ?>"><td><?= $ev[1] ?></td>
<?
 
for ($i=0; $i<5; $i++) {
//valeurs par défaut, çàd si l'évènement n'a pas été observé
$jour ='jj';
$mois = 'mm';
$annee = $anneeEnCours;
$obs_courante = "";
 
if (is_array($observations[$ev[0]][$i+1]))
//cet individu a été observé
$obs_courante = $observations[$ev[0]][$i+1];
 
 
if (strlen($obs_courante[3])>0) {
$jour = substr($obs_courante[3],0,2);
$mois = substr($obs_courante[3],3,2);
$annee = substr($obs_courante[3],6,4);
}
 
if (isset($_POST['evenements'][$ev[0]][$i+1][0])) {
$jour = $_POST['evenements'][$ev[0]][$i+1][0];
}
if (isset($_POST['evenements'][$ev[0]][$i+1][1])) {
$mois = $_POST['evenements'][$ev[0]][$i+1][1];
}
if (isset($_POST['evenements'][$ev[0]][$i+1][2])) {
$annee = $_POST['evenements'][$ev[0]][$i+1][2];
}
 
?>
<td>
<input type="text" name="evenements[<?= $ev[0] ?>][<?= $i+1 ?>][0]" size="2" value="<?= $jour ?>">
<input type="text" name="evenements[<?= $ev[0] ?>][<?= $i+1 ?>][1]" size="2" value="<?= $mois ?>">
<input type="text" name="evenements[<?= $ev[0] ?>][<?= $i+1 ?>][2]" size="4" value="<?= $annee ?>">
</td>
 
<?
}
$numligne++;
if ($numligne==2)
$numligne = 0;
echo "</tr>";
}
?>
</table>
<input type="hidden" name="sequence_id" value="<?= $numseq ?>">
<input type="submit" class="submit" name="valid_modif" value="Valider">
<input type="hidden" name="etape" value="1">
</form>
<form name="retour" method="post" action"<?= $url_page ?>">
<input type="submit" class="submit" name="annul_modif" value="Annuler">
</form>
<? } ?>
/obs_saisons/SPIP-v1-8-3/modules/observations/backup.dmp
New file
0,0 → 1,249
INSERT INTO MESURE VALUES (1,1,5,NULL,NULL,'2006-11-05',NULL,1);
INSERT INTO MESURE VALUES (2,1,5,NULL,NULL,'2006-11-04',NULL,2);
INSERT INTO MESURE VALUES (3,1,5,NULL,NULL,'2006-11-05',NULL,3);
INSERT INTO MESURE VALUES (4,2,5,NULL,NULL,'2006-10-06',NULL,1);
INSERT INTO MESURE VALUES (5,2,5,NULL,NULL,'2006-10-05',NULL,2);
INSERT INTO MESURE VALUES (6,2,5,NULL,NULL,'2006-10-07',NULL,3);
INSERT INTO MESURE VALUES (7,3,5,NULL,NULL,'2006-09-25',NULL,1);
INSERT INTO MESURE VALUES (8,3,5,NULL,NULL,'2006-09-28',NULL,2);
INSERT INTO MESURE VALUES (9,3,5,NULL,NULL,'2006-10-04',NULL,3);
INSERT INTO MESURE VALUES (10,3,5,NULL,NULL,'2006-10-05',NULL,1);
INSERT INTO MESURE VALUES (11,3,5,NULL,NULL,'2006-10-04',NULL,2);
INSERT INTO MESURE VALUES (12,3,5,NULL,NULL,'2006-10-03',NULL,3);
INSERT INTO MESURE VALUES (13,3,5,NULL,NULL,'2006-10-02',NULL,1);
INSERT INTO MESURE VALUES (14,3,5,NULL,NULL,'2006-10-05',NULL,2);
INSERT INTO MESURE VALUES (15,3,5,NULL,NULL,'2006-10-04',NULL,3);
INSERT INTO MESURE VALUES (16,2,5,NULL,NULL,'2006-10-05',NULL,1);
INSERT INTO MESURE VALUES (17,2,5,NULL,NULL,'2006-10-06',NULL,2);
INSERT INTO MESURE VALUES (18,2,5,NULL,NULL,'2006-10-04',NULL,3);
INSERT INTO MESURE VALUES (19,2,5,NULL,NULL,'2006-10-04',NULL,1);
INSERT INTO MESURE VALUES (20,2,5,NULL,NULL,'2006-10-05',NULL,2);
INSERT INTO MESURE VALUES (21,1,5,NULL,NULL,'2006-11-03',NULL,4);
INSERT INTO MESURE VALUES (36,11,5,NULL,NULL,'2006-10-15',NULL,1);
INSERT INTO MESURE VALUES (23,2,5,NULL,NULL,'2006-10-03',NULL,1);
INSERT INTO MESURE VALUES (24,2,5,NULL,NULL,'2006-10-04',NULL,2);
INSERT INTO MESURE VALUES (25,2,5,NULL,NULL,'2006-10-05',NULL,3);
INSERT INTO MESURE VALUES (26,2,5,NULL,NULL,'2006-10-01',NULL,4);
INSERT INTO MESURE VALUES (27,3,5,NULL,NULL,'2006-09-03',NULL,1);
INSERT INTO MESURE VALUES (28,3,5,NULL,NULL,'2006-09-06',NULL,2);
INSERT INTO MESURE VALUES (29,3,5,NULL,NULL,'2006-09-05',NULL,3);
INSERT INTO MESURE VALUES (30,3,5,NULL,NULL,'2006-10-09',NULL,4);
INSERT INTO MESURE VALUES (35,10,1,NULL,NULL,'2006-11-16',NULL,2);
INSERT INTO MESURE VALUES (37,12,4,NULL,NULL,'2007-01-29',NULL,1);
INSERT INTO MESURE VALUES (38,12,4,NULL,NULL,'2007-01-29',NULL,2);
INSERT INTO MESURE VALUES (39,13,5,NULL,NULL,'2006-10-08',NULL,1);
INSERT INTO MESURE VALUES (40,13,5,NULL,NULL,'2006-10-18',NULL,2);
INSERT INTO MESURE VALUES (41,14,5,NULL,NULL,'2006-11-07',NULL,1);
INSERT INTO MESURE VALUES (42,14,5,NULL,NULL,'2006-10-28',NULL,2);
INSERT INTO MESURE VALUES (43,14,5,NULL,NULL,'2006-11-02',NULL,3);
INSERT INTO MESURE VALUES (44,15,8,NULL,NULL,'2007-02-12',NULL,1);
INSERT INTO MESURE VALUES (45,16,8,NULL,NULL,'2007-01-26',NULL,1);
INSERT INTO MESURE VALUES (46,17,8,NULL,NULL,'2007-02-17',NULL,1);
INSERT INTO MESURE VALUES (47,18,8,NULL,NULL,'2007-02-17',NULL,1);
INSERT INTO MESURE VALUES (48,19,8,NULL,NULL,'2007-02-16',NULL,1);
INSERT INTO MESURE VALUES (49,20,4,NULL,NULL,'2007-02-20',NULL,1);
INSERT INTO MESURE VALUES (50,20,4,NULL,NULL,'2007-02-20',NULL,2);
INSERT INTO MESURE VALUES (51,21,8,NULL,NULL,'2007-02-18',NULL,1);
INSERT INTO MESURE VALUES (52,22,8,NULL,NULL,'2007-02-20',NULL,1);
INSERT INTO MESURE VALUES (53,23,3,NULL,NULL,'2007-02-20',NULL,1);
INSERT INTO MESURE VALUES (54,23,3,NULL,NULL,'2007-02-21',NULL,2);
INSERT INTO MESURE VALUES (55,23,3,NULL,NULL,'2007-02-23',NULL,3);
INSERT INTO MESURE VALUES (56,23,3,NULL,NULL,'2007-02-23',NULL,4);
INSERT INTO MESURE VALUES (57,23,3,NULL,NULL,'2007-02-23',NULL,5);
INSERT INTO MESURE VALUES (58,24,8,NULL,NULL,'2007-02-28',NULL,1);
INSERT INTO MESURE VALUES (59,25,8,NULL,NULL,'2007-02-28',NULL,1);
INSERT INTO MESURE VALUES (60,26,8,NULL,NULL,'2007-02-27',NULL,1);
INSERT INTO MESURE VALUES (61,27,8,NULL,NULL,'2007-03-01',NULL,1);
INSERT INTO MESURE VALUES (62,28,8,NULL,NULL,'2007-02-27',NULL,1);
INSERT INTO MESURE VALUES (63,29,8,NULL,NULL,'2007-02-27',NULL,1);
INSERT INTO MESURE VALUES (64,30,8,NULL,NULL,'2007-02-23',NULL,1);
INSERT INTO MESURE VALUES (65,30,8,NULL,NULL,'2007-03-01',NULL,2);
INSERT INTO MESURE VALUES (66,31,8,NULL,NULL,'2007-03-01',NULL,1);
INSERT INTO MESURE VALUES (67,32,8,NULL,NULL,'2007-03-01',NULL,1);
INSERT INTO MESURE VALUES (68,33,8,NULL,NULL,'2007-02-26',NULL,1);
INSERT INTO MESURE VALUES (69,34,8,NULL,NULL,'2007-03-03',NULL,1);
INSERT INTO MESURE VALUES (70,35,8,NULL,NULL,'2007-03-03',NULL,1);
INSERT INTO MESURE VALUES (71,36,8,NULL,NULL,'2007-03-02',NULL,1);
INSERT INTO MESURE VALUES (72,37,8,NULL,NULL,'2007-03-03',NULL,1);
INSERT INTO MESURE VALUES (73,38,8,NULL,NULL,'2007-03-03',NULL,1);
INSERT INTO MESURE VALUES (74,39,1,NULL,NULL,'2007-03-05',NULL,1);
INSERT INTO MESURE VALUES (75,40,3,NULL,NULL,'2007-03-05',NULL,1);
INSERT INTO MESURE VALUES (76,41,3,NULL,NULL,'2007-03-05',NULL,1);
INSERT INTO MESURE VALUES (77,41,3,NULL,NULL,'2007-03-05',NULL,2);
INSERT INTO MESURE VALUES (78,42,8,NULL,NULL,'2007-03-04',NULL,1);
INSERT INTO MESURE VALUES (79,43,8,NULL,NULL,'2007-03-06',NULL,1);
INSERT INTO MESURE VALUES (80,44,3,NULL,NULL,'2007-03-01',NULL,1);
INSERT INTO MESURE VALUES (81,44,3,NULL,NULL,'2007-03-03',NULL,2);
INSERT INTO MESURE VALUES (82,44,4,NULL,NULL,'2007-03-04',NULL,1);
INSERT INTO MESURE VALUES (83,44,4,NULL,NULL,'2007-03-07',NULL,2);
INSERT INTO MESURE VALUES (84,45,8,NULL,NULL,'2007-03-04',NULL,1);
INSERT INTO MESURE VALUES (85,45,8,NULL,NULL,'2007-03-04',NULL,2);
INSERT INTO MESURE VALUES (86,46,8,NULL,NULL,'2007-03-08',NULL,1);
INSERT INTO MESURE VALUES (87,47,8,NULL,NULL,'2007-03-09',NULL,1);
INSERT INTO MESURE VALUES (88,48,8,NULL,NULL,'2007-03-06',NULL,1);
INSERT INTO MESURE VALUES (89,49,8,NULL,NULL,'2007-02-25',NULL,1);
INSERT INTO MESURE VALUES (90,50,8,NULL,NULL,'2007-03-01',NULL,1);
INSERT INTO MESURE VALUES (91,51,8,NULL,NULL,'2007-03-07',NULL,1);
INSERT INTO MESURE VALUES (92,52,8,NULL,NULL,'2007-03-07',NULL,1);
INSERT INTO MESURE VALUES (93,53,8,NULL,NULL,'2007-03-08',NULL,1);
INSERT INTO MESURE VALUES (94,54,4,NULL,NULL,'2007-03-01',NULL,1);
INSERT INTO MESURE VALUES (95,55,8,NULL,NULL,'2007-03-11',NULL,1);
INSERT INTO MESURE VALUES (96,56,1,NULL,NULL,'2007-03-12',NULL,1);
INSERT INTO MESURE VALUES (97,56,1,NULL,NULL,'2007-03-12',NULL,2);
INSERT INTO MESURE VALUES (98,57,8,NULL,NULL,'2007-03-11',NULL,1);
INSERT INTO MESURE VALUES (99,58,8,NULL,NULL,'2007-03-11',NULL,1);
INSERT INTO MESURE VALUES (100,59,8,NULL,NULL,'2007-03-11',NULL,1);
INSERT INTO MESURE VALUES (101,60,8,NULL,NULL,'2007-03-12',NULL,1);
INSERT INTO MESURE VALUES (102,61,8,NULL,NULL,'2007-03-12',NULL,1);
INSERT INTO MESURE VALUES (103,62,8,NULL,NULL,'2007-03-14',NULL,1);
INSERT INTO MESURE VALUES (104,63,8,NULL,NULL,'2007-03-13',NULL,1);
INSERT INTO MESURE VALUES (105,63,8,NULL,NULL,'2007-03-14',NULL,2);
INSERT INTO MESURE VALUES (106,64,4,NULL,NULL,'2007-03-14',NULL,1);
INSERT INTO MESURE VALUES (107,64,4,NULL,NULL,'2007-03-14',NULL,2);
INSERT INTO MESURE VALUES (108,65,1,NULL,NULL,'2007-03-15',NULL,1);
INSERT INTO MESURE VALUES (109,65,4,NULL,NULL,'2007-03-15',NULL,1);
INSERT INTO MESURE VALUES (110,66,1,NULL,NULL,'2007-03-18',NULL,1);
INSERT INTO MESURE VALUES (111,67,3,NULL,NULL,'2007-03-11',NULL,1);
INSERT INTO MESURE VALUES (112,65,3,NULL,NULL,'2007-03-19',NULL,2);
INSERT INTO MESURE VALUES (113,68,3,NULL,NULL,'2007-02-08',NULL,1);
INSERT INTO MESURE VALUES (114,69,3,NULL,NULL,'2007-02-12',NULL,1);
INSERT INTO MESURE VALUES (167,64,2,NULL,NULL,'2007-04-17',NULL,2);
INSERT INTO MESURE VALUES (166,64,2,NULL,NULL,'2007-04-13',NULL,1);
INSERT INTO MESURE VALUES (117,39,1,NULL,NULL,'2007-03-23',NULL,2);
INSERT INTO MESURE VALUES (118,71,3,NULL,NULL,'2007-03-27',NULL,1);
INSERT INTO MESURE VALUES (121,65,4,NULL,NULL,'2007-03-28',NULL,2);
INSERT INTO MESURE VALUES (120,39,2,NULL,NULL,'2007-03-23',NULL,1);
INSERT INTO MESURE VALUES (122,65,1,NULL,NULL,'2007-04-12',NULL,2);
INSERT INTO MESURE VALUES (123,65,2,NULL,NULL,'2007-03-28',NULL,1);
INSERT INTO MESURE VALUES (124,72,3,NULL,NULL,'2007-03-24',NULL,1);
INSERT INTO MESURE VALUES (125,72,3,NULL,NULL,'2007-03-25',NULL,2);
INSERT INTO MESURE VALUES (126,72,3,NULL,NULL,'2007-03-25',NULL,3);
INSERT INTO MESURE VALUES (127,72,4,NULL,NULL,'2007-03-30',NULL,1);
INSERT INTO MESURE VALUES (128,72,4,NULL,NULL,'2007-04-02',NULL,2);
INSERT INTO MESURE VALUES (129,72,4,NULL,NULL,'2007-04-02',NULL,3);
INSERT INTO MESURE VALUES (130,73,8,NULL,NULL,'2007-04-02',NULL,1);
INSERT INTO MESURE VALUES (131,74,8,NULL,NULL,'2007-04-01',NULL,1);
INSERT INTO MESURE VALUES (132,75,8,NULL,NULL,'2007-03-31',NULL,1);
INSERT INTO MESURE VALUES (133,76,8,NULL,NULL,'2007-03-31',NULL,1);
INSERT INTO MESURE VALUES (134,77,8,NULL,NULL,'2007-03-29',NULL,1);
INSERT INTO MESURE VALUES (135,78,8,NULL,NULL,'2007-03-27',NULL,1);
INSERT INTO MESURE VALUES (136,79,8,NULL,NULL,'2007-03-27',NULL,1);
INSERT INTO MESURE VALUES (137,80,8,NULL,NULL,'2007-03-28',NULL,1);
INSERT INTO MESURE VALUES (138,81,3,NULL,NULL,'2007-04-04',NULL,1);
INSERT INTO MESURE VALUES (139,71,4,NULL,NULL,'2007-04-03',NULL,1);
INSERT INTO MESURE VALUES (140,71,4,NULL,NULL,'2007-04-03',NULL,2);
INSERT INTO MESURE VALUES (141,64,1,NULL,NULL,'2007-04-04',NULL,1);
INSERT INTO MESURE VALUES (142,39,2,NULL,NULL,'2007-04-01',NULL,2);
INSERT INTO MESURE VALUES (143,82,8,NULL,NULL,'2007-04-06',NULL,1);
INSERT INTO MESURE VALUES (144,71,1,NULL,NULL,'2007-04-07',NULL,1);
INSERT INTO MESURE VALUES (145,64,1,NULL,NULL,'2007-04-08',NULL,2);
INSERT INTO MESURE VALUES (146,83,8,NULL,NULL,'2007-04-11',NULL,1);
INSERT INTO MESURE VALUES (147,84,8,NULL,NULL,'2007-04-11',NULL,1);
INSERT INTO MESURE VALUES (148,85,8,NULL,NULL,'2007-04-11',NULL,1);
INSERT INTO MESURE VALUES (149,81,3,NULL,NULL,'2007-04-10',NULL,2);
INSERT INTO MESURE VALUES (150,81,4,NULL,NULL,'2007-04-12',NULL,1);
INSERT INTO MESURE VALUES (151,72,2,NULL,NULL,'2007-04-10',NULL,1);
INSERT INTO MESURE VALUES (152,72,2,NULL,NULL,'2007-04-12',NULL,2);
INSERT INTO MESURE VALUES (153,72,2,NULL,NULL,'2007-04-18',NULL,3);
INSERT INTO MESURE VALUES (154,86,8,NULL,NULL,'2007-04-17',NULL,1);
INSERT INTO MESURE VALUES (155,87,8,NULL,NULL,'2007-04-14',NULL,1);
INSERT INTO MESURE VALUES (156,70,1,NULL,NULL,'2007-03-23',NULL,1);
INSERT INTO MESURE VALUES (157,70,1,NULL,NULL,'2007-03-23',NULL,2);
INSERT INTO MESURE VALUES (165,71,3,NULL,NULL,'2007-03-27',NULL,2);
INSERT INTO MESURE VALUES (164,71,2,NULL,NULL,'2007-04-15',NULL,2);
INSERT INTO MESURE VALUES (163,71,2,NULL,NULL,'2007-04-12',NULL,1);
INSERT INTO MESURE VALUES (162,71,1,NULL,NULL,'2007-04-10',NULL,2);
INSERT INTO MESURE VALUES (168,39,3,NULL,NULL,'2007-04-10',NULL,1);
INSERT INTO MESURE VALUES (169,39,3,NULL,NULL,'2007-04-13',NULL,2);
INSERT INTO MESURE VALUES (170,39,4,NULL,NULL,'2007-04-14',NULL,1);
INSERT INTO MESURE VALUES (171,39,4,NULL,NULL,'2007-04-18',NULL,2);
INSERT INTO MESURE VALUES (172,65,2,NULL,NULL,'2007-04-18',NULL,2);
INSERT INTO MESURE VALUES (173,88,8,NULL,NULL,'2007-04-06',NULL,1);
INSERT INTO MESURE VALUES (174,89,8,NULL,NULL,'2006-04-06',NULL,1);
INSERT INTO MESURE VALUES (175,89,8,NULL,NULL,'2007-04-19',NULL,1);
INSERT INTO MESURE VALUES (176,89,8,NULL,NULL,'2007-04-20',NULL,2);
INSERT INTO MESURE VALUES (177,89,8,NULL,NULL,'2007-04-21',NULL,3);
INSERT INTO MESURE VALUES (178,89,8,NULL,NULL,'2006-04-21',NULL,4);
INSERT INTO MESURE VALUES (179,89,8,NULL,NULL,'2006-04-21',NULL,5);
INSERT INTO MESURE VALUES (180,91,8,NULL,NULL,'2007-04-22',NULL,1);
INSERT INTO MESURE VALUES (181,91,8,NULL,NULL,'2007-04-22',NULL,2);
INSERT INTO MESURE VALUES (182,91,8,NULL,NULL,'2007-04-22',NULL,3);
INSERT INTO MESURE VALUES (183,91,8,NULL,NULL,'2007-04-22',NULL,4);
INSERT INTO MESURE VALUES (184,91,8,NULL,NULL,'2007-04-22',NULL,5);
INSERT INTO MESURE VALUES (185,92,8,NULL,NULL,'2007-04-28',NULL,1);
INSERT INTO MESURE VALUES (186,92,8,NULL,NULL,'2007-04-28',NULL,2);
INSERT INTO MESURE VALUES (187,92,8,NULL,NULL,'2007-04-28',NULL,3);
INSERT INTO MESURE VALUES (188,92,8,NULL,NULL,'2007-04-28',NULL,4);
INSERT INTO MESURE VALUES (189,92,8,NULL,NULL,'2007-04-28',NULL,5);
INSERT INTO MESURE VALUES (190,93,1,NULL,NULL,'2007-03-27',NULL,1);
INSERT INTO MESURE VALUES (191,93,2,NULL,NULL,'2007-04-24',NULL,1);
INSERT INTO MESURE VALUES (192,93,3,NULL,NULL,'2007-05-10',NULL,1);
INSERT INTO MESURE VALUES (193,94,1,NULL,NULL,'2007-03-27',NULL,1);
INSERT INTO MESURE VALUES (194,94,2,NULL,NULL,'2007-04-24',NULL,1);
INSERT INTO MESURE VALUES (195,94,3,NULL,NULL,'2007-05-10',NULL,1);
INSERT INTO MESURE VALUES (196,95,8,NULL,NULL,'2007-04-20',NULL,1);
INSERT INTO MESURE VALUES (197,95,8,NULL,NULL,'2007-04-21',NULL,2);
INSERT INTO MESURE VALUES (198,96,8,NULL,NULL,'2007-04-28',NULL,1);
INSERT INTO MESURE VALUES (199,97,8,NULL,NULL,'2007-04-06',NULL,1);
INSERT INTO MESURE VALUES (200,98,8,NULL,NULL,'2007-04-07',NULL,1);
INSERT INTO MESURE VALUES (201,99,8,NULL,NULL,'2007-04-14',NULL,1);
INSERT INTO MESURE VALUES (202,100,8,NULL,NULL,'2007-04-15',NULL,1);
INSERT INTO MESURE VALUES (203,101,8,NULL,NULL,'2007-04-09',NULL,1);
INSERT INTO MESURE VALUES (204,102,8,NULL,NULL,'2007-03-04',NULL,1);
INSERT INTO MESURE VALUES (205,103,8,NULL,NULL,'2007-04-07',NULL,1);
INSERT INTO MESURE VALUES (206,104,8,NULL,NULL,'2007-04-19',NULL,1);
INSERT INTO MESURE VALUES (207,105,8,NULL,NULL,'2007-04-19',NULL,1);
INSERT INTO MESURE VALUES (208,106,8,NULL,NULL,'2007-04-20',NULL,1);
INSERT INTO MESURE VALUES (209,107,8,NULL,NULL,'2006-03-15',NULL,1);
INSERT INTO MESURE VALUES (210,108,8,NULL,NULL,'2006-03-26',NULL,1);
INSERT INTO MESURE VALUES (211,109,8,NULL,NULL,'2007-02-19',NULL,1);
INSERT INTO MESURE VALUES (212,110,8,NULL,NULL,'2007-03-11',NULL,1);
INSERT INTO MESURE VALUES (213,110,8,NULL,NULL,'2007-04-01',NULL,2);
INSERT INTO MESURE VALUES (214,110,8,NULL,NULL,'2007-04-22',NULL,3);
INSERT INTO MESURE VALUES (215,110,8,NULL,NULL,'2007-04-30',NULL,4);
INSERT INTO MESURE VALUES (216,110,8,NULL,NULL,'2007-05-13',NULL,5);
INSERT INTO MESURE VALUES (217,111,8,NULL,NULL,'2007-07-14',NULL,1);
INSERT INTO MESURE VALUES (218,112,8,NULL,NULL,'2007-04-15',NULL,1);
INSERT INTO MESURE VALUES (219,113,8,NULL,NULL,'2007-07-14',NULL,1);
INSERT INTO MESURE VALUES (220,114,8,NULL,NULL,'2007-03-10',NULL,1);
INSERT INTO MESURE VALUES (221,114,8,NULL,NULL,'2007-03-10',NULL,2);
INSERT INTO MESURE VALUES (222,114,8,NULL,NULL,'2007-03-15',NULL,3);
INSERT INTO MESURE VALUES (223,114,8,NULL,NULL,'2007-03-15',NULL,4);
INSERT INTO MESURE VALUES (224,115,8,NULL,NULL,'2007-04-14',NULL,1);
INSERT INTO MESURE VALUES (225,115,8,NULL,NULL,'2007-04-20',NULL,2);
INSERT INTO MESURE VALUES (226,115,8,NULL,NULL,'2007-04-25',NULL,3);
INSERT INTO MESURE VALUES (227,115,8,NULL,NULL,'2007-04-25',NULL,4);
INSERT INTO MESURE VALUES (228,116,8,NULL,NULL,'2007-04-25',NULL,1);
INSERT INTO MESURE VALUES (229,116,8,NULL,NULL,'2007-05-05',NULL,2);
INSERT INTO MESURE VALUES (230,116,8,NULL,NULL,'2007-05-15',NULL,3);
INSERT INTO MESURE VALUES (231,117,8,NULL,NULL,'2007-03-15',NULL,1);
INSERT INTO MESURE VALUES (232,117,8,NULL,NULL,'2007-03-20',NULL,2);
INSERT INTO MESURE VALUES (233,117,8,NULL,NULL,'2007-03-22',NULL,3);
INSERT INTO MESURE VALUES (234,117,8,NULL,NULL,'2007-03-23',NULL,4);
INSERT INTO MESURE VALUES (235,117,8,NULL,NULL,'2007-03-25',NULL,5);
INSERT INTO MESURE VALUES (236,118,8,NULL,NULL,'2007-03-19',NULL,1);
INSERT INTO MESURE VALUES (237,118,8,NULL,NULL,'2007-03-22',NULL,2);
INSERT INTO MESURE VALUES (238,119,8,NULL,NULL,'2007-04-04',NULL,1);
INSERT INTO MESURE VALUES (239,70,5,NULL,NULL,'2007-08-19',NULL,1);
INSERT INTO MESURE VALUES (240,71,6,NULL,NULL,'2007-09-18',NULL,1);
INSERT INTO MESURE VALUES (241,71,6,NULL,NULL,'2007-09-18',NULL,2);
INSERT INTO MESURE VALUES (242,72,6,NULL,NULL,'2007-09-10',NULL,1);
INSERT INTO MESURE VALUES (243,72,6,NULL,NULL,'2007-09-13',NULL,2);
INSERT INTO MESURE VALUES (244,72,6,NULL,NULL,'2007-09-17',NULL,3);
INSERT INTO MESURE VALUES (245,72,7,NULL,NULL,'2007-09-17',NULL,1);
INSERT INTO MESURE VALUES (246,72,7,NULL,NULL,'2007-09-18',NULL,2);
INSERT INTO MESURE VALUES (247,72,7,NULL,NULL,'2007-09-21',NULL,3);
INSERT INTO MESURE VALUES (248,120,6,NULL,NULL,'2007-10-02',NULL,1);
INSERT INTO MESURE VALUES (249,120,6,NULL,NULL,'2007-10-02',NULL,2);
INSERT INTO MESURE VALUES (250,121,3,NULL,NULL,'2007-10-18',NULL,1);
INSERT INTO MESURE VALUES (251,122,3,NULL,NULL,'2007-10-18',NULL,1);
INSERT INTO MESURE VALUES (252,123,6,NULL,NULL,'2007-10-17',NULL,1);
INSERT INTO MESURE VALUES (253,123,6,NULL,NULL,'2007-10-19',NULL,2);
INSERT INTO MESURE VALUES (254,123,6,NULL,NULL,'2007-10-15',NULL,3);
INSERT INTO MESURE VALUES (255,124,7,NULL,NULL,'2007-11-03',NULL,1);
INSERT INTO MESURE VALUES (256,124,7,NULL,NULL,'2007-11-03',NULL,2);
INSERT INTO MESURE VALUES (257,125,7,NULL,NULL,'2007-11-08',NULL,1);
INSERT INTO MESURE VALUES (258,123,7,NULL,NULL,'2007-10-30',NULL,1);
INSERT INTO MESURE VALUES (259,123,7,NULL,NULL,'2007-11-01',NULL,2);
INSERT INTO MESURE VALUES (260,123,7,NULL,NULL,'2007-10-29',NULL,3);
 
/obs_saisons/SPIP-v1-8-3/modules/observations/modif_station.php
New file
0,0 → 1,793
<?
 
 
if (!sizeof($erreurs)>0) {
 
 
//Récupération des info de la station
//FONCTIONNEMENT_TESTE_ET_OK
$requete_station = mysql_query("select STATION_ID, STATION_NOM, STATION_LATITUDE, STATION_LONGITUDE, STATION_ALTITUDE, STATION_ENVIRONNEMENT_ID from STATION where STATION.STATION_ID=".$_SESSION['observation']['station_id']);
while ($station = mysql_fetch_assoc($requete_station)) {
$stations [] = $station;
}
$init_lat=$stations[0]['STATION_LATITUDE'];
$init_lon=$stations[0]['STATION_LONGITUDE'];
/***** Selection des stations *****/
 
//Affichage des éventuelles erreurs
afficherErreurs($erreurs);
 
echo "Modification de la station <b>".$stations[0]['STATION_NOM']."</b><br>";
 
?>
 
 
 
 
<div id="map" style="width:600px;height:400px;border:2px solid grey;margin:10px 0;clear:both;"></div>
 
 
 
 
 
 
<form id="form_coordonnee" action="<?= $url_page ?>" method="post" style="float:left;">
<input id="ll_latitude" name="ll_latitude" type="hidden" value="" />
<input id="ll_latitude_dms" name="ll_latitude_dms" type="hidden" value="" />
<input id="ll_longitude" name="ll_longitude" type="hidden" value="" />
<input id="ll_longitude_dms" name="ll_longitude_dms" type="hidden" value="" />
<input id="ll_altitude" name="ll_altitude" type="hidden" value="" />
<input id="form_coordonnee_valider" name="annul_modif" class="submit" type="submit" value="Retour" />
<input type="hidden" name="etape" value="1">
<input type="hidden" name="provenance" value="<?= $provenance ?>">
</li>
</ul>
</form>
 
 
<?php
 
include_once 'modules/configuration/car_config.inc.php' ;
 
if (PARTICIPANT_EST_ADULTE) {
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAnm2MSMmwsDuoh7THcVDnlBQH9AL26AfEfaraxwo1G6_adyVjPRRQE4Gx2u7MomK9DJWf9kMLJ9y-ZA" type="text/javascript"></script>
<?php
}
else {
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAFMANWib9GSm7T4W6AN9qzxRmHYqXwt_BUwczny2vFmnHz3sr3BTy_SMRJ-NzWXDUynHHSWQ7_aEZ6Q" type="text/javascript"></script>
<?php
}
 
// Centrage initial : premiere station ou ville d'inscription
 
echo "<script type=\"text/javascript\">";
echo "\n//<![CDATA[\n";
echo "var init_lat = ".$init_lat.";\n";
echo "var init_long = ".$init_lon.";\n";
?>
 
 
var largeur_carte = 690;
var haureur_retrait = 330;
var init_zoom = 10;
// Contient la carte GoogleMap
var map;
// Contient l'utilitaire permettant de trouver une adresse.
var EfGeocoder;
// Point de l'adresse saisie et à passer au GeoCoder
var addrpnt;
// L'icône à afficher sur la carte
var icon;
 
function load() {
// Vérification de la compatibilité du navigateur
if (GBrowserIsCompatible()) {
// Création de la carte
map = new GMap2(document.getElementById("map"));
// Positionnement de la carte
map.setCenter(new GLatLng(init_lat, init_long), init_zoom);
// Types de carte disponibles :
map.addMapType(G_NORMAL_MAP);
map.addMapType(G_SATELLITE_MAP);
map.addMapType(G_PHYSICAL_MAP);
// Bouton pour changer de type de carte (mixte, satellite, plan)
map.addControl(new GMapTypeControl(1));
// Définition du type de la carte par défaut
map.setMapType(G_HYBRID_MAP);
// Bouton large de déplancement et zoom apparaissant dans le coin haut gauche
map.addControl(new GLargeMapControl());
// Pour hierarchiser les types de carte --> pas encore dans la version stable...
//var mapControl = new GHierarchicalMapTypeControl();
// Définition des relations des types de menus
//mapControl.clearRelationships();
//mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, 'Labels', false);
// Ajout du controle après avoir spécifié les relations
//map.addControl(mapControl);
// Vue d'ensemble apparaissant dans le coin bas droit
var EfOverViewMap = new GOverviewMapControl();
map.addControl(EfOverViewMap);
var mini = EfOverViewMap.getOverviewMap();
// ?
map.enableContinuousZoom();
// Zoom avec la molette de la souris
map.enableScrollWheelZoom();
// Zoom avec le double clic de la souris
map.enableDoubleClickZoom();
// Création du GéoCoder
EfGeocoder = new GClientGeocoder() ;
// Icone station enregistrees (vert)
icon = new GIcon();
icon.image = "http://www.google.com/mapfiles/ms/micons/green-dot.png";
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
icon.iconSize = new GSize(34, 34);
icon.shadowSize = new GSize(37, 34);
icon.iconAnchor = new GPoint(16, 34);
// Pour affichage infobulle
icon.infoWindowAnchor = new GPoint(5,1);
 
// Icone nouvelle station (rouge) ou station en modification
Nicon = new GIcon();
Nicon.image = "http://www.google.com/mapfiles/ms/micons/red-dot.png";
Nicon.shadow = "http://www.google.com/mapfiles/shadow50.png";
Nicon.iconSize = new GSize(34, 34);
Nicon.shadowSize = new GSize(37, 34);
Nicon.iconAnchor = new GPoint(16, 34);
// Pour affichage infobulle
Nicon.infoWindowAnchor = new GPoint(5,1);
 
 
 
// Creates a marker at the given point with the given number label
 
function createMarker(point, text, altitude) {
var marker = new GMarker(point,icon);
var html = text;
GEvent.addListener(marker, "click", function() {
map.setCenter(marker.getPoint());
afficherInfo(marker.getPoint());
afficherMasque(marker,text,altitude);
});
return marker;
}
 
// Affichage de la station a modifier
<? foreach($stations as $station) { ?>
var position = new GLatLng(<?= $station['STATION_LATITUDE'] ?>, <?= $station['STATION_LONGITUDE'] ?>);
placerMarkeur(position,"<?= $station['STATION_NOM'] ?>");
map.setCenter(position, 14);
<? } ?>
}
}
 
 
 
 
// Ajout d'un nouveau marqueur dragable , depuis le geocodage uniquement (blocage du clic depuis la carte)
 
function placerMarkeur(position,nom) {
if (addrpnt) {
map.removeOverlay(addrpnt);
}
addrpnt = new GMarker(position, {icon: Nicon, draggable: true, title: 'Click sur la carte!'}) ;
addrpnt.enableDragging() ;
map.addOverlay(addrpnt) ;
GEvent.addListener(addrpnt,'dragend',function() {
map.setCenter(addrpnt.getPoint());
afficherInfo(addrpnt.getPoint());
afficherMasque(addrpnt,nom);
}) ;
GEvent.addListener(addrpnt, "click", function() {
map.setCenter(addrpnt.getPoint());
afficherInfo(addrpnt.getPoint());
afficherMasque(addrpnt,nom);
});
afficherInfo(position);
}
 
// Masque de mise a jour station :
 
function afficherMasque(position,nom,altitude) {
// On recupere les données du formulaire (caché) , notamment pour traiter simplement l'appel asynchrone de recup altitude
var html = "<table>";
html = html + "<tr><td>Station</td> <td><input type='text' id='nom_station' value='" + nom + "'/> </td> </tr>";
<?
$requete_environnement = mysql_query("select ENVIRONNEMENT_ID, ENVIRONNEMENT_NOM from ENVIRONNEMENT");
?>
 
html = html + "<tr><td>Environnement :</td>";
html = html + "<td><select id='environnement_id' name='environnement'>";
<? while ($env = mysql_fetch_row($requete_environnement)) { ?>
html = html + "<option value='<?= $env[0] ?>'<? if ($env[0]==$stations[0]['STATION_ENVIRONNEMENT_ID']) {echo 'SELECTED';}?> ><?= $env[1] ?>";
<? } ?>
html = html + "</select></td></tr>";
html = html + "<tr><td>Latitude :</td> <td>" +document.getElementById('ll_latitude').value + "</td> </tr>" ;
html = html + "<tr><td>Longitude :</td> <td>" + document.getElementById('ll_longitude').value + "</td> </tr>";
if (altitude) {
html = html + "<tr><td>Altitude :</td> <td>" + altitude + "</td> </tr>";
}
else {
html = html + "<tr><td>Altitude :</td> <td>" + document.getElementById('ll_altitude').value + "</td> </tr>";
}
html = html + "<tr><td></td><td><input type='button' value='Enregistrer' onclick='saveData(false)'/></td></tr>";
html = html + "<tr><td></td><td><input type='button' value='Supprimer' onclick='saveData(true)'/></td></tr>";
position.openInfoWindow(html);
}
 
 
// Sauvegarde modification station
 
//
 
 
function saveData(suppr) {
var nom_station = escape(document.getElementById("nom_station").value);
var lat_station = document.getElementById("ll_latitude").value;
var lon_station = document.getElementById("ll_longitude").value;
var alt_station = document.getElementById("ll_altitude").value;
var environnement_id = document.getElementById("environnement_id").value;
 
if (!suppr) {
var url = "modules/observations/sauvegarde_station.php?nom_station=" + nom_station + "&action=U" + "&lat_station=" + lat_station +
"&lon_station=" + lon_station + "&environnement_id=" + environnement_id + "&alt_station=" + alt_station + "&participant_id=<?= $_SESSION['participant'] ?>" + "&station_id=<?= $_SESSION['observation']['station_id'] ?>";
}
else {
var url = "modules/observations/sauvegarde_station.php?nom_station=" + nom_station + "&action=D" + "&lat_station=" + lat_station +
"&lon_station=" + lon_station + "&environnement_id=" + environnement_id + "&alt_station=" + alt_station + "&participant_id=<?= $_SESSION['participant'] ?>" + "&station_id=<?= $_SESSION['observation']['station_id'] ?>";
}
GDownloadUrl(url, function(data, responseCode) {
if (responseCode == 200 && data.length <= 1) {
window.location = "<?= $url_page ?>";
}
});
}
 
function afficherInfo(position) {
var form = document.getElementById('form_coordonnee');
afficherCoordonnees(position.lat().toString(), position.lng().toString());
}
 
function afficherCoordonnees(lati, longi) {
var ellipsoid = 21;// 21 = WGS-84 (voir geo_constants)
var xtm = 0;// 0 = UTM et 1= MTM
var Coordonnee = calculer_coordonnee(lati, longi, ellipsoid, xtm);
// Nous affichons des informations.
document.getElementById('ll_latitude').value = Coordonnee.latitude.toFixed(4);
document.getElementById('ll_longitude').value = Coordonnee.longitude.toFixed(4);
document.getElementById('ll_latitude_dms').value = Coordonnee.latitude_dms;
document.getElementById('ll_longitude_dms').value = Coordonnee.longitude_dms;
 
// Calcul altitude
var script = document.createElement('script');
document.body.appendChild(script);
script.src = 'http://ws.geonames.org/' + "srtm3" + 'JSON?lat=' + lati + '&lng=' + longi + '&callback=GetAltitude';
}
 
function GetAltitude(result ) {
document.getElementById('ll_altitude').value = result.srtm3;
}
 
window.onload = load
window.onunload = GUnload
 
 
/* Source : Code provenant du site http://pages.globetrotter.net/roule/utmgoogle.htm
*/
 
var deg2rad = Math.PI / 180;
 
/*
* Fonction de transformation de coordonnées géographiques entre ellipsoide.
* Source : http://home.hiwaay.net/~taylorc/bookshelf/math-science/geodesy/datum/transform/molodensky/
* Licence : "The source code in the listing below may be copied and reused without restriction, but it is offered AS-IS with NO WARRANTY."
*
* Parameters:
* from: The geodetic position to be translated. (objet : GeodeticPosition)
* from_a: The semi-major axis of the "from" ellipsoid. (double)
* from_f: Flattening of the "from" ellipsoid. (double)
* from_esq: Eccentricity-squared of the "from" ellipsoid. (double)
* da: Change in semi-major axis length (meters); "to" minus "from"
* df: Change in flattening; "to" minus "from" (double)
* dx: Change in x between "from" and "to" datum. (double)
* dy: Change in y between "from" and "to" datum. (double)
* dz: Change in z between "from" and "to" datum. (double)
*
* Paramêtres :
* from : l'objet GeodesiquePosition à transformer (contient latitute, longitude et hauteur)
* from_a : le demi grand axe (=a) de l'ellipsoïde utilisé pour la position géodésique contenu dans l'objet "from".
* from_f : l'applatissement (=f) = 1/valeur... de l'ellipsoïde de l'objet "from"
* from_esq : l'excentricité au carré de l'ellipsoïde de l'objet "from"
* da : différence de demi grand axe (en metres) entre l'ellipsoïde "to" et "from".
* df : différence d'applatissement entre l'ellipsoïde "to" et "from".
* dx : différence pour l'axe x entre l'ellipsoïde "to" et "from".
* dy : différence pour l'axe y entre l'ellipsoïde "to" et "from".
* dz : différence pour l'axe z entre l'ellipsoïde "to" et "from".
*/
function transform(from, from_a, from_f, from_esq, da, df, dx, dy, dz) {
var slat = Math.sin (from.lat);
var clat = Math.cos (from.lat);
var slon = Math.sin (from.lon);
var clon = Math.cos (from.lon);
var ssqlat = slat * slat;
// "a divided by b"
var adb = 1.0 / (1.0 - from_f);
var dlat, dlon, dh;
var rn = from_a / Math.sqrt (1.0 - from_esq * ssqlat);
var rm = from_a * (1. - from_esq) / Math.pow ((1.0 - from_esq * ssqlat), 1.5);
dlat = (((((-dx * slat * clon - dy * slat * slon) + dz * clat) + (da * ((rn * from_esq * slat * clat) / from_a))) + (df * (rm * adb + rn / adb) * slat * clat))) / (rm + from.h);
dlon = (-dx * slon + dy * clon) / ((rn + from.h) * clat);
dh = (dx * clat * clon) + (dy * clat * slon) + (dz * slat) - (da * (from_a / rn)) + ((df * rn * ssqlat) / adb);
// Retour des données sous forme d'objet
var GeodeticPosition = { lon: from.lon + dlon,
lat: from.lat + dlat,
h: from.h + dh
};
return GeodeticPosition;
}
 
function test_transform() {
var PositionNtf = { lon: 7.7372, lat: 48.6, h: 0 };
var PositionWGS84 = transform(PositionNtf, 6378249.2, 0.00340755, 0.0068034881, -112.2, 0.00005474, -168, -60, 320);
alert('Longitude : ' + PositionWGS84.lon + 'Latitude : ' + PositionWGS84.lat + 'Hauteur : ' + PositionWGS84.h);
}
 
// Indiquer l'ellipsoid par son index dans le table et pour le xtm mettre 0 pour l'UTM et 1 pour le MTM (?)
function geo_constants(ellipsoid, xtm) {
// returns ellipsoid values
ellipsoid_axis = new Array(); // valeur du demi grand axe (a) de l'ellipsoïde
ellipsoid_eccen = new Array(); // valeur de l'excentricité au carré (e²) de l'ellipsoïde
ellipsoid_axis[0] = 6377563.396; ellipsoid_eccen[0] = 0.00667054; //airy
ellipsoid_axis[1] = 6377340.189; ellipsoid_eccen[1] = 0.00667054; // mod airy
ellipsoid_axis[2] = 6378160; ellipsoid_eccen[2] = 0.006694542; //aust national
ellipsoid_axis[3] = 6377397.155; ellipsoid_eccen[3] = 0.006674372; //bessel 1841
ellipsoid_axis[4] = 6378206.4; ellipsoid_eccen[4] = 0.006768658; //clarke 1866 == NAD 27 (TBC)
ellipsoid_axis[5] = 6378249.145; ellipsoid_eccen[5] = 0.006803511; //clarke 1880
ellipsoid_axis[6] = 6377276.345; ellipsoid_eccen[6] = 0.00637847; //everest
ellipsoid_axis[7] = 6377304.063; ellipsoid_eccen[7] = 0.006637847; // mod everest
ellipsoid_axis[8] = 6378166; ellipsoid_eccen[8] = 0.006693422; //fischer 1960
ellipsoid_axis[9] = 6378150; ellipsoid_eccen[9] = 0.006693422; //fischer 1968
ellipsoid_axis[10] = 6378155; ellipsoid_eccen[10] = 0.006693422; // mod fischer
ellipsoid_axis[11] = 6378160; ellipsoid_eccen[11] = 0.006694605; //grs 1967
ellipsoid_axis[12] = 6378137; ellipsoid_eccen[12] = 0.00669438; // grs 1980
ellipsoid_axis[13] = 6378200; ellipsoid_eccen[13] = 0.006693422; // helmert 1906
ellipsoid_axis[14] = 6378270; ellipsoid_eccen[14] = 0.006693422; // hough
ellipsoid_axis[15] = 6378388; ellipsoid_eccen[15] = 0.00672267; // int24
ellipsoid_axis[16] = 6378245; ellipsoid_eccen[16] = 0.006693422; // krassovsky
ellipsoid_axis[17] = 6378160; ellipsoid_eccen[17] = 0.006694542; // s america
ellipsoid_axis[18] = 6378165; ellipsoid_eccen[18] = 0.006693422; // wgs-60
ellipsoid_axis[19] = 6378145; ellipsoid_eccen[19] = 0.006694542; // wgs-66
ellipsoid_axis[20] = 6378135; ellipsoid_eccen[20] = 0.006694318; // wgs-72
ellipsoid_axis[21] = 6378137; ellipsoid_eccen[21] = 0.00669438; //wgs-84 (et NAD83 : pourquoi mis avec WGS84 ?)
if (ellipsoid == 0) {
ellipsoid = 22;
}
--ellipsoid; // table indexed differently
if (xtm == 1) {
// WAS: if (ellipsoid > 22)
scaleTm = 0.9999;
eastingOrg = 304800.;
} else {
scaleTm = 0.9996;
eastingOrg = 500000.;
}
 
// Retour des données sous forme d'objet
var ellipsoid = { axis: ellipsoid_axis[ellipsoid],
eccentricity: ellipsoid_eccen[ellipsoid],
eastingOrg: eastingOrg,
scaleTm: scaleTm
};
return ellipsoid;
}
 
/**This routine determines the correct UTM letter designator for the given latitude
* returns 'Z' if latitude is outside the UTM limits of 84N to 80S
*/
function get_zoneletter(lat) {
var zoneletter;
if ((84 >= lat) && (lat >= 72)) zoneletter = 'X';
else if ((72 > lat) && (lat >= 64)) zoneletter = 'W';
else if ((64 > lat) && (lat >= 56)) zoneletter = 'V';
else if ((56 > lat) && (lat >= 48)) zoneletter = 'U';
else if ((48 > lat) && (lat >= 40)) zoneletter = 'T';
else if ((40 > lat) && (lat >= 32)) zoneletter = 'S';
else if ((32 > lat) && (lat >= 24)) zoneletter = 'R';
else if ((24 > lat) && (lat >= 16)) zoneletter = 'Q';
else if ((16 > lat) && (lat >= 8)) zoneletter = 'P';
else if (( 8 > lat) && (lat >= 0)) zoneletter = 'N';
else if (( 0 > lat) && (lat >= -8)) zoneletter = 'M';
else if ((-8> lat) && (lat >= -16)) zoneletter = 'L';
else if ((-16 > lat) && (lat >= -24)) zoneletter = 'K';
else if ((-24 > lat) && (lat >= -32)) zoneletter = 'J';
else if ((-32 > lat) && (lat >= -40)) zoneletter = 'H';
else if ((-40 > lat) && (lat >= -48)) zoneletter = 'G';
else if ((-48 > lat) && (lat >= -56)) zoneletter = 'F';
else if ((-56 > lat) && (lat >= -64)) zoneletter = 'E';
else if ((-64 > lat) && (lat >= -72)) zoneletter = 'D';
else if ((-72 > lat) && (lat >= -80)) zoneletter = 'C';
else zoneletter = chr(32 + 66); //This is here as an error flag to show that the Latitude is outside the UTM limits
return zoneletter;
}
 
function parseCoordinate(coordinate, type, format, spaced) {
var coordd;
var coordm;
var coords;
var coordh = 0;
if (coordinate.search(/(^ *-|[WOS])/i) >= 0) {
coordh = -1;
}
if (coordinate.search(/(^ *\+|[NE])/i) >= 0) {
coordh = 1;
}
// if (coordinate.search(/[EW]/i) >= 0 && !type) { type = 'lon'; }
// if (coordinate.search(/[NS]/i) >= 0 && !type) { type = 'lat'; }
coordinate = coordinate.replace(/,/g, '.'); // french commas
// not sure really needed.
coordinate = coordinate.replace(/[NESWO+\-]/gi,' '); // add also: °, ', " -- or replace everything that is not a number or a dot
// alert("coordinate = " + coordinate);
if (coordinate.search(/[0-9]/i) < 0) {
alert("Can't parse input field");
coordd = "";
return;
}
 
// http://www.gpsvisualizer.com/calculators
// http://www.javascriptkit.com/javatutors/redev2.shtml
var parts = coordinate.match(/([0-9\.\-]+)[^0-9\.]*([0-9\.]+)?[^0-9\.]*([0-9\.]+)?/);
// / (one or more) /
// ([0-9\.\-]+) digits, dot or -, one set
// [^0-9\.]* separator
// ([0-9\.]+)? digits, dot, zero or one set
// [^0-9\.]* separator
// ([0-9\.]+)? digits, dot, zero or one set
 
// *: 0|more +: 1|more ?: 0|1 http://www.javascriptkit.com/javatutors/redev2.shtml
if (!parts[1]) {
alert("Can't parse input field");
coordd = '';
return;
} else {
coordd = parts[1];
if (parts[2]) {
coordm = parts[2];
} else {
coordm = 0;
}
if (parts[3]) {
coords = parts[3];
} else {
coords = 0;
}
// n = parseFloat(parts[1]);
// if (parts[2]) { n = n + parseFloat(parts[2])/60; }
// if (parts[3]) { n = n + parseFloat(parts[3])/3600; }
}
// Retour des données sous forme d'objet
var Coordonnee = { coordd: coordd,
coordm: coordm,
coords: coords,
coordh: coordh
};
return Coordonnee;
}
 
function validate_dms(latd, latm, lats, latb, lonm, lond, lons, lonb) {
var valid = 1;
if (Math.abs(Number(latd)) >= 90)
valid = 0;
if (Number(latm) >= 60)
valid = 0;
if (Number(lats) >= 60)
valid = 0;
if (Math.abs(Number(lond)) >= 180)
valid = 0;
if (Number(lonm) >= 60)
valid = 0;
if (Number(lons) >= 60)
valid = 0;
 
return(valid);
}
 
// convert decimal degrees to dms
function convertir_en_dms(lat, lon) {
var latbrg = 1;
var lonbrg = 2;
if (lat < 0)
latbrg = 2
if (lon < 0)
lonbrg = 1;
// LEW: have to round here, else could end up with 60 seconds :-)
var tlat = Math.abs(lat) + 0.5 / 360000; // round up 0.005 seconds (1/100th)
var tlon = Math.abs(lon) + 0.5 / 360000;
var tlatdm = Math.abs(lat) + 0.5 / 60000; // round up 0.0005 minutes (1/1000th)
var tlondm = Math.abs(lon) + 0.5 / 60000;
var deglat = Math.floor(tlat);
var t = (tlat - deglat) * 60;
var minlat = Math.floor(t);
var minlatdm = Math.floor((tlatdm - Math.floor(tlatdm)) * 60 * 1000) / 1000;
var seclat = (t - minlat) * 60;
seclat = Math.floor(seclat * 100) / 100; // works in js 1.4
// seclat = seclat.toFixed(2); // 2 decimal places js 1.5 and later
var deglon = Math.floor(tlon);
t = (tlon - deglon) * 60;
var minlon = Math.floor(t);
var minlondm = Math.floor((tlondm - Math.floor(tlondm)) * 60 * 1000) / 1000;
 
var seclon = (t - minlon) * 60;
seclon = Math.floor(seclon * 100) / 100; // js 1.4
// seclon = seclon.toFixed(2); // js 1.5 and later
 
var latb = '';
if (latbrg > 0) {
latb = 'N';// 1 = N (nord)
} else {
latb = 'S';// 2 = S (sud)
}
var latdms = deglat + "° " + minlat + "' " + seclat + "\"";
 
var lonb = '';
if (lonbrg > 0) {
lonb = 'E'; // 2 = E (est)
} else {
lonb = 'W';// 1 = W (west)
}
var londms = deglon + "° " + minlon + "' " + seclon + "\"";
var chaine_latlon_dms = latdms + ' ' + latb + ' ' + londms + ' ' + lonb;
// Retour des données sous forme d'objet
var LatLongDms = { lat: lat,
lat_degre: Math.floor(tlatdm),
lat_min: minlatdm,
lat_s: seclat,
lat_direction:latb,
lat_dms:latdms,
lon: lon,
lon_degre: Math.floor(tlondm),
lon_min: minlondm,
lon_s: seclon,
lon_direction:lonb,
lon_dms:londms,
ll_dms:chaine_latlon_dms
};
return LatLongDms;
}
 
function calculer_coordonnee(lati, longi, ellips, xtm) {
// Récupération de l'ellipsoide
var ellipsoid = geo_constants(ellips, xtm);
var axis = ellipsoid.axis;
var eccent = ellipsoid.eccentricity;
var scaleTm = ellipsoid.scaleTm;
var eastingOrg = ellipsoid.eastingOrg;
 
// Nous parsons la latitude saisie
var CoordonneeLat = parseCoordinate(lati);
var latb = '';// vide
if (CoordonneeLat.coordh != 0) {
if (CoordonneeLat.coordh > 0) {
latb = 'N';// 1 = N (nord)
} else {
latb = 'S';// 2 = S (sud)
}
}
var latd = CoordonneeLat.coordd;
var latm = CoordonneeLat.coordm;
var lats = CoordonneeLat.coords;
 
// Nous parsons la longitude saisie
var CoordonneeLon = parseCoordinate(longi);
var lonb = '';// vide
if (CoordonneeLon.coordh != 0) {
if (CoordonneeLon.coordh > 0) {
lonb = 'E'; // 2 = E (est)
} else {
lonb = 'W';// 1 = W (west)
}
}
var lond = CoordonneeLon.coordd;
var lonm = CoordonneeLon.coordm;
var lons = CoordonneeLon.coords;
 
// cope with blank fields
if (latd == '' || lond == '') {
alert("Latitude and longitude degrees must be entered");
return;
}
 
// Indication de la direction par défaut pour la latitude et la longitude en France
if (latb == '') {
latb = 'N';// 1 = N (Nord)
}
if (lonb == '') {
lonb = 'E';// 2 = E (Est)
}
 
// Validation
var valid = validate_dms(latd, latm, lats, latb, lonm, lond, lons, lonb);
if (valid == 0) {
alert("Invalid degrees, minutes or seconds");
return;
}
var lat = Number(latd);
lat = lat + Number(latm) / 60;
lat = lat + Number(lats) / 3600;
if (latb == 'S') { // 2 = S
lat = lat * -1;
}
var lon = Number(lond);
lon = lon + Number(lonm) / 60;
lon = lon + Number(lons) / 3600;
if (lonb == 'W') { // 1 = W
lon = lon * -1;
}
 
if (lat >= 84 || lat <= -80) {
alert("UTM latitudes should be between 84N and 80S\nCalculation will proceed anyway as locator will be valid.");
}
 
var k0 = scaleTm;
var latrad = lat * deg2rad;
var longrad = lon * deg2rad;
var zonenum = Math.floor((lon + 180) / 6) + 1;
// @dc (180 - (-70.5))/3 - 76
if (eastingOrg == 304800.) {
zonenum = Math.floor((180 - lon) / 3) - 76; // MTM, only in Quebec
if (zonenum < 3 || zonenum > 10) {
alert("MTM zone numbers only confirmed for 3-10, province of Quebec\nContinuing anyway");
}
}
 
if (lat >= 56.0 && lat < 64.0 && lon >= 3.0 && lon < 12.0 ) {
zonenum = 32;
}
// Zones speciales pour Svalbard
if( lat >= 72.0 && lat < 84.0 ) {
if (lon >= 0.0 && lon < 9.0 ) zonenum = 31;
else if ( lon >= 9.0 && lon < 21.0 ) zonenum = 33;
else if ( lon >= 21.0 && lon < 33.0 ) zonenum = 35;
else if ( lon >= 33.0 && lon < 42.0 ) zonenum = 37;
}
 
var lonorig = (zonenum - 1) * 6 - 180 + 3; //+3 puts origin in middle of zone
// @dc 180 - (7+76) * 3 - 1.5
if (eastingOrg == 304800.) {
lonorig = 180 - (zonenum + 76) * 3 - 1.5;
}
var lonorigrad = lonorig * deg2rad;
 
//Récupération de la lettre du fuseau xTM
var letter = get_zoneletter(lat);
 
// Calcul xTM
var eccPrimeSquared = (eccent) / (1 - eccent);
var N = axis / Math.sqrt(1 - eccent * Math.sin(latrad) * Math.sin(latrad));
var T = Math.tan(latrad) * Math.tan(latrad);
var C = eccPrimeSquared * Math.cos(latrad) * Math.cos(latrad);
var A = Math.cos(latrad) * (longrad - lonorigrad);
var M = axis * ((1 - eccent / 4 - 3 * eccent * eccent / 64 - 5 * eccent * eccent * eccent / 256) * latrad - (3 * eccent / 8 + 3 * eccent * eccent / 32 + 45 * eccent * eccent *eccent / 1024) * Math.sin(2 * latrad) + (15 * eccent * eccent / 256 + 45 * eccent * eccent * eccent / 1024) * Math.sin(4 * latrad) - (35 * eccent * eccent * eccent / 3072) * Math.sin(6 * latrad));
 
var easting = (k0 * N * (A + (1 - T + C) * A * A * A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120) + eastingOrg);
var northing = (k0 * (M + N * Math.tan(latrad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720)));
if (lat < 0) {
northing += 10000000.0; //10000000 meter offset for southern hemisphere
}
// xTM
// Arrondi au nombre supérieur
// alert("easting = " + easting);
preciseEasting = easting;
easting = Math.floor(easting + .5);
// alert("easting = " + easting);
// alert("northing = " + northing);
preciseNorthing = northing;
northing = Math.floor(northing + .5);
// alert("northing = " + northing);
var chaine_xtm = '';
var x_tm = '';
if (eastingOrg == 304800.) {
chaine_xtm = zonenum + ' ' + easting + 'm E ' + northing + 'm N';
x_tm = 'MTM';
} else {
chaine_xtm = zonenum + letter + ' ' + easting + 'm E ' + northing + 'm N';
x_tm = 'UTM';
}
 
// Latitude/Longitude
var chaine_latlon = lat + ' ' + latb + ' ' + lon + ' ' + lonb;
var LatLongDms = convertir_en_dms(lat,lon);
// Retour des données sous forme d'objet
var Coordonnee = { xtm: x_tm,
nord: northing,
est: easting,
zone_numero: zonenum,
zone_lettre: letter,
xtm_chaine: chaine_xtm,
latitude:lat,
longitude:lon,
ll_chaine: chaine_latlon,
latitude_dms:LatLongDms.lat_dms,
longitude_dms:LatLongDms.lon_dms,
ll_chaine_dms: LatLongDms.ll_dms
};
return Coordonnee;
}
//]]>
 
</script>
 
<?
}
?>