This file is indexed.

/usr/share/pyshared/TileCache/Services/KML.py is in tilecache 2.11-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# BSD Licensed, Copyright (c) 2006-2010 TileCache Contributors

from TileCache.Service import Request, Capabilities
from TileCache.Services.TMS import TMS
import TileCache.Layer as Layer

class KML(TMS):
    def parse (self, fields, path, host):
        tile = TMS.parse(self,fields, path, host) 
        kml = self.generate_kml_doc(tile, base_path=host)
        return ("application/vnd.google-earth.kml+xml", kml)

    def generate_kml_doc(self, tile, base_path="", include_wrapper = True):    
        tiles = [
          Layer.Tile(tile.layer, tile.x << 1, tile.y << 1, tile.z + 1),
          Layer.Tile(tile.layer, (tile.x << 1) + 1, tile.y << 1, tile.z + 1),
          Layer.Tile(tile.layer, (tile.x << 1) + 1, (tile.y << 1) + 1, tile.z + 1),
          Layer.Tile(tile.layer, tile.x << 1 , (tile.y << 1) + 1, tile.z + 1)
        ]
        
        network_links = []
        
        for single_tile in tiles:
            if single_tile.z >= len(tile.layer.resolutions):
                continue
            b = single_tile.bounds()
            network_links.append("""<NetworkLink>
      <name>tile</name>
      <Region>
        <Lod>
          <minLodPixels>256</minLodPixels><maxLodPixels>-1</maxLodPixels>
        </Lod>
        <LatLonAltBox>
          <north>%s</north><south>%s</south>
          <east>%s</east><west>%s</west>
        </LatLonAltBox>
      </Region>
      <Link>
        <href>%s/1.0.0/%s/%s/%s/%s.kml</href>
        <viewRefreshMode>onRegion</viewRefreshMode>
      </Link>
    </NetworkLink>""" % (b[3], b[1], b[2], b[0], base_path, single_tile.layer.name, single_tile.z, single_tile.x, single_tile.y))
        
        b = tile.bounds()
        kml = []
        if include_wrapper: 
            kml.append( """<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">""")
        if tile.z == len(tile.layer.resolutions) - 1:
            max_lod_pixels = -1
        else:
            max_lod_pixels = 512
        kml.append("""
  <Document>
    <Region>
      <Lod>
        <minLodPixels>256</minLodPixels><maxLodPixels>%d</maxLodPixels>
      </Lod>
      <LatLonAltBox>
        <north>%s</north><south>%s</south>
        <east>%s</east><west>%s</west>
      </LatLonAltBox>
    </Region>
    <GroundOverlay>
      <drawOrder>%s</drawOrder>
      <Icon>
        <href>%s/1.0.0/%s/%s/%s/%s</href>
      </Icon>
      <LatLonBox>
        <north>%s</north><south>%s</south>
        <east>%s</east><west>%s</west>
      </LatLonBox>
    </GroundOverlay>
    %s
    """ % (max_lod_pixels, b[3], b[1], b[2], b[0], tile.z, base_path, tile.layer.name, tile.z, tile.x, tile.y, b[3], b[1], b[2], b[0], "\n".join(network_links)))
        if include_wrapper:
            kml.append("""</Document></kml>""" )
        kml = "\n".join(kml)       

        return kml