Просмотр исходного кода

do not recreate layer list of existing mapfile

Jachym Cepicky 14 лет назад
Родитель
Сommit
37721f7e61
3 измененных файлов с 7 добавлено и 2 удалено
  1. 0 1
      OWS.py
  2. 4 1
      wcs/__init__.py
  3. 3 0
      wfs/__init__.py

+ 0 - 1
OWS.py

@@ -73,7 +73,6 @@ class OWS:
             except:
                 self.capabilities = WebFeatureService(url=self.url,version="1.0.0")
 
-            logging.debug("OWS Capabilities: %s",self.capabilities)
         elif self.service == "WCS":
             from owslib.wcs import WebCoverageService
             self.capabilities = WebCoverageService(url=self.url,version="1.0.0")

+ 4 - 1
wcs/__init__.py

@@ -28,6 +28,10 @@ class WCS(OWS):
         self.version = self.capabilities.version
 
         mapobj = self.getMapObj(mapfilename)
+    
+        # mapobjects exists, do not do any new layers
+        if mapobj.numlayers:
+            return mapobj
 
         #
         # for each layer from the WCS Capabilities file, transform it to
@@ -57,7 +61,6 @@ class WCS(OWS):
                 lyrobj.setMetaData("wms_srs",self.config.get("MapServer","srs"))
                 extent = None
                 # processing
-                import sys
                 if layer.crsOptions:
                     lyrobj.setProjection(layer.crsOptions[0].getcode())
                     extent = self.getLayerExtent(layer,layer.crsOptions[0])

+ 3 - 0
wfs/__init__.py

@@ -27,6 +27,9 @@ class WFS(OWS):
 
         mapobj = self.getMapObj(mapfilename)
 
+        # mapobjects exists, do not do any new layers
+        if mapobj.numlayers:
+            return mapobj
 
         self.layerDefFile = self.createLayerDefinitionFile("wfs",
                 os.path.join( os.path.dirname(__file__), "templates",'wfs.xml'))