当前位置: 首页>>代码示例>>Python>>正文


Python arcpy.AddWarning方法代码示例

本文整理汇总了Python中arcpy.AddWarning方法的典型用法代码示例。如果您正苦于以下问题:Python arcpy.AddWarning方法的具体用法?Python arcpy.AddWarning怎么用?Python arcpy.AddWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在arcpy的用法示例。


在下文中一共展示了arcpy.AddWarning方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_TimeOfDay_field_to_sublayer

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def add_TimeOfDay_field_to_sublayer(nalayer, sublayer_object, sublayer_name):
    '''Add a field called TimeOfDay of type DATE to an NA sublayer'''
    time_field = "TimeOfDay"

    # Clean up any pre-existing fields with this name (unlikely case)
    poly_fields = [f for f in arcpy.Describe(sublayer_object).fields if f.name == time_field]
    if poly_fields:
        for f in poly_fields:
            if f.name == time_field and f.type != "Date":
                msg = "Your network analysis layer's %s sublayer already contained a field called %s of a type " + \
                      "other than Date.  This field will be deleted and replaced with a field of type Date used " + \
                      "for the output of this tool."
                arcpy.AddWarning(msg % (sublayer_name, time_field))
                arcpy.management.DeleteField(sublayer_object, time_field)

    # Add the TimeOfDay field to the sublayer.  If it already exists, this will do nothing.
    arcpy.na.AddFieldToAnalysisLayer(nalayer, sublayer_name, time_field, "DATE")

    return time_field 
开发者ID:Esri,项目名称:public-transit-tools,代码行数:21,代码来源:AnalysisHelpers.py

示例2: featuresToGPX

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def featuresToGPX(inputFC, outGPX, zerodate, pretty):
    ''' This is called by the __main__ if run from a tool or at the command line
    '''

    descInput = arcpy.Describe(inputFC)
    if descInput.spatialReference.factoryCode != 4326:
        arcpy.AddWarning("Input data is not projected in WGS84,"
                         " features were reprojected on the fly to create the GPX.")

    generatePointsFromFeatures(inputFC , descInput, zerodate)

    # Write the output GPX file
    try:
        if pretty:
            gpxFile = open(outGPX, "w")
            gpxFile.write(prettify(gpx))
        else:
            gpxFile = open(outGPX, "wb")
            ET.ElementTree(gpx).write(gpxFile, encoding="UTF-8", xml_declaration=True)
    except TypeError as e:
        arcpy.AddError("Error serializing GPX into the file.")
    finally:
        gpxFile.close() 
开发者ID:arcpy,项目名称:sample-gp-tools,代码行数:25,代码来源:FeaturesToGPX.py

示例3: output_msg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def output_msg(msg, severity=0):
    """ Adds a Message (in case this is run as a tool)
        and also prints the message to the screen (standard output)
        :param msg: text to output
        :param severity: 0 = none, 1 = warning, 2 = error
    """
    print msg
    # Split the message on \n first, so that if it's multiple lines,
    #  a GPMessage will be added for each line
    try:
        for string in msg.split('\n'):
            # Add appropriate geoprocessing message
            if severity == 0:
                arcpy.AddMessage(string)
            elif severity == 1:
                arcpy.AddWarning(string)
            elif severity == 2:
                arcpy.AddError(string)
    except:
        pass 
开发者ID:gdherbert,项目名称:DataPillager,代码行数:22,代码来源:DataServicePillager.py

示例4: update_package

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def update_package(r_library_path=r_lib_path()):
    """Update ArcGIS R bindings on this machine."""

    # check that we're in a sane installation environment
    validate_environment(overwrite=True)

    if r_pkg_version() is None:
        arcpy.AddWarning(
            "Package is not installed. First use the \"Install R bindings\" script.")
    else:
        if compare_release_versions():
            arcpy.AddMessage("New release detected! Installing.")
            install_package(overwrite=True, r_library_path=r_library_path)
        else:
            msg = "The installed ArcGIS R package (version " + \
                  "{}) is the current version on GitHub.".format(r_pkg_version())
            arcpy.AddMessage(msg)

# execute as standalone script, get parameters from sys.argv 
开发者ID:R-ArcGIS,项目名称:r-bridge-install,代码行数:21,代码来源:update_package.py

示例5: PrintMsg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def PrintMsg(msg, severity=0):
    # Adds tool message to the geoprocessor
    #
    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:
        for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
            if severity == 0:
                arcpy.AddMessage(string)

            elif severity == 1:
                arcpy.AddWarning(string)

            elif severity == 2:
                arcpy.AddError(" \n" + string)

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:22,代码来源:SSURGO_MergeSoilShapefiles.py

