registerXPathNamespace('bp', 'https://procesy5.pl/biale_plamy-schema.xsd'); /* LINESTRING (18.960657743695 51.612137008899, 18.960110541501 51.612105643896, 18.959774447246 51.612086379359, 18.959754322927 51.612085225856, 18.959645426785 51.612078984054, 18.959455431877 51.612068093763, 18.959126615445 51.612049246382, 18.958655233785 51.612022227326, 18.958386790309 51.612006840454, 18.957723493448 51.611968821038, 18.957421446031 51.611951508026, 18.9573044 51.611944799082, 18.956794400864 51.611932376808, 18.9566352 51.611928499082, 18.955813488168 51.611951817689, 18.955739759724 51.611953909961) */ //print_r($edge_joins); $cables_from_joins_to_PE_arr=array(); $id_j=0; foreach($cables_from_joins_to_PE->xpath('cable_to_PE_to_be_calculated') as $child) { //cable_to_PE_to_be_calculated // echo "\n
"; //$attrs=$child->attributes("ID_Way"); foreach($child->attributes() as $a=>$b) { // echo "#87Child";print_r($b[0]); if($a=='ID_Way') $ID_Way=$b[0]; if($a=='Joins') $Joins=$b[0]; if($a=='ID_Point') $ID_Point=$b[0]; //if($a=='Count') $Count=$b[0]; } //echo $child->getName() . ": " . " ID_Way: ".$ID_Way. " : "; settype($ID_Way, "integer"); settype($Joins, "integer"); settype($ID_Point, "integer"); foreach($child->xpath('found_in_path_in_edge_joins_filled_path') as $Path_Point_xml) { // detect_next_PE/LINESTRING $id_j++; $LINESTRING=$Path_Point_xml->xpath('detect_next_PE/LINESTRING/text()'); $LINESTRING=$LINESTRING[0]; settype($LINESTRING, "string"); $cables_from_joins_to_PE_arr[$id_j]['LINESTRING']=$LINESTRING; $cables_from_joins_to_PE_arr[$id_j]['Joins']=$Joins; $cables_from_joins_to_PE_arr[$id_j]['ID_Way']=$ID_Way; $cables_from_joins_to_PE_arr[$id_j]['ID_Point']=$ID_Point; foreach($Path_Point_xml->xpath('detect_next_PE') as $detect_next_PE ) { foreach($detect_next_PE->attributes() as $a=>$b) { if($a=='len') $len=$b[0]; if($a=='PE_ID_Join') $PE_ID_Join=$b[0]; } settype($len, "integer"); settype($PE_ID_Join, "integer"); $cables_from_joins_to_PE_arr[$id_j]['len']=$len; $cables_from_joins_to_PE_arr[$id_j]['PE_ID_Join']=$PE_ID_Join; } } } echo "\n
#150 cables_from_joins_to_PE_arr"; print_r($cables_from_joins_to_PE_arr); DB::getPDO()->query("truncate table Rozdzielcza_test_bzyk_Cables_to_PE"); unset($ID_Way); foreach($cables_from_joins_to_PE_arr as $id_j=>$Path_Point_val) { $sql_Path_Point_val="insert into Rozdzielcza_test_bzyk_Cables_to_PE (the_geom,ID_Way,ID_Point,len,PE_ID_Join) values (ST_GeomFromText('".$Path_Point_val['LINESTRING']."'),'".$Path_Point_val['ID_Way']."', '".$Path_Point_val['ID_Point']."' ,'".$Path_Point_val['len']."','".$Path_Point_val['PE_ID_Join']."' ) "; echo "#216Query path ins:: ".$sql_Path_Point_val." "; //if(strlen($edge_joins_filled_paths[$ID_Way]['asText'])>2) if(strlen($Path_Point_val['LINESTRING'])>1) DB::getPDO()->query($sql_Path_Point_val); else echo " ERROR blad danych!!! dla ID_Point:".$Path_Point_val['ID_Point']; //else echo "#296 path nie wygenerowalo sie !! dla ".$ID_Way." i pkt ".$pkt_A." , ".$pkt_B." \n"; }