def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'p:', ['p=']) except getopt.GetoptError as err: error(str(err), 2, usage=usage) prefix = None for o, a in opts: if o in ('-p', '--prefix'): prefix = a if len(args) < 1: error('you must specify a command', 3, usage=usage) bucketBasePath = tmsConfig.get('General', 'bucketpath') s3Keys = S3Keys(prefix, bucketBasePath) command = args[0] if command == 'delete': s3Keys.delete() elif command == 'list': s3Keys.listKeys() elif command == 'count': s3Keys.count() else: error("unknown command '%(command)s'" % {'command': command}, 4, usage=usage)
from forge.terrain import TerrainTile from forge.terrain.topology import TerrainTopology from forge.lib.shapefile_utils import ShpToGDALFeatures from forge.lib.helpers import gzipFileObject from forge.lib.boto_conn import getBucket, writeToS3 basePath = '/var/local/cartoweb/tmp/3dpoc/swissalti3d/Interlaken_Pyr17/' extension = '.terrain' i = 0 t0 = time.time() getShapefiles = lambda x: x.endswith('.shp') shapefilesNames = filter(getShapefiles, os.listdir(basePath)) bucket = getBucket() bucketBasePath = tmsConfig.get('General', 'bucketpath') for f in shapefilesNames: filePathSource = basePath + f shapefile = ShpToGDALFeatures(shpFilePath=filePathSource) features = shapefile.__read__() terrainTopo = TerrainTopology(features=features) terrainTopo.fromGDALFeatures() terrainFormat = TerrainTile() terrainFormat.fromTerrainTopology(terrainTopo) fileObject = terrainFormat.toStringIO() compressedFile = gzipFileObject(fileObject) # Hardcoded scheme because we don't have any separators in the names
import datetime import logging import multiprocessing import ConfigParser import boto.sqs from boto import connect_s3 from boto.s3.key import Key from forge.lib.helpers import timestamp from forge.configs import tmsConfig from forge.lib.logs import getLogger from forge.lib.poolmanager import PoolManager logging.getLogger('boto').setLevel(logging.CRITICAL) bucketName = tmsConfig.get('General', 'bucketName') profileName = tmsConfig.get('General', 'profileName') # Init logging loggingConfig = ConfigParser.RawConfigParser() loggingConfig.read('logging.cfg') log = getLogger(loggingConfig, __name__, suffix=timestamp()) def _getS3Conn(): try: conn = connect_s3(profile_name=profileName) except Exception as e: raise Exception('S3: Error during connection %s' % e) return conn
def main(): zooms = range(0, 8) bounds = [-180, -90, 180, 90] bucketBasePath = tmsConfig.get('General', 'bucketpath') copyAGITiles(zooms, bounds, bucketBasePath)
from forge.configs import tmsConfig from forge.terrain import TerrainTile from forge.terrain.topology import TerrainTopology from forge.lib.shapefile_utils import ShpToGDALFeatures from forge.lib.helpers import gzipFileObject from forge.lib.boto_conn import getBucket, writeToS3 basePath = '/var/local/cartoweb/tmp/3dpoc/swissalti3d/Interlaken_Pyr17/' extension = '.terrain' i = 0 t0 = time.time() getShapefiles = lambda x: x.endswith('.shp') shapefilesNames = filter(getShapefiles, os.listdir(basePath)) bucket = getBucket() bucketBasePath = tmsConfig.get('General', 'bucketpath') for f in shapefilesNames: filePathSource = basePath + f shapefile = ShpToGDALFeatures(shpFilePath=filePathSource) features = shapefile.__read__() terrainTopo = TerrainTopology(features=features) terrainTopo.fromGDALFeatures() terrainFormat = TerrainTile() terrainFormat.fromTerrainTopology(terrainTopo) fileObject = terrainFormat.toStringIO() compressedFile = gzipFileObject(fileObject) # Hardcoded scheme because we don't have any separators in the names