How to use the gdal.GeneralCmdLineProcessor function in GDAL

To help you get started, we’ve selected a few GDAL examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OSGeo / gdal / pymod / gdal_merge.py View on Github external
names = []
    format = 'GTiff'
    out_file = 'out.tif'

    ulx = None
    psize_x = None
    separate = 0
    copy_pct = 0
    nodata = None
    create_options = []
    pre_init = None
    band_type = None
    createonly = 0

    gdal.AllRegister()
    argv = gdal.GeneralCmdLineProcessor( sys.argv )
    if argv is None:
        sys.exit( 0 )

    # Parse command line arguments.
    i = 1
    while i < len(argv):
        arg = argv[i]

        if arg == '-o':
            i = i + 1
            out_file = argv[i]

        elif arg == '-v':
            verbose = 1

        elif arg == '-createonly':
github OSGeo / gdal / pymod / samples / gdal_vrtmerge.py View on Github external
# =============================================================================
#
# Program mainline.
#

if __name__ == '__main__':

	names = []
	out_file = 'out.vrt'

	ulx = None
	psize_x = None
	separate = False
	pre_init = None

	argv = gdal.GeneralCmdLineProcessor( sys.argv )
	if argv is None:
		sys.exit( 0 )

	# Parse command line arguments.
	i = 1
	while i < len(argv):
		arg = argv[i]

		if arg == '-o':
			i = i + 1
			out_file = argv[i]

		elif arg == '-separate':
			separate = True

		elif arg == '-ul_lr':
github mattjr / structured / create_masked.py View on Github external
def gdal_edit(argv):
    
    argv = gdal.GeneralCmdLineProcessor( argv )
    if argv is None:
        return -1

    datasetname = None
    maskname = None
    outputname = None
    srs = None
    ulx = None
    uly = None
    lrx = None
    lry = None
    nodata = None
    xres = None
    yres = None
    unsetgt = False
    molist = []
github OSGeo / gdal / pymod / rgb2pct.py View on Github external
def Usage():
    print 'Usage: rgb2pct.py [-n colors] [-of format] source_file dest_file'
    sys.exit(1)

# =============================================================================
# 	Mainline
# =============================================================================

color_count = 256
format = 'GTiff'
src_filename = None
dst_filename = None

gdal.AllRegister()
argv = gdal.GeneralCmdLineProcessor( sys.argv )
if argv is None:
    sys.exit( 0 )

# Parse command line arguments.
i = 1
while i < len(argv):
    arg = argv[i]

    if arg == '-of':
        i = i + 1
        format = argv[i]

    elif arg == '-n':
        i = i + 1
        color_count = int(argv[i])
github OSGeo / gdal / pymod / gdal2xyz.py View on Github external
# =============================================================================
#
# Program mainline.
#

if __name__ == '__main__':

    srcwin = None
    skip = 1    
    srcfile = None
    dstfile = None
    band_num = 1

    gdal.AllRegister()
    argv = gdal.GeneralCmdLineProcessor( sys.argv )
    if argv is None:
        sys.exit( 0 )

    # Parse command line arguments.
    i = 1
    while i < len(argv):
        arg = argv[i]

        if arg == '-srcwin':
            srcwin = (int(argv[i+1]),int(argv[i+2]),
                      int(argv[i+3]),int(argv[i+4]))
            i = i + 4

        elif arg == '-skip':
            skip = int(argv[i+1])
            i = i + 1
github OSGeo / gdal / pymod / gcps2vec.py View on Github external
def Usage():
    print 'Usage: gcp2vec.py [-of ]  '
    sys.exit(1)

# =============================================================================
# 	Mainline
# =============================================================================

format = 'GML'
in_file = None
out_file = None
pixel_out = 0

gdal.AllRegister()
argv = gdal.GeneralCmdLineProcessor( sys.argv )
if argv is None:
    sys.exit( 0 )

# Parse command line arguments.
i = 1
while i < len(argv):
    arg = argv[i]

    if arg == '-of':
        format = argv[i]

    if arg == '-p':
        pixel_out = 1

    elif in_file is None:
        in_file = argv[i]
github OSGeo / gdal / pymod / pct2rgb.py View on Github external
def Usage():
    print 'Usage: pct2rgb.py [-of format] [-b ] source_file dest_file'
    sys.exit(1)

# =============================================================================
# 	Mainline
# =============================================================================

format = 'GTiff'
src_filename = None
dst_filename = None
out_bands = 3
band_number = 1

gdal.AllRegister()
argv = gdal.GeneralCmdLineProcessor( sys.argv )
if argv is None:
    sys.exit( 0 )

# Parse command line arguments.
i = 1
while i < len(argv):
    arg = argv[i]

    if arg == '-of':
        i = i + 1
        format = argv[i]

    elif arg == '-b':
        i = i + 1
        band_number = int(argv[i])
github ocapmod / OCAP / tiles_tut / gdal2tiles_legacy_no-tms.py View on Github external
<div id="subheader">Generated by <a href="http://www.maptiler.org/">MapTiler</a>/<a href="http://www.klokan.cz/projects/gdal2tiles/">GDAL2Tiles</a>, Copyright © 2008 <a href="http://www.klokan.cz/">Klokan Petr Pridal</a>,  <a href="http://www.gdal.org/">GDAL</a> &amp; <a href="http://www.osgeo.org/">OSGeo</a> <a href="http://code.google.com/soc/">GSoC</a>
			
			</div>
		    <div id="map"></div>
		    
		  
		""" % args

		return s

# =============================================================================
# =============================================================================
# =============================================================================

if __name__=='__main__':
	argv = gdal.GeneralCmdLineProcessor( sys.argv )
	if argv:
		gdal2tiles = GDAL2Tiles( argv[1:] )
		gdal2tiles.process()
github commenthol / gdal2tiles-leaflet / gdal2tiles.py View on Github external
<div id="map"></div>
                
              
            """ \
            % args

        return s


# =============================================================================
# =============================================================================
# =============================================================================

if __name__ == '__main__':
    argv = gdal.GeneralCmdLineProcessor(sys.argv)
    if argv:
        gdal2tiles = GDAL2Tiles(argv[1:])
        gdal2tiles.process()