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


Python arcpy.AddMessage方法代码示例

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


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

示例1: createUniqueIDTable

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def createUniqueIDTable(self, in_nc, out_table):
        """Create a table of unique stream IDs"""
        data_nc = NET.Dataset(in_nc)
        comid_arr = data_nc.variables[self.vars_oi[0]][:]
        comid_size = len(comid_arr)
        comid_arr = comid_arr.reshape(comid_size, 1)
        arcpy.AddMessage(comid_arr.transpose())
        arcpy.AddMessage(self.vars_oi[0])

        #convert to numpy structured array
        str_arr = NUM.core.records.fromarrays(comid_arr.transpose(), NUM.dtype([(self.vars_oi[0], NUM.int32)]))

        # numpy structured array to table
        arcpy.da.NumPyArrayToTable(str_arr, out_table)

        data_nc.close()

        return 
开发者ID:Esri,项目名称:python-toolbox-for-rapid,代码行数:20,代码来源:CreateDischargeTable.py

示例2: calculateTimeField

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def calculateTimeField(self, out_table, start_datetime, time_interval):
        """Add & calculate TimeValue field: scripts adapted from TimeTools.pyt developed by N. Noman"""
        timeIndexFieldName = self.fields_oi[0]
        timeValueFieldName = self.fields_oi[3]
        #Add TimeValue field
        arcpy.AddField_management(out_table, timeValueFieldName, "DATE", "", "", "", timeValueFieldName, "NULLABLE")
        #Calculate TimeValue field
        expression = "CalcTimeValue(!" + timeIndexFieldName + "!, '" + start_datetime + "', " + time_interval + ")"
        codeBlock = """def CalcTimeValue(timestep, sdatestr, dt):
            if (":" in sdatestr):
                sdate = datetime.datetime.strptime(sdatestr, '%m/%d/%Y %I:%M:%S %p')
            else:
                sdate = datetime.datetime.strptime(sdatestr, '%m/%d/%Y')
            tv = sdate + datetime.timedelta(hours=(timestep - 1) * dt)
            return tv"""

        arcpy.AddMessage("Calculating " + timeValueFieldName + "...")
        arcpy.CalculateField_management(out_table, timeValueFieldName, expression, "PYTHON_9.3", codeBlock)

        return 
开发者ID:Esri,项目名称:python-toolbox-for-rapid,代码行数:22,代码来源:CreateDischargeTable.py

示例3: get_stop_lat_lon

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def get_stop_lat_lon():
    '''Populate a dictionary of {stop_id: [stop_lat, stop_lon]}'''
    
    arcpy.AddMessage("Collecting and processing GTFS stop information...")
    
    # Find all stops with lat/lon
    global stoplatlon_dict
    stoplatlon_dict = {}
    cs = conn.cursor()
    stoplatlonfetch = '''
        SELECT stop_id, stop_lat, stop_lon FROM stops
        ;'''
    cs.execute(stoplatlonfetch)
    for stop in cs:
        # Add stop lat/lon to dictionary
        stoplatlon_dict[stop[0]] = [stop[1], stop[2]] 
开发者ID:Esri,项目名称:public-transit-tools,代码行数:18,代码来源:Step1_MakeShapesFC.py

示例4: HandleOIDUniqueID

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def HandleOIDUniqueID(inPointsLayer, inLocUniqueID):
    '''If ObjectID was selected as the unique ID, copy the values to a new field
    so they don't get messed up when copying the table.'''
    pointsOID = arcpy.Describe(inPointsLayer).OIDFieldName
    if inLocUniqueID.lower() == pointsOID.lower():
        try:
            inLocUniqueID = "BBBUID"
            arcpy.AddMessage("You have selected your input features' ObjectID field as the unique ID to use for this analysis. \
In order to use this field, we have to transfer the ObjectID values to a new field in your input data called '%s' because ObjectID values \
may change when the input data is copied to the output. Adding the '%s' field now, and calculating the values to be the same as the current \
ObjectID values..." % (inLocUniqueID, inLocUniqueID))
            arcpy.management.AddField(inPointsLayer, inLocUniqueID, "LONG")
            arcpy.management.CalculateField(inPointsLayer, inLocUniqueID, "!" + pointsOID + "!", "PYTHON_9.3")
        except:
            arcpy.AddError("Unable to add or calculate new unique ID field. Please fix your data or choose a different unique ID field.")
            raise CustomError
    return inLocUniqueID 