示例6: PrintMsg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def PrintMsg(msg, severity=0):
    # prints message to screen if run as a python script
    # Adds tool message to the geoprocessor
    #
    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:
        for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
            if severity == 0:
                arcpy.AddMessage(string)

            elif severity == 1:
                arcpy.AddWarning(string)

            elif severity == 2:
                arcpy.AddMessage("    ")
                arcpy.AddError(string)
                #arcpy.AddMessage("    ")

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:25,代码来源:GetDominantComponent.py

示例7: PrintMsg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def PrintMsg(msg, severity=0):
    # prints message to screen if run as a python script
    # Adds tool message to the geoprocessor
    #
    # Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:
        for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
            if severity == 0:
                arcpy.AddMessage(string)

            elif severity == 1:
                arcpy.AddWarning(string)

            elif severity == 2:
                arcpy.AddMessage("    ")
                arcpy.AddError(string)

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:24,代码来源:SSURGO_gSSURGO_byTile.py

示例8: PrintMsg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def PrintMsg(msg, severity=0):
    # Adds tool message to the geoprocessor
    #
    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:
        for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
            if severity == 0:
                arcpy.AddMessage(string)

            elif severity == 1:
                arcpy.AddWarning(string)

            elif severity == 2:
                arcpy.AddMessage("    ")
                arcpy.AddError(string)

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:23,代码来源:SSURGO_CheckgSSURGO.py

示例9: PrintMsg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def PrintMsg(msg, severity=0):
    # prints message to screen if run as a python script
    # Adds tool message to the geoprocessor
    #
    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:
        for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
            if severity == 0:
                arcpy.AddMessage(string)

            elif severity == 1:
                arcpy.AddWarning(string)

            elif severity == 2:
                arcpy.AddMessage("    ")
                arcpy.AddError(string)

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:24,代码来源:SSURGO_ExportMuRaster_Batch.py

示例10: AddMsgAndPrint

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def AddMsgAndPrint(msg, severity=0):
    # prints message to screen if run as a python script
    # Adds tool message to the geoprocessor
    #
    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:
        print msg

        #for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
        if severity == 0:
            arcpy.AddMessage(msg)

        elif severity == 1:
            arcpy.AddWarning(msg)

        elif severity == 2:
            arcpy.AddError("\n" + msg)

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:25,代码来源:Validate_Mapunit_Slope_Range.py

示例11: AddMsgAndPrint

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def AddMsgAndPrint(msg, severity=0):
    """prints messages to screen if the script is executed as
       a standalone script.  Otherwise, Adds tool message to the
       window geoprocessor.  Messages are color coded by severity."""

    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:
        print msg

        #for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
        if severity == 0:
            arcpy.AddMessage(msg)

        elif severity == 1:
            arcpy.AddWarning(msg)

        elif severity == 2:
            arcpy.AddError("\n" + msg)

    except:
        pass

## ================================================================================================================ 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:26,代码来源:AddNatMusym.py

示例12: AddMsgAndPrint

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def AddMsgAndPrint(msg, severity=0):
    # prints message to screen if run as a python script
    # Adds tool message to the geoprocessor
    #
    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:

        #print(msg)
        #for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
        if severity == 0:
            arcpy.AddMessage(msg)

        elif severity == 1:
            arcpy.AddWarning(msg)

        elif severity == 2:
            arcpy.AddError("\n" + msg)

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:25,代码来源:SDA_JSON_Testing.py

示例13: AddMsgAndPrint

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def AddMsgAndPrint(msg, severity=0):
    # prints message to screen if run as a python script
    # Adds tool message to the geoprocessor
    #
    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:

        #for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
        if severity == 0:
            arcpy.AddMessage(msg)

        elif severity == 1:
            arcpy.AddWarning(msg)

        elif severity == 2:
            arcpy.AddError("\n" + msg)

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:24,代码来源:Select_Mapunits_by_Project.py

示例14: AddMsgAndPrint

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddWarning [as 别名]
def AddMsgAndPrint(msg, severity=0):
    # prints message to screen if run as a python script
    # Adds tool message to the geoprocessor
    #
    #Split the message on \n first, so that if it's multiple lines, a GPMessage will be added for each line
    try:
        print msg

        #for string in msg.split('\n'):
            #Add a geoprocessing message (in case this is run as a tool)
        if severity == 0:
            arcpy.AddMessage(msg)

        elif severity == 1:
            arcpy.AddWarning(msg)

        elif severity == 2:
            arcpy.AddError(msg)

    except:
        pass

## =================================================================================== 
开发者ID:ncss-tech,项目名称:geo-pit,代码行数:25,代码来源:compareNASIStables_pedonGDBTable.py


注:本文中的arcpy.AddWarning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。