biale_plamy-prepare_sql_data.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. ini_set('display_errors', 'On');
  3. error_reporting(E_ALL);
  4. $_SERVER['SERVER_NAME'] = 'biuro.biall-net.pl';
  5. //when used in /Library/Server/Web/Data/Sites/bzyk-biale-plamy-php-temp/SE/dev on biuro.biall-net.pl
  6. if( file_exists ( "../../se-lib/bootstrap.php"))
  7. require("../../se-lib/bootstrap.php");
  8. //when used in in native SE
  9. else require("../../../../SE-production-git/SE/se-lib/bootstrap.php");
  10. Lib::loadClass("Vendor_Geophp");
  11. $db = DB::getDB();
  12. /*$sql="create temporary table Rozdzielcza_test_bzyk_punkty_adresowe_temp select * from Rozdzielcza_test_bzyk_punkty_adresowe;
  13. -- 1 Dorobiona funkcja do pokazywania ID_Way
  14. update Rozdzielcza_test_bzyk_punkty_adresowe_temp t1 set t1.the_geom_nearest_way=test_find_nearest_way(t1.ID);
  15. update Rozdzielcza_test_bzyk_punkty_adresowe_temp t1 set t1.ID_Way=test_find_nearest_way_ID(t1.ID);
  16. update Rozdzielcza_test_bzyk_punkty_adresowe t1 join Rozdzielcza_test_bzyk_punkty_adresowe_temp t2 on t1.ID = t2.ID set t1.the_geom_nearest_way=t2.the_geom_nearest_way , t1.ID_Way=t2.ID_Way ;
  17. -- 3
  18. drop table Rozdzielcza_test_bzyk_punkty_adresowe_temp;
  19. update Rozdzielcza_test_bzyk_punkty_adresowe set the_geom_xpoint=test_find_xpoint(the_geom,the_geom_nearest_way);
  20. -- co to jest ten point? - to punt na drodze odpowiadajacy najblizszej
  21. -- 4
  22. truncate table Rozdzielcza_test_bzyk_przylacza;
  23. insert into Rozdzielcza_test_bzyk_przylacza (the_geom,ID_Way) select
  24. linefromtext(concat('linestring(',x(the_geom),' ',y(the_geom),',',x(the_geom_xpoint),' ',y(the_geom_xpoint),')')) ,
  25. ID from Rozdzielcza_test_bzyk_punkty_adresowe;
  26. ";
  27. */
  28. $result = DB::getPDO()->fetchall($sql);
  29. if($result) echo "res OK!";