示例#1
0
import numpy as np

from thatsDEM import pointcloud, vector_io, array_geometry
from db import report
import dhmqc_constants as constants
from 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",
示例#2
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=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()
	

示例#3
0
文件: template.py 项目: kbevers/DHMQC
# If you want this script to be included in the test-suite use this subclass.
# Otherwise argparse.ArgumentParser will be the best choice :-)
# utils.osutils.Argumentparser is a simple subclass of argparse.ArgumentParser
# which raises an exception instead of using sys.exit if supplied with bad arguments...
from utils.osutils import ArgumentParser

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.")
示例#4
0
import dhmqc_constants as constants
from utils.osutils import ArgumentParser
from 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(
示例#5
0
from __future__ import print_function

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()
示例#6
0
cut_ground = [constants.water, constants.terrain, constants.bridge]
floating_class = [constants.low_veg, constants.med_veg, constants.high_veg]
extended_ground = cut_ground + floating_class  # this is what we should find connected components in
surf_without_veg = cut_ground + [constants.building]
HOR = np.zeros((3, 3, 3), dtype=np.uint8)
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))
示例#7
0
import shutil
import numpy as np
from osgeo import gdal, ogr
import dhmqc_constants as constants
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 :-)

#####################################################################################
##  Burn horse shoes by generating 3d lines. Would be better to generate and store the lines and then just use gdal_rasterize.
#####################################################################################

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=
    "Burn horse shoes by generating 3d lines. Would be better to generate and store the lines and then just use gdal_rasterize.",
    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="input 1km dem tile.")
parser.add_argument("horse_ds",
                    help="input connection string for horse shoe database")
示例#8
0
#
import sys, os, time
#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",
示例#9
0
BUF_RAD = 2.5
CS_FINAL_GRID = 1.0
FRAD_FINAL_GRID = 2.5
MAX_AREA = 250 * 250  # areas larger than this will only be marked - something else must be wrong!

cut_to = [constants.terrain, constants.water, constants.bridge]
GEOID_GRID = os.path.join(os.path.dirname(__file__), "..", "data",
                          "dkgeoid13b_utm32.tif")
# 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,
示例#10
0
import os
import sys
import time
from datetime import datetime, timedelta

import numpy as np
import laspy

import dhmqc_constants as constants
from utils.osutils import ArgumentParser
from db import report

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

parser = ArgumentParser(
    description="Report date statistics to database.",
    prog=PROGNAME)
parser.add_argument("las_file", help="Input las tile.")

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.")

def usage():
    '''
示例#11
0
import laspy

from thatsDEM import vector_io
from db import report
from utils.osutils import ArgumentParser
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,
)
示例#12
0
import os
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,
)
示例#13
0
from __future__ import print_function

import sys
import os
import time

import dhmqc_constants as constants
from thatsDEM import pointcloud
from db import report
from dhmqc_constants import get_tilename
from dhmqc_constants import tilename_to_extent
from 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()
示例#14
0
from utils.osutils import ArgumentParser

#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)
示例#15
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.")
示例#16
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)."
)
示例#17
0
import numpy as np
#import pyspatialite.dbapi2 as db
import psycopg2 as db
import dhmqc_constants as constants
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 :-)
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",
示例#18
0
from thatsDEM import array_geometry
from thatsDEM import grid
from db import report
from utils.osutils import ArgumentParser

#z_min = 1.0
CUT_TO = constants.building

# Path to geoid grid
GEOID_GRID = os.path.join(os.path.dirname(__file__), "..", "data",
                          "dkgeoid13b_utm32.tif")
# 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="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'")
示例#19
0
from thatsDEM import pointcloud
from db import report
import dhmqc_constants as constants
from 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",
示例#20
0
import subprocess
import time
import json

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()
示例#21
0
import math

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,
示例#22
0
HAYSTACK = os.path.realpath(
    os.path.join(os.path.dirname(__file__), 'bin', 'haystack'))
PROGNAME = os.path.basename(__file__).replace('.pyc', '.py')
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).
示例#23
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)",
示例#24
0
文件: compress.py 项目: kbevers/DHMQC
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")

# 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:])
示例#25
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 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="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",
示例#26
0
import sys
import os
import subprocess
import time
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.',
)
示例#27
0
import sys, os
import numpy as np
import zcheck_base
import dhmqc_constants as const
from db import report
from utils.osutils import ArgumentParser
DEBUG = "-debug" in sys.argv

cut_to = [const.building, const.surface]
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)")
示例#28
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...
示例#29
0
from osgeo import ogr
from thatsDEM import pointcloud,vector_io,array_geometry,array_factory,grid
from db import report
import dhmqc_constants as constants
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).")
示例#30
0
from osgeo import ogr
from thatsDEM import pointcloud,vector_io,array_geometry,array_factory,grid
from db import report
import dhmqc_constants as constants
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():