Example #1
0
import laspy

from qc.thatsDEM import vector_io
from qc.db import report
from qc.utils.osutils import ArgumentParser
from . import dhmqc_constants as constants

ALL_LAKE = -2  # signal density that all is lake...
CELL_SIZE = 100.0  # 100 m cellsize in density grid
TILE_SIZE = constants.tile_size  # should be 1km tiles...
GRIDS_OUT = "density_grids"
PROGNAME = os.path.basename(__file__).replace(".pyc", ".py")
ND_VAL = -9999

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,
)
Example #2
0
from qc.thatsDEM import vector_io
from qc.thatsDEM import array_geometry
from qc.thatsDEM import grid
from qc.db import report

# Sensible z-limits for detecting when a 3d-feature seems to be OK.
# Used in below_poly - note: Ellipsoidal heights
SENSIBLE_Z_MIN = constants.z_min_terrain
SENSIBLE_Z_MAX = constants.z_max_terrain + 35

GEOID_GRID = os.path.join(os.path.dirname(__file__), "..", "data",
                          "dkgeoid13b.utm32")
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=
Example #3
0
#SOME GLOBALS WHICH SHOULD BE PLACED IN A CONSTANTS MODULE


xy_tolerance=1.5
z_tolerance=0.25
angle_tolerance=25
buffer_dist=2.0

cut_to=const.terrain

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="Check strip overlaps along roads.",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("-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()
Example #4
0
from builtins import str
import sys
import os
import time

from . import dhmqc_constants as constants
from qc.thatsDEM import pointcloud
from qc.db import report
from qc.dhmqc_constants import get_tilename
from qc.dhmqc_constants import tilename_to_extent
from qc.utils.osutils import ArgumentParser

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

parser = ArgumentParser(description="Count points per class in a tile",
                        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("las_file", help="input las tile.")


def usage():
    '''
    Print help text from argument parser.
    '''
    parser.print_help()
Example #5
0
    import matplotlib
    matplotlib.use("Qt4Agg")
    import matplotlib.pyplot as plt
    from mpl_toolkits.mplot3d import Axes3D

#some global params for finding house edges...
cut_angle = 45.0
z_limit = 2.0
cut_to_classes = [constants.terrain, constants.surface, constants.building]

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=
    "Check accuracy relative to input polygons by finding house corners.",
    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(
    "-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)",
Example #6
0
from qc.thatsDEM import pointcloud
from qc.db import report
from . import dhmqc_constants as constants
from qc.utils.osutils import ArgumentParser

CUT_TO = constants.terrain  # default to terrain only...
SLOPE_MIN = 25  # minumum this in degrees
ZLIM = 0.1  # minimum this in meters
FILTER_RAD = 1.5

# 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",
Example #7
0
from . import dhmqc_constants as constants
from qc.utils.osutils import ArgumentParser
from qc.find_planes import plot3d, plot_intersections, find_planar_pairs, cluster

DEBUG = "-debug" in sys.argv
# z-interval to restrict the pointcloud to.
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(
Example #8
0
from math import tan, radians
import numpy as np
from . import dhmqc_constants as constants
from qc.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 :-)

cut_to = constants.water
zmin = 0.2
frad = 1.0  #filter radius
cs = 2.0  #default cell-size for polygonisation
#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 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,
Example #9
0
if DEBUG:
    import matplotlib
    matplotlib.use("Qt4Agg")
    import matplotlib.pyplot as plt
b_class = constants.building
TILE_SIZE = constants.tile_size  #1km blocks
dst_fieldname = 'DN'
default_min_z = -999999999
default_max_z = 999999999

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=
    "Polygonize areas with points of a specific class (typically buildings) OR above a specific height.",
    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.")
Example #10
0
#xy_tolerance
xy_tolerance = 2.0
#z_tolerance
z_tolerance = 1.0
#The class(es) we want to look at...
CUT_CLASS = constants.terrain
#The z-interval we want to consider for the input LAS-pointcloud...
Z_MIN = -20
Z_MAX = 200
#Default buffer size for cutlines (roads...)
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)."
)
Example #11
0
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
'''
REMOVED - DO NOT USE - This is a stub module that only exists to raise an error
asking the user to no longer use it.
'''
import os
from qc.utils.osutils import ArgumentParser

PROGNAME = os.path.basename(__file__).replace('.pyc', '.py')

parser = ArgumentParser(
    description='''REMOVED - DO NOT USE
                   
                   Perform a range of classification modifications in one go.
                   Note that using the same disk for both reading and writing
				   may cause poor performance.''',
    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.
Example #12
0
import numpy as np

from qc.thatsDEM import pointcloud, vector_io, array_geometry
from qc.db import report
from . import dhmqc_constants as constants
from qc.utils.osutils import ArgumentParser

PROGNAME = os.path.basename(__file__)
LINE_BUFFER = 1.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,
Example #13
0
from . import dhmqc_constants as constants
from qc.utils.osutils import ArgumentParser
from qc.thatsDEM import grid

PROGNAME = os.path.basename(__file__).replace(".pyc", ".py")
GEOID_GRID = os.path.realpath(
    os.path.join(
        os.path.dirname(__file__),
        "..",
        "data",
        "dkgeoid13b.utm32",
    ))

parser = ArgumentParser(
    description=
    "Warp las/laz file from ellipsoidal heights to orthometric heights.",
    prog=PROGNAME)
parser.add_argument("las_file", help="Input 1km las tile.")
parser.add_argument("outdir", help="Output folder.")


def usage():
    '''
    Usage function called by qc_wrap.py.
    '''
    parser.print_help()


def main(args):
    '''
    Core functionality. Called by qc_wrap.py and __file__