Exemple #1
0
#Argument handling - if module has a parser attributte it will be used to check arguments in wrapper script.
#a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser = ArgumentParser(
    description=
    "Find steep triangles (in water class by default). Large triangles will be ignored...",
    prog=progname)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",
                      action="store_true",
                      help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
#add some arguments below
parser.add_argument("-class",
                    dest="cut_to",
                    type=int,
                    default=cut_to,
                    help="Inspect points of this class - defaults to 'water'")
parser.add_argument(
    "-slope",
    type=float,
    default=min_slope,
    help=
    "Specify the slope limit for when a triangle isn't flat. Defaults to %.2f deg"
    % min_slope)
parser.add_argument(
    "-zmin",
    type=float,
    default=zmin,
    help=
    "Specify minimal z-bounding box for a triangle which isn't flat. Defaults to %.2f m"
Exemple #2
0
#The z-interval we want to consider for the input LAS-pointcloud...
Z_MIN=constants.z_min_terrain
Z_MAX=constants.z_max_terrain
CELL_SIZE=10  #10 m cellsize in diff grid
TILE_SIZE=constants.tile_size
ND_VAL=-9999
MIN_POINT_LIMIT=2  #at least this number of reference points in order to grid...
MIN_POINT_LIMIT_BASE=5 # at least this many point in input las to bother
GRIDS_OUT="diff_grids"  #due to the fact that this is being called from qc_wrap it is easiest to have a standard folder for output..
SRAD=2.0

progname=os.path.basename(__file__).replace(".pyc",".py")

parser=ArgumentParser(description="'Subtracts' two pointclouds and grids the difference.",prog=progname)
#add some arguments below
parser.add_argument("-class",dest="cut_to",type=int,default=CUT_CLASS,help="Specify ground class of reference las tile. Defaults to 'terrain'")
parser.add_argument("-outdir",help="Specify an output directory. Default is "+GRIDS_OUT+" in cwd.",default=GRIDS_OUT)
parser.add_argument("-cs",type=float,help="Specify cell size of grid. Default 100 m (TILE_SIZE must be divisible by cs)",default=CELL_SIZE)
parser.add_argument("-toE",action="store_true",help="Warp reference points to ellipsoidal heights.")
parser.add_argument("-srad",type=float,help="Specify search radius to get interpolated z in input. Defaults to "+str(SRAD),default=SRAD)
parser.add_argument("-overwrite",action="store_true",help="Overwrite output file if it exists - default is to skip.")
parser.add_argument("las_file",help="input 1km las tile.")
parser.add_argument("las_ref_file",help="reference las tile.")

def usage():
	parser.print_help()
	


def check_points(dz):
	m=dz.mean()
Exemple #3
0
z_min  =  1.0
cut_to =  constants.terrain

# To always get the proper name in usage / help - even when called from a wrapper...
progname=os.path.basename(__file__).replace(".pyc",".py")

# Argument handling - if module has a parser attributte it will be used to check
# arguments in wrapper script.
parser   = ArgumentParser(description = "Write something here",  prog = progname)

db_group = parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local", action = "store_true", help = "Force use of local database for reporting.")
db_group.add_argument("-schema",    help = "Specify schema for PostGis db.")

# Add some arguments below
parser.add_argument("-class", type = int,   default = cut_to,  help = "Inspect points of this class - defaults to 'terrain'")
parser.add_argument("-zlim",  type = float, default = z_min,   help = "Specify the minial z-size of a steep triangle.")

group = parser.add_mutually_exclusive_group()
group.add_argument("-layername",  help = "Specify layername (e.g. for reference data in a database)")
group.add_argument("-layersql",   help = "Specify sql-statement for layer selection (e.g. for reference data in a database). "+vector_io.EXTENT_WKT +
                   " can be used as a placeholder for wkt-geometry of area of interest - in order to enable a significant speed up of db queries", type = str)

parser.add_argument("las_file",  help = "input 1km las tile.")
parser.add_argument("ref_data",  help = "input reference data connection string (e.g to a db, or just a path to a shapefile).")


# A usage function will be imported by wrapper to print usage for test.
# Otherwise ArgumentParser will handle that...
def usage():
    parser.print_help()
Exemple #4
0
Z_MIN = constants.z_min_terrain
Z_MAX = constants.z_max_terrain + 30

# hmm try to only use building classifications here - should be less noisy!
cut_to = [constants.building, constants.surface]

progname = os.path.basename(__file__).replace(".pyc", ".py")

parser = ArgumentParser(
    description="Check displacement of roofridges relative to input polygons",
    prog=progname,
)

parser.add_argument(
    "-use_all",
    action="store_true",
    help="Check all buildings. Else only check those with 4 corners.",
)

db_group = parser.add_mutually_exclusive_group()
db_group.add_argument(
    "-use_local",
    action="store_true",
    help="Force use of local database for reporting.",
)
db_group.add_argument(
    "-schema",
    help="Specify schema for PostGis db.",
)

parser.add_argument(
Exemple #5
0
import os
import sys
import time
from utils.osutils import ArgumentParser

import dhmqc_constants as constants
from thatsDEM import pointcloud

CELL_SIZE = 1.0
PROGNAME = os.path.basename(__file__).replace(".pyc", ".py")

parser = ArgumentParser(
    description="Write a grid with cells representing most frequent class.",
    prog=PROGNAME)
parser.add_argument("las_file", help="Input las tile.")
parser.add_argument("output_dir", help="output directory of class grids.")
parser.add_argument(
    "-cs",
    type=float,
    help="Cellsize (defaults to {0:.2f})".format(CELL_SIZE),
    default=CELL_SIZE)

def usage():
    '''
    Print usage
    '''
    parser.print_help()

def main(args):
    '''
Exemple #6
0
GEOID_GRID = os.path.join(os.path.dirname(__file__), "..", "data",
                          "dkgeoid13b_utm32.tif")
cut_to = [constants.terrain, constants.water]
CS = 0.4  #cellsize for testing point distance
#To always get the proper name in usage / help - even when called from a wrapper...
progname = os.path.basename(__file__).replace(".pyc", ".py")
#BEWARE:
#The same lake might be handled simultaneously by multiple processes - one might deem it invalid while another will deem it valid.
#UPDATE: This is now handled by optimistic locking
#Argument handling is a bit quirky here - because we also want to be able to perform db-setup and las_file MUST be given as first arg to conform with qc_wrap
parser = ArgumentParser(description="Set lake heights from pointcloud data.",
                        prog=progname)

parser.add_argument(
    "las_file",
    help=
    "input 1km las tile. If las_file ==__db__ and running as __main__: perform db actions."
)
parser.add_argument(
    "db_connection",
    help="input reference data in the form of a psycopg2 connection string.")
parser.add_argument("tablename", help="input name of lake layer.")
parser.add_argument("-geometry_column",
                    dest="GEOMETRY_",
                    help="name of geometry column name",
                    default="wkb_geometry")
parser.add_argument("-id_attr",
                    dest="IDATTR_",
                    help="name of unique id attribute.",
                    default="ogc_fid")
parser.add_argument("-burn_z_attr",
Exemple #7
0
# To always get the proper name in usage / help - even when called from a wrapper...
PROGNAME = os.path.basename(__file__)

parser = ArgumentParser(
    description='''Check for spikes - a spike is a point with steep edges in all four
                   quadrants (all edges should be steep unless those 'close').''',
    prog=PROGNAME)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument(
    "-use_local",
    action="store_true",
    help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
parser.add_argument(
    "-class",
    dest="cut_class",
    type=int,
    default=CUT_TO,
    help="Inspect points of this class - defaults to 'terrain'")
parser.add_argument(
    "-slope",
    dest="slope",
    type=float,
    default=SLOPE_MIN,
    help='''Specify the minial slope in degrees of a steep edge
            (0-90 deg) - default 25 deg.''')
parser.add_argument(
    "-zlim",
    dest="zlim",
    type=float,
    default=ZLIM,
    help="Specify the minial (positive) delta z of a steep edge - default 0.1 m")
Exemple #8
0
parser = ArgumentParser(
    description="Write density grids of input tiles - report to db.",
    prog=PROGNAME,
)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument(
    "-use_local",
    action="store_true",
    help="Force use of local database for reporting.",
)
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
parser.add_argument(
    "-cs",
    type=float,
    help=
    "Specify cell size of grid. Default 100 m (TILE_SIZE must be divisible by cell_size)",
    default=CELL_SIZE,
)
parser.add_argument(
    "-outdir",
    help="To specify an output directory. Default is " + GRIDS_OUT +
    " in cwd.",
    default=GRIDS_OUT,
)
# add some arguments below
parser.add_argument(
    "-lakesql",
    help=
    "Specify sql-statement for lake layer selection (e.g. for reference data in a database)",
)
Exemple #9
0
#import some relevant modules...
from thatsDEM import grid
import dhmqc_constants as constants
import numpy as np
import scipy.ndimage as im
from osgeo import gdal
import sqlite3 as db
from utils.osutils import ArgumentParser  #If you want this script to be included in the test-suite use this subclass. Otherwise argparse.ArgumentParser will be the best choice :-)
#To always get the proper name in usage / help - even when called from a wrapper...
progname = os.path.basename(__file__).replace(".pyc", ".py")
#Argument handling - if module has a parser attributte it will be used to check arguments in wrapper script.
#a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser = ArgumentParser(
    description="Generate hillshade from tiles taking tile edges into account",
    prog=progname)
parser.add_argument("tile_name", help="Input 1km (dem) tile.")
parser.add_argument("outdir", help="Output directory for hillshades.")
parser.add_argument(
    "-tiledb",
    help="db - for now created with tile_coverage - of relevant tiles.")
parser.add_argument("-azimuth",
                    help="Specify azimuth, defaults to 315 degrees.",
                    type=float,
                    default=315.0)
parser.add_argument("-height",
                    help="Specify sun height, defaults to 45 degrees.",
                    type=float,
                    default=45.0)
parser.add_argument("-zfactor",
                    help="Specify z-factor (exaggeration)",
                    type=float,
Exemple #10
0
                      action="store_true",
                      help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
#add some arguments below
group = parser.add_mutually_exclusive_group()
group.add_argument(
    "-layername",
    help="Specify layername (e.g. for reference data in a database)")
group.add_argument(
    "-layersql",
    help=
    "Specify sql-statement for layer selection (e.g. for reference data in a database)",
    type=str)
parser.add_argument(
    "-class",
    dest="cut_to",
    type=int,
    default=cut_to,
    help="Inspect points of this class - defaults to 'terrain'")
parser.add_argument("las_file", help="input 1km las tile.")
parser.add_argument("road_data", help="input road reference data.")


def usage():
    parser.print_help()


def main(args):
    pargs = parser.parse_args(args[1:])
    lasname = pargs.las_file
    roadname = pargs.road_data
    cut = pargs.cut_to
Exemple #11
0
import sys
import time
from utils.osutils import ArgumentParser

import numpy as np

import dhmqc_constants as constants
from thatsDEM import pointcloud

CELL_SIZE = 1.0
PROGNAME = os.path.basename(__file__).replace(".pyc", ".py")

parser = ArgumentParser(
    description="Write a grid with cells representing most frequent class.",
    prog=PROGNAME)
parser.add_argument("las_file", help="Input las tile.")
parser.add_argument("output_dir", help="output directory of class grids.")
parser.add_argument("-cs",
                    type=float,
                    help="Cellsize (defaults to {0:.2f})".format(CELL_SIZE),
                    default=CELL_SIZE)
parser.add_argument(
    '-cls',
    help='''class number to count. Default is "all",
          otherwise valid input is a comma-separated list of class numbers,
          e.g. 0,1,2,3,7,8,10''',
    default=None,
    type=str,
)
parser.add_argument('-nd_val',
                    help='NODATA value, defaults to 0',
Exemple #12
0
# LIMITS FOR STEEP TRIANGLES... will also imply limits for angles...
XY_MAX = 1.5  # flag triangles larger than this as invalid
Z_MIN = 0.4

# pylint: disable=invalid-name
parser = ArgumentParser(description="Check for steepnes along road center lines.", prog=PROGNAME)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument(
    "-use_local",
    action="store_true",
    help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
parser.add_argument(
    "-class",
    dest="cut_class",
    type=int,
    default=constants.terrain,
    help="Inspect points of this class - defaults to 'terrain'")
parser.add_argument(
    "-zlim",
    dest="zlim",
    type=float,
    default=Z_MIN,
    help="Specify the minial z-size of a steep triangle.")
parser.add_argument("-runid", dest="runid", help="Set run id for the database...")
layer_group = parser.add_mutually_exclusive_group()
layer_group.add_argument(
    "-layername",
    help="Specify layername (e.g. for reference data in a database)")
layer_group.add_argument(
    "-layersql",
Exemple #13
0
from utils.osutils import ArgumentParser  #If you want this script to be included in the test-suite use this subclass. Otherwise argparse.ArgumentParser will be the best choice :-)
#path to geoid
GEOID_GRID=os.path.join(os.path.dirname(__file__),"..","data","dkgeoid13b_utm32.tif")
#The class(es) we want to look at...
CUT_CLASS=constants.terrain

#Default buffer size for cutlines (roads...)
BUF=30
#TODO: migrate to new argparse setup
progname=os.path.basename(__file__).replace(".pyc",".py")
#a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser=ArgumentParser(description="Check accuracy relative to GCPs - we assume here that GCPs are very sparse, otherwise use the z_accuracy script.",prog=progname)
db_group=parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",action="store_true",help="Force use of local database for reporting.")
db_group.add_argument("-schema",help="Specify schema for PostGis db.")
parser.add_argument("-class",dest="cut_to",type=int,default=CUT_CLASS,help="Specify ground class for input las file (will use default defined in constants).")

parser.add_argument("-toE",action="store_true",help="Warp the points from dvr90 to ellipsoidal heights.")
parser.add_argument("-z",help="z attribute of reference point layer (defaults to 'Z')",default="Z")
parser.add_argument("-debug",action="store_true",help="Turn on extra verbosity...")
group = parser.add_mutually_exclusive_group()
group.add_argument("-layername",help="Specify layername (e.g. for reference data in a database)")
group.add_argument("-layersql",help="Specify sql-statement for layer selection (e.g. for reference data in a database)",type=str)
parser.add_argument("las_file",help="input 1km las tile.")
parser.add_argument("ref_data",help="Reference data (path, connection string etc).")

def usage():
	parser.print_help()


Exemple #14
0
#Argument handling - if module has a parser attributte it will be used to check arguments in wrapper script.
#a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser = ArgumentParser(
    description=
    "Find steep triangles (in water class by default). Large triangles will be ignored...",
    prog=progname)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",
                      action="store_true",
                      help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
#add some arguments below
parser.add_argument("-class",
                    dest="cut_to",
                    type=int,
                    default=cut_to,
                    help="Inspect points of this class - defaults to 'water'")
parser.add_argument(
    "-zmin",
    type=float,
    default=zmin,
    help=
    "Specify minimal z-distance to mean for a point that isn't flat. Defaults to %.2f m"
    % zmin)
parser.add_argument(
    "-frad",
    type=float,
    default=frad,
    help=
    "Specify the filtering radius in which to calculate mean. Defaults to %.2f m"
Exemple #15
0
import dhmqc_constants as constants

# If you want this script to be included in the test-suite use this subclass.
# Otherwise argparse.ArgumentParser will be the best choice :-)
from utils.osutils import ArgumentParser

# To always get the proper name in usage / help - even when called from a wrapper...
progname=os.path.basename(__file__).replace(".pyc",".py")

#RESOLUTION=1.0 #spacing between lines

# Argument handling - if module has a parser attribute it will be used to check arguments in wrapper script.
# a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser =  ArgumentParser(description="Apply hydrological modifications ('horse shoes', 3d lines) to DTM.",prog=progname)
parser.add_argument("-horsesql",   help = "sql to select relevant horseshoes",type=str)
parser.add_argument("-linesql_own_z",help="sql to select 3d lines where the features z coordinate will be burnt.",type=str)
parser.add_argument("-linesql_dtm_z",help="sql to select lines where the values to be burn will be fetched from the DTM in the lines endpoints.",type=str)
parser.add_argument("-burn_as_lines",action="store_true",help="burn by generating a lot of 3d lines! Else use projective transformations.")
parser.add_argument("dem_tile",  help = "1km dem tile to be generated.")
parser.add_argument("vector_ds",  help = "input connection string for database containing layers to be burnt.")
parser.add_argument("dem_all",   help = "Seamless dem covering all tiles (vrt or similar)")
parser.add_argument("outdir",    help = "Output directory for resulting DEM files")
parser.add_argument("-overwrite", action="store_true",   help = "Do something!")
parser.add_argument("-debug", action="store_true",   help = "Do something!")



# A usage function will be imported by wrapper to print usage for test
# otherwise ArgumentParser will handle that...
def usage():
Exemple #16
0
# To always get the proper name in usage / help - even when called from a wrapper...
progname = os.path.basename(__file__).replace(".pyc", ".py")

# Argument handling - if module has a parser attributte it will be used to check arguments in wrapper script.
# a simple subclass of argparse,ArgumentParser which raises an exception
# in stead of using sys.exit if supplied with bad arguments...
parser = ArgumentParser(
    description="Find regions with low density or large pointdistance.",
    prog=progname)

# add some arguments below

parser.add_argument(
    "-class",
    type=int,
    default=5,
    help=
    "Specify ground class in reference pointcloud. Defaults to 5 (dhm-2007).",
)
parser.add_argument(
    "-cs",
    type=float,
    default=2.5,
    help="Specify gridsize for clustering points. Defaults to 2.5",
)
parser.add_argument(
    "-nlim",
    type=int,
    default=8,
    help=
    "Specify limit for number of points an interesting 'patch' must contain. Defaults to 8.",
Exemple #17
0
    prog=progname)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",
                      action="store_true",
                      help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
#add some arguments below
group = parser.add_mutually_exclusive_group()
group.add_argument(
    "-class",
    dest="cut_to",
    type=int,
    default=b_class,
    help="Inspect points of this class - defaults to 'building'")
group.add_argument("-height", type=float, help="Specify the cut off height.")
parser.add_argument("las_file", help="input las tile.")


def usage():
    parser.print_help()


def main(args):
    pargs = parser.parse_args(args[1:])
    lasname = pargs.las_file
    use_local = pargs.use_local
    if pargs.schema is not None:
        report.set_schema(pargs.schema)
    if pargs.height is not None:
        reporter = report.ReportClouds(use_local)
        CS = 4
Exemple #18
0
BUF_SIZE = 3
#TODO: migrate to new argparse setup
progname = os.path.basename(__file__).replace(".pyc", ".py")
#a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser = ArgumentParser(
    description="Check accuracy relative to reference data pr. strip.",
    prog=progname)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",
                      action="store_true",
                      help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
parser.add_argument(
    "-class",
    dest="cut_to",
    type=int,
    default=CUT_CLASS,
    help=
    "Specify ground class for input las file (will use default defined in constants)."
)

parser.add_argument("-toE",
                    action="store_true",
                    help=" Warp the points from dvr90 to ellipsoidal heights.")
parser.add_argument(
    "-ftype",
    help=
    "Specify feature type name for reporting (will otherwise be determined from reference data type)"
)
group = parser.add_mutually_exclusive_group()
group.add_argument(
    "-layername",
Exemple #19
0
HOR[:, :, 1] = 1

z_min = 3  # height above "ground" component in order to be interesting...
adddsm = 1.5  # add something to dsm to avoid some floating trees...
max_cor = 6

# To always get the proper name in usage / help - even when called from a wrapper...
progname = os.path.basename(__file__).replace(".pyc", ".py")

parser = ArgumentParser(
    description="Voxelise a point cloud and find floating vegetation class components.",
    prog=progname)

parser.add_argument(
    "-voxelh",
    type=float,
    default=z_min,
    help="Specify the minial (voxel) height of a floating voxel. Default: {0:d}".format(z_min))

parser.add_argument(
    "-maxcor",
    type=int,
    default=max_cor,
    help='''Specify maximal correlation of an interesting voxel using a 3x3x3 structure element.
            Default: {0:d}'''.format(max_cor))

parser.add_argument(
    "-savedsm",
    action="store_true",
    help="Save ground+building dsm for debugging.")
Exemple #20
0
PROGNAME = os.path.basename(__file__).replace(".pyc", ".py")

parser = ArgumentParser(
    description="Report height statistics for a specific class in polygons",
    prog=PROGNAME)

db_group = parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",
                      action="store_true",
                      help="Force use of local database for reporting.")

db_group.add_argument("-schema", help="Specify schema for PostGis db.")

parser.add_argument(
    "-class",
    type=int,
    default=CUT_TO,
    dest="ccut",
    help="Inspect points of this class - defaults to 'building'")

parser.add_argument("-nowarp",
                    action="store_true",
                    help='''Pointcloud is already in dvr90 - so do not warp.
            Default is to assume input is in ellipsoidal heights.''')

layer_group = parser.add_mutually_exclusive_group()
layer_group.add_argument(
    "-layername",
    help="Specify layername (e.g. for reference data in a database)")

layer_group.add_argument("-layersql",
                         help='''Specify sql-statement for layer selection
Exemple #21
0
SRS = osr.SpatialReference()
SRS.ImportFromEPSG(constants.EPSG_CODE)
SRS_WKT = SRS.ExportToWkt()
CUT_TO = [constants.terrain, constants.water, constants.bridge]
CELL_SIZE = 1.0  #100 m cellsize in density grid
TILE_SIZE = constants.tile_size  #1000  yep - its 1km tiles...
GRIDS_OUT = "distance_grids"  #due to the fact that this is being called from qc_wrap it is easiest to have a standard folder for output...
SRAD = 4.0

progname = os.path.basename(__file__).replace(".pyc", ".py")

#Argument handling - if module has a parser attributte it will be used to check arguments in wrapper script.
#a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser = ArgumentParser(description="Calculate point distance", prog=progname)
parser.add_argument("las_file", help="input 1km las tile.")
parser.add_argument("-cs",
                    type=float,
                    help="Specify cell size of grid, defaults to " +
                    str(CELL_SIZE),
                    default=CELL_SIZE)
parser.add_argument("-nocut",
                    action="store_true",
                    help="Do NOT cut to default terrain grid classes.")
parser.add_argument("-srad",
                    type=float,
                    help="Search radius for points. Defaults to " + str(SRAD),
                    default=SRAD)
parser.add_argument("-outdir",
                    help="Specify output directory. Defaults to " + GRIDS_OUT,
                    default=GRIDS_OUT)
Exemple #22
0
from utils.osutils import ArgumentParser
import laspy

import dhmqc_constants as constants
from utils.wmsfetch import get_georef_image_wms

PDAL = 'pdal'

progname = os.path.basename(__file__).replace(".pyc", ".py")

parser = ArgumentParser(
    description='Add RGB-values from a WMS to near-black points in las-files',
    prog=progname)

parser.add_argument('las_file', help='Input las file')
parser.add_argument('out_dir', help='Output directory')
parser.add_argument('-wms_url', help='URL to WMS Capabilitites file')
parser.add_argument('-wms_layer', default='', help='Layer from WMS service')
parser.add_argument('-px_size',
                    type=float,
                    default=1.0,
                    help='Pixel size of retrived WMS image')


def usage():
    parser.print_help()


def create_pdal_pipeline(json_out, las_in, las_out, raster):
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",
                      action="store_true",
                      help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
#add some arguments below
group = parser.add_mutually_exclusive_group()
group.add_argument(
    "-layername",
    help="Specify layername (e.g. for reference data in a database)")
group.add_argument(
    "-layersql",
    help=
    "Specify sql-statement for layer selection (e.g. for reference data in a database)",
    type=str)
parser.add_argument("-debug", help="debug", action="store_true")
parser.add_argument("las_file", help="input 1km las tile.")
parser.add_argument(
    "poly_data",
    help=
    "input reference data connection string (e.g to a db, or just a path to a shapefile)."
)


def usage():
    parser.print_help()


#hmmm - np.dot is just weird - might be better to use that though...
def helmert2d(xy1, xy2):
    N1 = (xy1**2).sum()
Exemple #24
0
CS_BURN = 0.4
CS_BURN_BUILD = 0.2  # finer granularity - consider shrinking slightly
OLD_TERRAIN = 5  # old terrain class from 2007
SPIKE_CLASS = 1  # to unclass
RECLASS_DEFAULT = 18  # high noise
BUILDING_RECLASS = { # reclassification inside buildings:
    constants.terrain: 19,
    constants.low_veg: 20,
    }

parser = ArgumentParser(
    description='''Perform a range of classification modifications in one go.
                   Do NOT read and write from the same disk!''',
    prog=PROGNAME,
)
parser.add_argument('las_file', help='input 1km las tile.')
parser.add_argument(
    'outdir',
    help='Resting place of modified input file.',
)
# The json definition must be a list of tasks - each element must be a
# list of two elements  (name,  definition) where name is one of the valid
# tasks (see below) and definition is a relevant dict for the task (as
# above)
parser.add_argument(
    '-json_tasks',
    help='''json string/file specifying what to be done.
            Must define a list of tasks (see source).
            If not given an unmodified las file is returned.''',
)
parser.add_argument('-olaz',
Exemple #25
0
parser = ArgumentParser(
    description="Apply hydrological modifications ('horse shoes') to DTM.",
    prog=progname)
group = parser.add_mutually_exclusive_group()
group.add_argument(
    "-layername",
    help="Specify layername (e.g. for reference data in a database)")
group.add_argument(
    "-layersql",
    help=
    "Specify sql-statement for layer selection (e.g. for reference data in a database). "
    + vector_io.EXTENT_WKT +
    " can be used as a placeholder for wkt-geometry of area of interest - in order to enable a significant speed up of db queries",
    type=str)

parser.add_argument("dem_tile", help="1km dem tile to be generated.")
parser.add_argument("horse_ds",
                    help="input connection string for horse shoe database")
parser.add_argument("dem_all",
                    help="Seamless dem covering all tiles (vrt or similar)")
parser.add_argument("outdir", help="Output directory for resulting DEM files")
parser.add_argument("-debug", help="Show triangulations!")


# A usage function will be imported by wrapper to print usage for test
# otherwise ArgumentParser will handle that...
def usage():
    parser.print_help()


TARGET = np.array((0, 0, 1, 0, 1, 1, 0, 1), dtype=np.float64)
Exemple #26
0
from utils.osutils import ArgumentParser

# To always get the proper name in usage / help - even when called from a
# wrapper...
progname = os.path.basename(__file__).replace(".pyc", ".py")

# Argument handling - if module has a parser attributte it will be used to check
# arguments in wrapper script.

# A simple subclass of argparse.ArgumentParser which raises an exception instead
# of using sys.exit if supplied with bad arguments...
parser = ArgumentParser(description="Compress las to laz files using an sqlite index",
                        prog=progname)

# Add some arguments below
parser.add_argument("las_file", help="input 1km las tile.")
parser.add_argument("out_dir", help="Output directory (root) for laz file.")


# A usage function will be imported by wrapper to print usage for test
# otherwise ArgumentParser will handle that...
def usage():
    parser.print_help()


def main(args):
    try:
        pargs = parser.parse_args(args[1:])
    except Exception as e:
        print(str(e))
        return 1
xy_tolerance = 1.0
z_tolerance = 1.0
angle_tolerance = 60

progname = os.path.basename(__file__).replace(".pyc", ".py")
#a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser = ArgumentParser(description="Check strip overlap on buildings.",
                        prog=progname)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",
                      action="store_true",
                      help="Force use of local database for reporting.")
db_group.add_argument("-schema", help="Specify schema for PostGis db.")
parser.add_argument(
    "-class",
    dest="cut_to",
    type=int,
    default=cut_to,
    help="Inspect points of this class - defaults to 'building' and 'surface'")
group = parser.add_mutually_exclusive_group()
group.add_argument(
    "-layername",
    help="Specify layername (e.g. for reference data in a database)")
group.add_argument(
    "-layersql",
    help=
    "Specify sql-statement for layer selection (e.g. for reference data in a database)",
    type=str)
parser.add_argument("las_file", help="input 1km las tile.")
parser.add_argument(
    "build_data",
    help="input building reference data (path or connection string).")
Exemple #28
0
import json

from utils.osutils import ArgumentParser

import dhmqc_constants as constants

PDAL = 'pdal'

progname=os.path.basename(__file__).replace(".pyc",".py")

parser = ArgumentParser(
    description='Reproject coordinates in a LAS file.',
    prog=progname
)

parser.add_argument('las_file', help='Input las file')
parser.add_argument('out_dir', help='Output directory')
parser.add_argument(
    '-in_srs',
    default=None,
    help='''Spatial reference of coordinates in input LAS file. Can be any SRS accepted by GDAL.
            Optional when a spatial reference already exists in the input LAS file.''',
)
parser.add_argument(
    '-out_srs',
    required=True,
    help='Spatial reference of coordinates in output LAS file. Can be any SRS accepted by GDAL.',
)
parser.add_argument(
    '-a_srs',
    required=True,
Exemple #29
0
from utils.osutils import ArgumentParser  #If you want this script to be included in the test-suite use this subclass. Otherwise argparse.ArgumentParser will be the best choice :-)
#path to geoid
GEOID_GRID=os.path.join(os.path.dirname(__file__),"..","data","dkgeoid13b_utm32.tif")
#The class(es) we want to look at...
CUT_CLASS=constants.terrain

#Default buffer size for cutlines (roads...)
BUF=30
#TODO: migrate to new argparse setup
progname=os.path.basename(__file__).replace(".pyc",".py")
#a simple subclass of argparse,ArgumentParser which raises an exception in stead of using sys.exit if supplied with bad arguments...
parser=ArgumentParser(description="Check for outliers for each node in 3d line features",prog=progname)
db_group=parser.add_mutually_exclusive_group()
db_group.add_argument("-use_local",action="store_true",help="Force use of local database for reporting.")
db_group.add_argument("-schema",help="Specify schema for PostGis db.")
parser.add_argument("-class",dest="cut_to",type=int,default=CUT_CLASS,help="Specify ground class for input las file (will use default defined in constants).")
parser.add_argument("-id_attr",help="Specify id attribute to identify a line.")
parser.add_argument("-toH",action="store_true",help="Warp the pointcloud from ellipsoidal heights to dvr90.")
parser.add_argument("-zlim",type=float,default=1.0,help="Only report points that differ this much. Defaults to 1.0 m")
parser.add_argument("-srad",type=float,default=2.0,help="Use this search radius when interpolating (idw) in pointcloud. Defaults to 2.0 m")
parser.add_argument("-ndval",type=float,default=-999,help="Specify no-data value for line nodes (will be skipped). Defaults to -999")
parser.add_argument("-debug",action="store_true",help="Turn on extra verbosity...")
group = parser.add_mutually_exclusive_group()
group.add_argument("-layername",help="Specify layername (e.g. for reference data in a database)")
group.add_argument("-layersql",help="Specify sql-statement for layer selection (e.g. for reference data in a database)",type=str)
parser.add_argument("las_file",help="input 1km las tile.")
parser.add_argument("ref_data",help="Reference data (path, connection string etc).")

def usage():
    parser.print_help()
Exemple #30
0
DEBUG = "-debug" in sys.argv
PROGNAME = os.path.basename(__file__).replace(".pyc", ".py")

parser = ArgumentParser(
    description="Generate class statistics for input polygons.",
    prog=PROGNAME)
db_group = parser.add_mutually_exclusive_group()
db_group.add_argument(
    "-use_local",
    action="store_true",
    help="Force use of local database for reporting.")
db_group.add_argument(
    "-schema",
    help="Specify schema for PostGis db.")
parser.add_argument(
    "-type",
    choices=['building', 'lake', 'bridge'],
    help="Specify the type of polygon, e.g. building, lake, bridge - used to generate views.")
parser.add_argument(
    "-below_poly",
    action="store_true",
    help="Restrict to points which lie below the mean z of the input polygon(s).")
parser.add_argument(
    "-toE",
    action="store_true",
    help=
    '''Warp the polygon from dvr90 to ellipsoidal heights.
    Only makes sense if -below_poly is used.''')
layer_group = parser.add_mutually_exclusive_group()
layer_group.add_argument(
    "-layername",
    help="Specify layername (e.g. for reference data in a database)")