def load_tile_features(lock, host, port, path_fmt, tiles, features):
 while True:
  try:
   tile = tiles.pop()
  except IndexError:
   break
  conn = HTTPConnection(host, port)
  head = {'Accept-Encoding': 'gzip'}
  path = (path_fmt % tile)
  conn.request('GET', path, headers=head)
  resp = conn.getresponse()
  file = StringIO(resp.read())
  if (resp.getheader('Content-Encoding') == 'gzip'):
   file = GzipFile(fileobj=file, mode='r')
  with lock:
   mime_type = resp.getheader('Content-Type')
   if (mime_type in ('text/json', 'application/json')):
    file_features = geojson.decode(file)
   elif (mime_type == 'application/octet-stream+mvt'):
    file_features = mvt.decode(file)
   else:
    logging.error(('Unknown MIME-Type "%s" from %s:%d%s' % (mime_type, host, port, path)))
    return
   logging.debug(('%d features in %s:%d%s' % (len(file_features), host, port, path)))
   features.extend(file_features)

def load_tile_features ( lock , host , port , path_fmt , tiles , features ) : while True : try : tile = tiles . pop ( ) except IndexError : break conn = HTTPConnection ( host , port ) head = { 'Accept-Encoding' : 'gzip' } path = ( path_fmt % tile ) conn . request ( 'GET' , path , headers = head ) resp = conn . getresponse ( ) file = StringIO ( resp . read ( ) ) if ( resp . getheader ( 'Content-Encoding' ) == 'gzip' ) : file = GzipFile ( fileobj = file , mode = 'r' ) with lock : mime_type = resp . getheader ( 'Content-Type' ) if ( mime_type in ( 'text/json' , 'application/json' ) ) : file_features = geojson . decode ( file ) elif ( mime_type == 'application/octet-stream+mvt' ) : file_features = mvt . decode ( file ) else : logging . error ( ( 'Unknown MIME-Type "%s" from %s:%d%s' % ( mime_type , host , port , path ) ) ) return logging . debug ( ( '%d features in %s:%d%s' % ( len ( file_features ) , host , port , path ) ) ) features . extend ( file_features )
load data from tiles to features .