开发者ID:Esri,项目名称:public-transit-tools,代码行数:19,代码来源:BBB_SharedFunctions.py

示例5: getAOI

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def getAOI(prod_db):
    # Set workspace
    arcpy.env.workspace = prod_db
    # Get MetaDataA fc
    meta_fc = getFC(prod_db, "MetaDataA", NAUT_FDS)
    if meta_fc:
        # Make feature layer where FCSUBTYPE = M_NSYS
        where = "FCSUBTYPE = 35"
        arcpy.MakeFeatureLayer_management(meta_fc, "meta_lyr", where)
        # Dissolve layer into one feature
        arcpy.AddMessage("\tDissolving area of interest into one feature")
        aoi = "in_memory\\aoi"
        arcpy.Dissolve_management("meta_lyr", aoi, multi_part="SINGLE_PART")
        arcpy.MakeFeatureLayer_management(aoi, "aoi")
        return "aoi"

    else:
        raise ex("MetaDataA feature class not found in " + prod_db) 
开发者ID:Esri,项目名称:maritime-charting-sample-scripts,代码行数:20,代码来源:s57_2_chart.py

示例6: output_msg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [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

示例7: update_package

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [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

示例8: updateOverrides

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def updateOverrides(fcs):
    """ loops through all feature classes and applies overrides to the geometry"""
    for fc in fcs:
        arcpy.env.overwriteOutput = True
        arcpy.env.addOutputsToMap = False
        desc = arcpy.Describe(fc)
        rep_name = ""
        if hasattr(desc, "representations"):
            reps = desc.representations
            for rep in reps:
                rep_name = rep.name
                arcpy.AddMessage("Applying Rep Overrides for " + str(fc))
                arcpy.UpdateOverride_cartography(fc, rep_name, "BOTH")
        arcpy.AddMessage("Repairing Geometry for " + str(fc))
        arcpy.RepairGeometry_management(fc)

    return fcs 
开发者ID:Esri,项目名称:CTM,代码行数:19,代码来源:WMX_Generalization.py

示例9: calcRadiance

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def calcRadiance (LMAX, LMIN, QCALMAX, QCALMIN, QCAL, band):
    
    LMAX = float(LMAX)
    LMIN = float(LMIN)
    QCALMAX = float(QCALMAX)
    QCALMIN = float(QCALMIN)
    offset = (LMAX - LMIN)/(QCALMAX-QCALMIN)
    inraster = Raster(QCAL)
    outname = 'RadianceB'+str(band)+'.tif'

    arcpy.AddMessage('Band'+str(band))
    arcpy.AddMessage('LMAX ='+str(LMAX))
    arcpy.AddMessage('LMIN ='+str(LMIN))
    arcpy.AddMessage('QCALMAX ='+str(QCALMAX))
    arcpy.AddMessage('QCALMIN ='+str(QCALMIN))
    arcpy.AddMessage('offset ='+str(offset))
    
    outraster = (offset * (inraster-QCALMIN)) + LMIN
    outraster.save(outname)
    
    return outname 
开发者ID:vightel,项目名称:FloodMapsWorkshop,代码行数:23,代码来源:toa.py

示例10: parseArguments

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def parseArguments():
    parser = argparse.ArgumentParser(
        usage='Add/Update GNSS metadate fields')

    arcpy.AddMessage("Parsing Arguments..")

    parser.add_argument('url', help='Organization url')
    parser.add_argument('username', help='Organization username')
    parser.add_argument('password', help='Organization password')
    parser.add_argument('itemId', type=str, help='Feature service Item Id')
    parser.add_argument('layerIndex', type=int, help='Feature Layer index. If not specified use 0 as index')
    parser.add_argument('-r', dest='remove', default=False, type=bool,
                        help='Set True if GNSS metadata fields need to be removed')

    args_parser = parser.parse_args()
    if '*' in args_parser.password:
        args_parser.password = password = arcpy.GetParameterAsText(2)
    arcpy.AddMessage("Done parsing arguments..")
    return args_parser


# Search for a item id and add GNSS Metadata fields 
开发者ID:Esri,项目名称:collector-tools,代码行数:24,代码来源:add_update_gnss_fields_python_api.py

示例11: update_feature_service

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def update_feature_service(itemId,owner,folder_id,gis,feaureService_data):
    params = {
        "token": gis._con.token,
        "text": json.dumps(feaureService_data).encode('utf8', errors='replace'),
        "f": "json"
        }

    if folder_id and folder_id != "":
        featureServiceItem_Url = "{}/sharing/rest/content/users/{}/{}/items/{}/update".format(args_parser.url,owner,folder_id, itemId)
    else:
        featureServiceItem_Url = "{}/sharing/rest/content/users/{}/items/{}/update".format(args_parser.url,owner, itemId)
    
    updateResponse = urllib.request.urlopen(featureServiceItem_Url,bytes(urllib.parse.urlencode(params),'utf-8')).read()
    result = json.loads(updateResponse.decode("utf-8"))
    if 'error' in result.keys():
        ex = result['error']['message']
        arcpy.AddMessage("Error..{}".format(ex))
    else:
        arcpy.AddMessage("Successfully configured popup and visibility on the Feature service Item..")
    

# Parse Command-line arguments 
开发者ID:Esri,项目名称:collector-tools,代码行数:24,代码来源:configure_gnss_popup_python_api.py

示例12: parseArguments

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def parseArguments():
    parser = argparse.ArgumentParser(
        usage='Configure GNSS metadate fields visibility and popup')

    arcpy.AddMessage("Parsing Arguments..")

    parser.add_argument('url', help='Organization url')
    parser.add_argument('username', help='Organization username')
    parser.add_argument('password', help='Organization password')
    parser.add_argument('webmap_Name', type=str, help='Webmap Name')
    parser.add_argument('layerIndex', type=int, help='Feature Layer index. If not specified use 0 as index')

    args_parser = parser.parse_args()
    if '*' in args_parser.password:
        args_parser.password = password = arcpy.GetParameterAsText(2)
    arcpy.AddMessage("Done parsing arguments..")
    return args_parser


# Search for a Webmap and update GNSS Metadata fields popup info 
开发者ID:Esri,项目名称:collector-tools,代码行数:22,代码来源:configure_gnss_popup_python_api.py

示例13: parseArguments

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [as 别名]
def parseArguments():
    parser = argparse.ArgumentParser(
        usage='Reset required fields to None in the feature templates')

    arcpy.AddMessage("Parsing Arguments..")

    parser.add_argument('url', help='Organization url')
    parser.add_argument('username', help='Organization username')
    parser.add_argument('password', help='Organization password')
    
    parser.add_argument('itemId', type=str, help='Feature service Item Id')

    args_parser = parser.parse_args()
    if '*' in args_parser.password:
        args_parser.password = password = arcpy.GetParameterAsText(2)
    
    arcpy.AddMessage("Done parsing arguments..")
    return args_parser 
开发者ID:Esri,项目名称:collector-tools,代码行数:20,代码来源:reset_required_fields_python_api.py

示例14: PrintMsg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [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

示例15: PrintMsg

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import AddMessage [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


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