Advertisement
Guest User

Untitled

a guest
Jul 11th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1.    switch($_REQUEST['method']) {
  2.  
  3.     case 'SP' : // Shortest Path
  4.  
  5.        
  6.             §sql = "SELECT arcos.id, ST_AsGeoJSON(arcos.the_geom) AS geojson, length(arcos.the_geom) AS length, ".TABLE.".id
  7.                     FROM ".TABLE."
  8.                     JOIN
  9.                     (SELECT * FROM shortest_path('SELECT id,source::int4 AS source,target::int4 AS target,length::double precision AS cost FROM ".TABLE."',
  10.                    
  11.                     ".$startpoint['id'].",".$endpoint['id'].",false,false)) AS rota
  12.                     ON
  13.                     ".TABLE.".id = rota.edge_id;";
  14.            
  15.            
  16.    
  17.             break;
  18.        
  19.        
  20.     case 'SP2' : // Shortest Path2
  21.  
  22.             $sql = "SELECT arcos.id, ST_AsGeoJSON(arcos.the_geom) AS geojson, length(arcos.the_geom) AS length, ".TABLE.".id
  23.                     FROM ".TABLE."
  24.                     JOIN
  25.                     (SELECT * FROM shortest_path('SELECT id,source::int4 AS source,target::int4 AS target,length::double precision AS cost FROM ".TABLE."',
  26.                    
  27.                     ".$startpoint['id'].",".$endpoint['id'].",false,false)) AS rota
  28.                     ON
  29.                     ".TABLE.".id = rota.edge_id;";
  30.             break;      
  31.        
  32.        
  33.  
  34.  
  35.    } // close switch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement