Sfoglia il codice sorgente

Możliwość dodawania zewnętrznych WMS do projektu QGIS warstwy WMS

Mariusz Muszyński 9 anni fa
parent
commit
e714b39b6a
1 ha cambiato i file con 14 aggiunte e 10 eliminazioni
  1. 14 10
      SE/se-lib/Route/UrlAction/WmsGenerate.php

+ 14 - 10
SE/se-lib/Route/UrlAction/WmsGenerate.php

@@ -73,13 +73,15 @@ class Route_UrlAction_WmsGenerate extends RouteBase {
 					$DataSourceArr=explode('|',$DataSource);
 					$DataSource=$DataSourceArr[0];
 					$pathinfo = pathinfo($DataSource);
-					if (in_array($pathinfo['extension'], array("tif","tiff","TIF","TIFF"))) {
-						$filesToCopy[] = basename($DataSource);
-					} else {
-						$file=basename($DataSource,".shp");
-						foreach ($suffixes as $suffix) {
-							if(is_file($destFolderPath."/".$file.$suffix)) $filesToCopy[]=$file.$suffix;
-							else $missingFiles[]=$file.$suffix;
+					if (!preg_match('/.*http.*/', $DataSource)) {
+						if (in_array($pathinfo['extension'], array("tif","tiff","TIF","TIFF"))) {
+							$filesToCopy[] = basename($DataSource);
+						} else {
+							$file=basename($DataSource,".shp");
+							foreach ($suffixes as $suffix) {
+								if(is_file($destFolderPath."/".$file.$suffix)) $filesToCopy[]=$file.$suffix;
+								else $missingFiles[]=$file.$suffix;
+							}
 						}
 					}
 				}
@@ -357,9 +359,11 @@ openOnFocus: false
 				$mapLayers=$xml->xpath('/qgis/projectlayers/maplayer');
 				foreach ($mapLayers as $mapLayer) {
 					$dataSourceArr=explode('|',$mapLayer->datasource);
-					$dataSourceArr[0]=$destFolderPath.'/.wms/'.basename($dataSourceArr[0]);
-					$dataSource=implode('|',$dataSourceArr);
-					$mapLayer->datasource=$dataSource;
+					if (!preg_match('/.*http.*/', $dataSourceArr[0])) {
+						$dataSourceArr[0]=$destFolderPath.'/.wms/'.basename($dataSourceArr[0]);
+						$dataSource=implode('|',$dataSourceArr);
+						$mapLayer->datasource=$dataSource;
+					}
 					//$mapLayer->datasource=$destFolderPath.'/.wms/'.basename($mapLayer->datasource);
 					$bash='
 tmp=`mktemp -d`