def createRefDTMMosaic(in_md_path, out_md_path, v_unit):
    a = datetime.now()
    if arcpy.Exists(out_md_path):
        arcpy.AddMessage("Referenced mosaic dataset exists " + out_md_path)
    else:
        arcpy.CreateReferencedMosaicDataset_management(in_dataset=in_md_path, out_mosaic_dataset=out_md_path, where_clause="TypeID = 1")
        
        raster_function_path = Raster.Contour_Meters_function_chain_path
        v_unit = str(v_unit).upper()
        if v_unit.find("FEET") >= 0 or v_unit.find("FOOT") >= 0 or  v_unit.find("FT") >= 0:
            raster_function_path = Raster.Contour_IntlFeet_function_chain_path
            #if v_unit.find("INTL") >= 0 or v_unit.find("INTERNATIONAL") >= 0 or v_unit.find("STANDARD") >= 0 or v_unit.find("STD") >= 0:
            #    raster_function_path = Raster.Contour_IntlFeet_function_chain_path
            if v_unit.find("US") >= 0 or v_unit.find("SURVEY") >= 0:
                arcpy.AddMessage("Using US FOOT Raster Function")
                raster_function_path = Raster.Contour_Feet_function_chain_path
            else:
                arcpy.AddMessage("Using INT FOOT Raster Function")
        else:
            arcpy.AddMessage("Using METER Raster Function")
                
        arcpy.EditRasterFunction_management(in_mosaic_dataset=out_md_path, edit_mosaic_dataset_item="EDIT_MOSAIC_DATASET", edit_options="REPLACE", function_chain_definition=raster_function_path, location_function_name="")
        Utility.addToolMessages()
        
        arcpy.CalculateStatistics_management(in_raster_dataset=out_md_path, x_skip_factor=SKIP_FACTOR, y_skip_factor=SKIP_FACTOR, ignore_values="", skip_existing="OVERWRITE", area_of_interest="Feature Set")
    
        doTime(a, "Created referenced mosaic dataset " + out_md_path)
Exemplo n.º 2
0
def createReferenceddMosaicDataset(in_md_path, out_md_path, spatial_ref,
                                   raster_v_unit):
    a = datetime.datetime.now()
    arcpy.CreateReferencedMosaicDataset_management(
        in_dataset=in_md_path,
        out_mosaic_dataset=out_md_path,
        coordinate_system=spatial_ref,
        number_of_bands="1",
        pixel_type="32_BIT_SIGNED",
        where_clause="",
        in_template_dataset="",
        extent="",
        select_using_features="SELECT_USING_FEATURES",
        lod_field="",
        minPS_field="",
        maxPS_field="",
        pixelSize="",
        build_boundary="BUILD_BOUNDARY")

    raster_function_path = Raster.Canopy_Density_function_chain_path

    arcpy.EditRasterFunction_management(
        in_mosaic_dataset=out_md_path,
        edit_mosaic_dataset_item="EDIT_MOSAIC_DATASET",
        edit_options="REPLACE",
        function_chain_definition=raster_function_path,
        location_function_name="")
    Utility.addToolMessages()

    # arcpy.CalculateStatistics_management(in_raster_dataset=out_md_path, x_skip_factor="1", y_skip_factor="1", ignore_values="", skip_existing="OVERWRITE", area_of_interest="Feature Set")

    arcpy.AddMessage(
        "\tNOTE: !!! Please edit the MR Point Density function. Change to replace input to 'Multiply LAST by 100' with this project's POINT_COUNT_LAST mosaic dataset.\n\n\t{}\n"
        .format(out_md_path))
    doTime(a, "Created DHM '{}'".format(out_md_path))
Exemplo n.º 3
0
    def createReferencedMD(self):
        self.log("Creating reference mosaic datasets:",
                 self.const_general_text)

        for k in self.dic_derive_lst.keys():

            for r in self.dic_derive_lst[k]['ref'].keys():

                try:
                    mdPath = os.path.join(self.m_base.m_geoPath, r)

                    inMosaic = self.dic_derive_lst[k]['key']
                    refMosaic = os.path.join(self.m_base.m_geoPath, r)

                    self.log("Creating MD:" + r, self.const_general_text)

                    if not arcpy.Exists(mdPath):
                        try:
                            if (len(self.dic_ref_info) > 0):

                                in_dataset = self.m_base.getInternalPropValue(
                                    self.dic_ref_info, 'in_dataset')
                                _p, _f = os.path.split(in_dataset)
                                if (_p == '' and _f != ''):
                                    in_dataset = os.path.join(
                                        self.m_base.m_geoPath, _f)

                                arcpy.CreateReferencedMosaicDataset_management(
                                    in_dataset, refMosaic, self.srs,
                                    self.m_numBands, self.pixel_type,
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info, 'where_clause'),
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info,
                                        'in_template_dataset'),
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info, 'extent'),
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info,
                                        'select_using_features'),
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info, 'lod_field'),
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info, 'minPS_field>'),
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info, 'maxPS_field>'),
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info, 'pixelSize'),
                                    self.m_base.getInternalPropValue(
                                        self.dic_ref_info, 'build_boundary'))
                            else:
                                arcpy.CreateReferencedMosaicDataset_management(
                                    inMosaic, refMosaic, self.srs, "",
                                    self.pixel_type, "", "", "", "", "", "",
                                    "", "", "NO_BOUNDARY")
                        except:
                            self.log("\tFailed to create refrence MD  " + r,
                                     self.const_warning_text)
                            self.log(arcpy.GetMessages(),
                                     self.const_warning_text)

                    first_time = True
                    for fnc in self.dic_derive_lst[k]['ref'][r]:
                        self.log(
                            "\t\tAdding raster function: " + r + '->' +
                            os.path.basename(fnc), self.const_general_text)
                        try:
                            arcpy.EditRasterFunction_management(
                                refMosaic, "EDIT_MOSAIC_DATASET",
                                "REPLACE" if first_time else "INSERT", fnc)
                            first_time = False
                        except:
                            self.log(
                                "\t\t\tFailed to add raster function  " + fnc,
                                self.const_warning_text)
                            self.log(arcpy.GetMessages(),
                                     self.const_warning_text)
                except Exception as inst:
                    self.log(
                        "Failed to create/edit raster function reference mosaic dataset: "
                        + r, self.const_critical_text)
                    self.log(arcpy.GetMessages(), self.const_critical_text)
                    return False

        return True
Exemplo n.º 4
0
 def createreference(self, omosaic):
     arcpy.CreateReferencedMosaicDataset_management(self.fname,
                                                    omosaic.fname)
     DisplayMessages()