if err == None:
	print "bzip2 missing"
	sys.exit(-1)

err = which("potrace")
if err == None:
	print "potrace missing"
	sys.exit(-1)

err = which("topojson")
if err == None:
	print "topojson missing"
	sys.exit(-1)

# make sure that mapnik has the gdal plugin
if not 'gdal' in datasourceCache.plugin_names():
	print "Missing 'gdal' input plugin in mapnik - brew install mapnik --with-gdal --with-postgresql --with-cairo"
	sys.exit(-1)
	
#
# Check Database Connection
#
def check_db(str):
	print "trying to connect to:", str
	
	connection 	= psycopg2.connect(str)
	cursor 		= connection.cursor()

	cmd = "SELECT version();"
	print cmd
	cursor.execute(cmd)
Exemple #2
0
# Main
#
if __name__ == '__main__':
    version_num = int(gdal.VersionInfo('VERSION_NUM'))
    if version_num < 1800:  # because of GetGeoTransform(can_return_null)
        print('ERROR: Python bindings of GDAL 1.8.0 or later required')
        sys.exit(1)

    # make sure we have ImageMagick convert
    err = which("convert")
    if err == None:
        print "convert missing"
        sys.exit(-1)

    # make sure that mapnik as the gdal plugin
    if not 'gdal' in c.plugin_names():
        print "Missing 'gdal' input plugin in mapnik"
        sys.exit(-1)

    # make sure tiff delegate is present
    output = subprocess.check_output("convert --version | grep Delegates",
                                     shell=True)
    err = output.find('tiff')
    if err == -1:
        print "ImageMagick Convert does not have a tiff delegate... rebuild it!", output
        sys.exit(-1)

    parser = argparse.ArgumentParser(description='Generate HAND')
    apg_input = parser.add_argument_group('Input')
    apg_input.add_argument(
        "-f",
class _Datasource(Datasource,_injector):
  def describe(self):
    return Describe(self)

def Datasource (**keywords):
  return CreateDatasource(keywords)

# convinience factory methods

def Shapefile(**keywords):
  keywords['type'] = 'shape'
  return CreateDatasource(keywords)

def PostGIS(**keywords):
  keywords['type'] = 'postgis'
  return CreateDatasource(keywords)

def Raster(**keywords):
  keywords['type'] = 'raster'
  return CreateDatasource(keywords)

#register datasources
from mapnik import DatasourceCache
DatasourceCache.instance().register_datasources('%s' % inputpluginspath)
#register some fonts
from mapnik import FontEngine
FontEngine.instance().register_font('%s/Vera.ttf' % fontscollectionpath)
#set dlopen flags back to the original
setdlopenflags(flags)

	if err == None:
		print "bzip2 missing"
		sys.exit(-1)

	err = which("potrace")
	if err == None:
		print "potrace missing"
		sys.exit(-1)

	err = which("topojson")
	if err == None:
		print "topojson missing"
		sys.exit(-1)

	# make sure that mapnik has the gdal plugin
	if not 'gdal' in datasourceCache.plugin_names():
		print "Missing 'gdal' input plugin in mapnik - brew install mapnik --with-gdal --with-postgresql --with-cairo"
		sys.exit(-1)
		
	parser = argparse.ArgumentParser(description='Generate Landsat8 Floodmap vectors')
	apg_input = parser.add_argument_group('Input')
	apg_input.add_argument("-f", "--force", 	action='store_true', help="Forces new product to be generated")
	apg_input.add_argument("-v", "--verbose", 	action='store_true', help="Verbose on/off")
	apg_input.add_argument("-s", "--scene", 	help="Landsat Scene")

	options 	= parser.parse_args()
	force		= options.force
	verbose		= options.verbose
	#infile		= options.input
	#dir		= options.dir
	#vrt		= config.HANDS_AREA + "_hand.vrt"
# Main
#
if __name__ == '__main__':
	version_num = int(gdal.VersionInfo('VERSION_NUM'))
	if version_num < 1800: # because of GetGeoTransform(can_return_null)
		print('ERROR: Python bindings of GDAL 1.8.0 or later required')
		sys.exit(1)

	# make sure we have ImageMagick convert 
	err = which("convert")
	if err == None:
		print "convert missing"
		sys.exit(-1)
	
	# make sure that mapnik as the gdal plugin
	if not 'gdal' in c.plugin_names():
		print "Missing 'gdal' input plugin in mapnik"
		sys.exit(-1)
			
	# make sure tiff delegate is present
	output = subprocess.check_output("convert --version | grep Delegates", shell=True)
	err = output.find('tiff')
	if err==-1:
		print "ImageMagick Convert does not have a tiff delegate... rebuild it!", output
		sys.exit(-1)
	
	parser 		= argparse.ArgumentParser(description='Generate DEM')
	apg_input 	= parser.add_argument_group('Input')
	apg_input.add_argument("-f", "--force", action='store_true', help="HydroSHEDS forces new water image to be generated")
	apg_input.add_argument("-v", "--verbose", action='store_true', help="Verbose")
	apg_input.add_argument("-d", "--scene",  nargs=1, help="Scene")
def Datasource(**keywords):
    return CreateDatasource(keywords)


# convinience factory methods


def Shapefile(**keywords):
    keywords['type'] = 'shape'
    return CreateDatasource(keywords)


def PostGIS(**keywords):
    keywords['type'] = 'postgis'
    return CreateDatasource(keywords)


def Raster(**keywords):
    keywords['type'] = 'raster'
    return CreateDatasource(keywords)


#register datasources
from mapnik import DatasourceCache
DatasourceCache.instance().register_datasources('%s' % inputpluginspath)
#register some fonts
from mapnik import FontEngine
FontEngine.instance().register_font('%s/Vera.ttf' % fontscollectionpath)
#set dlopen flags back to the original
setdlopenflags(flags)