(
        self,
        tx,
        ty,
        tz,
        children=[],
        **args
        )
return s
Template for the KML. Returns filled string.
Template for the KML. Returns filled string.
Template for the KML . Returns filled string .
def generate_kml(
        self,
        tx,
        ty,
        tz,
        children=[],
        **args
        ):
        """
        Template for the KML. Returns filled string.
        """

        (args['tx'], args['ty'], args['tz']) = (tx, ty, tz)
        args['tileformat'] = self.tileext
        if 'tilesize' not in args:
            args['tilesize'] = self.tilesize

        if 'minlodpixels' not in args:
            args['minlodpixels'] = int(args['tilesize'] / 2)  # / 2.56) # default 128
        if 'maxlodpixels' not in args:
            args['maxlodpixels'] = int(args['tilesize'] * 8)  # 1.7) # default 2048 (used to be -1)
        if children == []:
            args['maxlodpixels'] = -1

        if tx == None:
            tilekml = False
            args['title'] = self.options.title
        else:
            tilekml = True
            args['title'] = '%d/%d/%d.kml' % (tz, tx, ty)
            (args['south'], args['west'], args['north'], args['east'
             ]) = self.tileswne(tx, ty, tz)

        if tx == 0:
            args['drawOrder'] = 2 * tz + 1
        elif tx != None:
            args['drawOrder'] = 2 * tz
        else:
            args['drawOrder'] = 0

        url = self.options.url
        if not url:
            if tilekml:
                url = '../../'
            else:
                url = ''

        s = \
            """<?xml version="1.0" encoding="utf-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2">
      <Document>
        <name>%(title)s</name>
        <description></description>
        <Style>
          <ListStyle id="hideChildren">
            <listItemType>checkHideChildren</listItemType>
          </ListStyle>
        </Style>""" \
            % args
        if tilekml:
            s += \
                """
        <Region>
          <LatLonAltBox>
            <north>%(north).14f</north>
            <south>%(south).14f</south>
            <east>%(east).14f</east>
            <west>%(west).14f</west>
          </LatLonAltBox>
          <Lod>
            <minLodPixels>%(minlodpixels)d</minLodPixels>
            <maxLodPixels>%(maxlodpixels)d</maxLodPixels>
          </Lod>
        </Region>
        <GroundOverlay>
          <drawOrder>%(drawOrder)d</drawOrder>
          <Icon>
            <href>%(ty)d.%(tileformat)s</href>
          </Icon>
          <LatLonBox>
            <north>%(north).14f</north>
            <south>%(south).14f</south>
            <east>%(east).14f</east>
            <west>%(west).14f</west>
          </LatLonBox>
        </GroundOverlay>
    """ \
                % args

        for (cx, cy, cz) in children:
            (csouth, cwest, cnorth, ceast) = self.tileswne(cx, cy, cz)
            s += \
                """
        <NetworkLink>
          <name>%d/%d/%d.%s</name>
          <Region>
            <LatLonAltBox>
              <north>%.14f</north>
              <south>%.14f</south>
              <east>%.14f</east>
              <west>%.14f</west>
            </LatLonAltBox>
            <Lod>
              <minLodPixels>%d</minLodPixels>
              <maxLodPixels>-1</maxLodPixels>
            </Lod>
          </Region>
          <Link>
            <href>%s%d/%d/%d.kml</href>
            <viewRefreshMode>onRegion</viewRefreshMode>
            <viewFormat/>
          </Link>
        </NetworkLink>
    """ \
                % (
                cz,
                cx,
                cy,
                args['tileformat'],
                cnorth,
                csouth,
                ceast,
                cwest,
                args['minlodpixels'],
                url,
                cz,
                cx,
                cy,
                )

        s += """      </Document>
    </kml>
    """
        return s
def generate_kml ( self , tx , ty , tz , children = [ ] , * * args ) : ( args [ 'tx' ] , args [ 'ty' ] , args [ 'tz' ] ) = ( tx , ty , tz ) args [ 'tileformat' ] = self . tileext if 'tilesize' not in args : args [ 'tilesize' ] = self . tilesize if 'minlodpixels' not in args : args [ 'minlodpixels' ] = int ( args [ 'tilesize' ] / 2 ) # / 2.56) # default 128 if 'maxlodpixels' not in args : args [ 'maxlodpixels' ] = int ( args [ 'tilesize' ] * 8 ) # 1.7) # default 2048 (used to be -1) if children == [ ] : args [ 'maxlodpixels' ] = - 1 if tx == None : tilekml = False args [ 'title' ] = self . options . title else : tilekml = True args [ 'title' ] = '%d/%d/%d.kml' % ( tz , tx , ty ) ( args [ 'south' ] , args [ 'west' ] , args [ 'north' ] , args [ 'east' ] ) = self . tileswne ( tx , ty , tz ) if tx == 0 : args [ 'drawOrder' ] = 2 * tz + 1 elif tx != None : args [ 'drawOrder' ] = 2 * tz else : args [ 'drawOrder' ] = 0 url = self . options . url if not url : if tilekml : url = '../../' else : url = '' s = """<?xml version="1.0" encoding="utf-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2">
      <Document>
        <name>%(title)s</name>
        <description></description>
        <Style>
          <ListStyle id="hideChildren">
            <listItemType>checkHideChildren</listItemType>
          </ListStyle>
        </Style>""" % args if tilekml : s += """
        <Region>
          <LatLonAltBox>
            <north>%(north).14f</north>
            <south>%(south).14f</south>
            <east>%(east).14f</east>
            <west>%(west).14f</west>
          </LatLonAltBox>
          <Lod>
            <minLodPixels>%(minlodpixels)d</minLodPixels>
            <maxLodPixels>%(maxlodpixels)d</maxLodPixels>
          </Lod>
        </Region>
        <GroundOverlay>
          <drawOrder>%(drawOrder)d</drawOrder>
          <Icon>
            <href>%(ty)d.%(tileformat)s</href>
          </Icon>
          <LatLonBox>
            <north>%(north).14f</north>
            <south>%(south).14f</south>
            <east>%(east).14f</east>
            <west>%(west).14f</west>
          </LatLonBox>
        </GroundOverlay>
    """ % args for ( cx , cy , cz ) in children : ( csouth , cwest , cnorth , ceast ) = self . tileswne ( cx , cy , cz ) s += """
        <NetworkLink>
          <name>%d/%d/%d.%s</name>
          <Region>
            <LatLonAltBox>
              <north>%.14f</north>
              <south>%.14f</south>
              <east>%.14f</east>
              <west>%.14f</west>
            </LatLonAltBox>
            <Lod>
              <minLodPixels>%d</minLodPixels>
              <maxLodPixels>-1</maxLodPixels>
            </Lod>
          </Region>
          <Link>
            <href>%s%d/%d/%d.kml</href>
            <viewRefreshMode>onRegion</viewRefreshMode>
            <viewFormat/>
          </Link>
        </NetworkLink>
    """ % ( cz , cx , cy , args [ 'tileformat' ] , cnorth , csouth , ceast , cwest , args [ 'minlodpixels' ] , url , cz , cx , cy , ) s += """      </Document>
    </kml>
    """ return s