Changeset 1d93908


Ignore:
Timestamp:
04/02/12 21:27:00 (2 years ago)
Author:
Martin Kolman <martin.kolman@…>
Branches:
master
Children:
743aa3f
Parents:
352c00e
git-author:
Martin Kolman <martin.kolman@…> (04/02/12 21:27:00)
git-committer:
Martin Kolman <martin.kolman@…> (04/02/12 21:27:00)
Message:

check if automatically downloaded tiles are actually tile images and not error pages returned by the tileserver

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/mod_mapTiles.py

    rb649db8 r1d93908  
    158158    print "RESPONSE" 
    159159    tileData = response.data 
    160      
     160 
    161161    if tileData: 
    162       tileFolder = self.modrana.paths.getMapFolderPath() 
    163       filePath = os.path.join(tileFolder, self.getImagePath(x, y, z, layerPrefix, layerType)) 
    164       self._storeTiles.automaticStoreTile(tileData, layerPrefix, z, x, y, layerType, filePath) 
    165       print "STORED" 
    166       return(tileData) 
     162      # check if the data is actually an image, and not an error page 
     163      if modrana_utils.isTheStringAnImage(tileData): 
     164        tileFolder = self.modrana.paths.getMapFolderPath() 
     165        filePath = os.path.join(tileFolder, self.getImagePath(x, y, z, layerPrefix, layerType)) 
     166        self._storeTiles.automaticStoreTile(tileData, layerPrefix, z, x, y, layerType, filePath) 
     167        print "STORED" 
     168        return(tileData) 
     169      else: 
     170        print("mapTiles: tile data returned by remote tileserver was not an image") 
     171        print("NOTE: this probably means that the tileserver returned an" 
     172              "error page in place of the tile, because it doesn't like you") 
     173        return None 
    167174    else: 
    168175      return None 
Note: See TracChangeset for help on using the changeset viewer.