[Tilecache] patch for more valid capabilities doc generation

Steven M. Ottens steven at minst.net
Tue Aug 21 10:21:20 EDT 2007


Hi all,

Working with a sharpmap developer (http://www.codeplex.com/SharpMap) I 
discovered that TileCache doesn't generate a valid Capabilites document. 
This patch resolves two issues:
-missing namespace on xlink
-missing (empty) root layer tag

Have fun with it, it's done against 1.9rc3

Steven
-------------- next part --------------
--- c:\Documents and Settings\steveno\My Documents\Downloads\tilecache-1.9-rc3\TileCache\Service.py     2007-07-25 18:47:00.000000000 +0200
+++ c:\Python25\Lib\site-packages\TileCache\Service.py  2007-08-21 15:43:19.1126
40000 +0200
@@ -170,7 +170,7 @@
           <Service>
             <Name>OGC:WMS</Name>
             <Title>%s</Title>
-            <OnlineResource xlink:href="%s"/>
+            <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="%s"/>
           </Service>
         """ % (description, host)

@@ -181,7 +181,7 @@
                 <Format>application/vnd.ogc.wms_xml</Format>
                 <DCPType>
                   <HTTP>
-                    <Get><OnlineResource xlink:href="%s"/></Get>
+                    <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="%s"/></Get>
                   </HTTP>
                 </DCPType>
               </GetCapabilities>""" % (host)
@@ -193,7 +193,7 @@
         xml += """
                 <DCPType>
                   <HTTP>
-                    <Get><OnlineResource xlink:href="%s"/></Get>
+                    <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="%s"/></Get>
                   </HTTP>
                 </DCPType>
               </GetMap>
@@ -223,7 +223,8 @@
         xml += """
             </VendorSpecificCapabilities>
             <UserDefinedSymbolization SupportSLD="0" UserLayer="0"
-                                      UserStyle="0" RemoteWFS="0"/>"""
+                                      UserStyle="0" RemoteWFS="0"/>
+            <Layer>"""
         for name, layer in self.service.layers.items():
             xml += """
             <Layer queryable="0" opaque="0" cascaded="1">
@@ -237,6 +238,7 @@
                 layer.bbox[0], layer.bbox[1], layer.bbox[2], layer.bbox[3])

         xml += """
+            </Layer>
           </Capability>
         </WMT_MS_Capabilities>"""


More information about the Tilecache mailing list