911 |
$sql= "select astext(centroid(geom)) from parcelle where parcelle ='".$val["parcelle"]."'"; |
$sql= "select astext(centroid(geom)) from parcelle where parcelle ='".$val["parcelle"]."'"; |
912 |
$this->addToLog("recherche centroid parcelle :".$sql, VERBOSE_MODE); |
$this->addToLog("recherche centroid parcelle :".$sql, VERBOSE_MODE); |
913 |
$geom = $db -> getOne($sql); |
$geom = $db -> getOne($sql); |
914 |
if($geom!=''){ // la parcelle est exitante dans la table / vue parcelle |
if($geom!=''){ // la parcelle est exitante dans la table ou vue parcelle |
915 |
$sql ="update dossier set geom =geometryfromtext('".$geom."', ".$projection." ) where dossier ='".$id."'"; |
$sql ="update dossier set geom =geometryfromtext('".$geom."', ".$projection." ) where dossier ='".$id."'"; |
916 |
$this->addToLog("sig_interne maj geom :".$sql, VERBOSE_MODE); |
$this->addToLog("sig_interne maj geom :".$sql, VERBOSE_MODE); |
917 |
$res = $db -> query($sql); |
$res = $db -> query($sql); |
924 |
$this->calcul_auto_pos($id,$db,$geom,$projection); |
$this->calcul_auto_pos($id,$db,$geom,$projection); |
925 |
if($this->auto_servitude_surfacique==1) // recherche de servitude surfacique |
if($this->auto_servitude_surfacique==1) // recherche de servitude surfacique |
926 |
$this->calcul_auto_servitude_surfacique($id,$db,$geom,$projection); |
$this->calcul_auto_servitude_surfacique($id,$db,$geom,$projection); |
927 |
if($this->auto_servitude_ligne==1) // recherche de servitude surfacique |
if($this->auto_servitude_ligne==1) // recherche de servitude ligne |
928 |
$this->calcul_auto_servitude_ligne($id,$db,$geom,$projection); |
$this->calcul_auto_servitude_ligne($id,$db,$geom,$projection); |
929 |
|
if($this->auto_servitude_point==1) // recherche de servitude point |
930 |
|
$this->calcul_auto_servitude_point($id,$db,$geom,$projection); |
931 |
$temp=strtr($this->servitude,"'"," "); // enleve le ' |
$temp=strtr($this->servitude,"'"," "); // enleve le ' |
932 |
$sql1 ="update dossier set servitude = '".$temp."' where dossier = '".$id."'"; |
$sql1 ="update dossier set servitude = '".$temp."' where dossier = '".$id."'"; |
933 |
$res1 = $db -> query($sql1); |
$res1 = $db -> query($sql1); |
934 |
$this->addToLog("maj auto_servitude_surfacique :".$sql1, VERBOSE_MODE); |
$this->addToLog("maj servitudes :".$sql1, VERBOSE_MODE); |
935 |
if (database:: isError($res1)) die($res1->getMessage()."erreur ".$sql1); |
if (database:: isError($res1)) die($res1->getMessage()."erreur ".$sql1); |
936 |
}else{ // parcelle inexistante |
}else{ // parcelle inexistante |
937 |
if($this->maj ==1){ // en maj mettre a null la geometrie si parcelle changée inexistante |
if($this->maj ==1){ // en maj mettre a null la geometrie si parcelle changée inexistante |
946 |
} |
} |
947 |
|
|
948 |
function calcul_auto_pos($id,&$db,$geom,$projection){ |
function calcul_auto_pos($id,&$db,$geom,$projection){ |
949 |
// recherche du pos automatique dans le geom de la table / vue pos |
// recherche du pos automatique |
950 |
$sql="select pos from pos WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))"; |
$sql="select pos from pos WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))"; |
951 |
$pos = $db -> getOne($sql); |
$pos = $db -> getOne($sql); |
952 |
$this->addToLog("recherche auto_pos :".$sql, VERBOSE_MODE); |
$this->addToLog("recherche auto_pos :".$sql, VERBOSE_MODE); |
962 |
} |
} |
963 |
|
|
964 |
function calcul_auto_servitude_surfacique($id,&$db,$geom,$projection){ |
function calcul_auto_servitude_surfacique($id,&$db,$geom,$projection){ |
965 |
// recherche du pos automatique dans le geom de la table / vue pos |
// recherche servitude surfacique |
966 |
$sql="select * from servitude_surfacique WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))"; |
$sql="select * from servitude_surfacique WHERE ST_contains(geom, geometryfromtext('".$geom."', ".$projection."))"; |
967 |
$res=$db->query($sql); |
$res=$db->query($sql); |
968 |
if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql); |
if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql); |
974 |
} |
} |
975 |
|
|
976 |
function calcul_auto_servitude_ligne($id,&$db,$geom,$projection){ |
function calcul_auto_servitude_ligne($id,&$db,$geom,$projection){ |
977 |
// recherche du pos automatique dans le geom de la table / vue pos |
// recherche servitude ligne |
978 |
$sql="select * from servitude_ligne WHERE ST_contains(ST_buffer(geom, 100), geometryfromtext('".$geom."', ".$projection."))"; |
$distance=100; |
979 |
|
$sql="select * from servitude_ligne WHERE ST_contains(ST_buffer(geom, ".$distance."), geometryfromtext('".$geom."', ".$projection."))"; |
980 |
$res=$db->query($sql); |
$res=$db->query($sql); |
981 |
if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql); |
if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql); |
982 |
$this->addToLog("requete :".$sql." executee ", VERBOSE_MODE); |
$this->addToLog("requete :".$sql." executee ", VERBOSE_MODE); |
986 |
} |
} |
987 |
} |
} |
988 |
|
|
989 |
|
function calcul_auto_servitude_point($id,&$db,$geom,$projection){ |
990 |
|
// recherche servitude point |
991 |
|
$distance=300; |
992 |
|
$sql="select libelle,observation, distance(geom, geometryfromtext('".$geom."', ".$projection.")) as distance from servitude_point WHERE distance(geom, geometryfromtext('".$geom."', ".$projection."))<".$distance.""; |
993 |
|
$res=$db->query($sql); |
994 |
|
if (database:: isError($res)) die($res1->getMessage()."erreur ".$sql); |
995 |
|
$this->addToLog("requete :".$sql." executee ", VERBOSE_MODE); |
996 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
997 |
|
$this->addToMessage("<br>"._("servitude")." : ".$row['libelle']." - ".$row['observation'])." a ".round($row4['distance'],2)." m ";; |
998 |
|
$this->servitude.=" [".$row['libelle']."] ".$row['observation']." a ".round($row4['distance'],2)." m - "; |
999 |
|
} |
1000 |
|
} |
1001 |
|
|
1002 |
|
|
1003 |
}// fin classe |
}// fin classe |
1004 |
?> |
?> |