|
@@ -120,8 +120,7 @@ class StatsGeoOnuCommand extends BaseCommand
|
|
|
|
|
|
$geoJson = json_encode($geoData);
|
|
$geoJson = json_encode($geoData);
|
|
|
|
|
|
- $file_name = "onu_stats_tenancy_{$tenancy}".".json";
|
|
|
|
- $shape_name = "onu_stats_tenancy_{$tenancy}".".shp";
|
|
|
|
|
|
+ $file_name = "onu_stats_tenancy_{$tenancy}";
|
|
$dir = "$path/deviceServer_{$oltServerId}";
|
|
$dir = "$path/deviceServer_{$oltServerId}";
|
|
|
|
|
|
if(!is_dir($dir)) {
|
|
if(!is_dir($dir)) {
|
|
@@ -129,12 +128,12 @@ class StatsGeoOnuCommand extends BaseCommand
|
|
chown($dir, "www-data");
|
|
chown($dir, "www-data");
|
|
}
|
|
}
|
|
|
|
|
|
- $file = fopen($dir."/".$file_name, "a+");
|
|
|
|
|
|
+ $file = fopen($dir."/"."{$file_name}.json", "a+");
|
|
fwrite($file, $geoJson);
|
|
fwrite($file, $geoJson);
|
|
|
|
|
|
|
|
|
|
- if($this->getContainer()->getParameter('geoserver_service') && file_exists($dir."/".$file_name)) {
|
|
|
|
- $this->generateShapes($dir, $file_name, $shape_name);
|
|
|
|
|
|
+ if($this->getContainer()->getParameter('geoserver_service') && file_exists($dir."/"."{$file_name}.json")) {
|
|
|
|
+ $this->generateShapes($dir, $file_name);
|
|
$workspace = "deviceServer_{$oltServerId}";
|
|
$workspace = "deviceServer_{$oltServerId}";
|
|
|
|
|
|
$geoserver = $this->getContainer()->get('geoserver.api');
|
|
$geoserver = $this->getContainer()->get('geoserver.api');
|
|
@@ -146,30 +145,16 @@ class StatsGeoOnuCommand extends BaseCommand
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public function generateShapes($dir, $file_name, $shape_name)
|
|
|
|
|
|
+ public function generateShapes($dir, $file_name)
|
|
{
|
|
{
|
|
- $process = new Process("ogr2ogr -f 'ESRI Shapefile' {$dir}/{$shape_name} {$dir}/{$file_name}");
|
|
|
|
|
|
+ $process = new Process("ogr2ogr -f 'ESRI Shapefile' {$dir}/{$file_name}.shp {$dir}/{$file_name}.json");
|
|
|
|
|
|
- //$process->run();
|
|
|
|
- $process->start();
|
|
|
|
-
|
|
|
|
- while ($process->isRunning()) {
|
|
|
|
- // waiting for process to finish
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ $process->run();
|
|
|
|
+ //while ($process->isRunning()) {print_r("Procesando..".PHP_EOL);}
|
|
if (!$process->isSuccessful()) {throw new ProcessFailedException($process);}
|
|
if (!$process->isSuccessful()) {throw new ProcessFailedException($process);}
|
|
|
|
|
|
echo $process->getOutput();
|
|
echo $process->getOutput();
|
|
|
|
|
|
- $files = scandir($dir);
|
|
|
|
- foreach($files as $file)
|
|
|
|
- {
|
|
|
|
- if(is_file($dir."/".$file)) {
|
|
|
|
- chmod($dir."/".$file, 0777);
|
|
|
|
- chgrp($dir."/".$file, "www-data");
|
|
|
|
- chown($dir."/".$file, "www-data");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public function getDevices($oltServerId)
|
|
public function getDevices($oltServerId)
|