I don't feel like scrolling through the folders....

410
0
03-22-2023 05:14 PM
Labels (1)
DanPatterson
MVP Esteemed Contributor
4 0 410

We have all been there.  Either you look through the help (which is great, don't get me wrong), open up Pro and do the scrolly thing in ArcToolbox or....

import arcpy.management as man
get_module_info(man, max_number=100, verbose=True)

:-----------------------------------------------------------------:

Package: arcpy.management
File:    C:\arc_pro\Resources\ArcPy\arcpy\management.py

Functions/methods:
    Add3DFormats, AddAttachments, AddAttributeRule, AddCodedValueToDomain,
    AddColormap, AddContingentValue, AddDataToTrajectoryDataset,
    AddFeatureClassToTopology, AddField, AddFieldConflictFilter, AddFields,
    AddFilesToLasDataset, AddGPSMetadataFields, AddGeometryAttributes,
    AddGlobalIDs, AddIncrementingIDField, AddIndex, AddItemsToCatalogDataset,
    AddJoin, AddPortalItemsToCatalogDataset, AddRastersToMosaicDataset,
    AddRelate, AddRuleToRelationshipClass, AddRuleToTopology, AddSpatialIndex,
    AddSpatialJoin, AddSubtype, AddXY, Adjust3DZ, AlterAttributeRule,
    AlterDomain, AlterField, AlterFieldGroup, AlterMosaicDatasetSchema,
    AlterVersion, Analyze, AnalyzeControlPoints, AnalyzeDatasets,
    AnalyzeMosaicDataset, AnalyzeToolboxForVersion, AnalyzeToolsForPro, Append,
    AppendAnnotation, AppendControlPoints, ApplyBlockAdjustment,
    ApplySymbologyFromLayer, AssignDefaultToField, AssignDomainToField,
    BatchBuildPyramids, BatchCalculateStatistics, BatchProject,
    BatchUpdateFields, BearingDistanceToLine, BuildBoundary, BuildFootprints,
    BuildLasDatasetPyramid, BuildMosaicDatasetItemCache,
    BuildMultidimensionalInfo, BuildMultidimensionalTranspose, BuildOverviews,
    BuildPyramids, BuildPyramidsandStatistics, BuildRasterAttributeTable,
    BuildSeamlines, BuildStereoModel, CalculateCellSizeRanges,
    CalculateDefaultClusterTolerance, CalculateDefaultGridIndex,
    CalculateEndTime, CalculateField, CalculateFields,
    CalculateGeometryAttributes, CalculateStatistics, CalculateValue,
    ChangePrivileges, ChangeVersion, CheckGeometry, ClearPixelCache,
    ClearWorkspaceCache, Clip, ColorBalanceMosaicDataset, Compact,
    CompareReplicaSchema, CompositeBands, Compress,
    CompressFileGeodatabaseData, ComputeBlockAdjustment, ComputeCameraModel,
    ComputeControlPoints, ComputeDirtyArea, ComputeFiducials,
    ComputeMosaicCandidates, ComputePansharpenWeights, ComputeTiePoints,
    ConfigureGeodatabaseLogFileTables, ConsolidateLayer, ConsolidateLocator,
    ConsolidateMap, ConsolidateProject, ConsolidateToolbox, .... snip ....
Classes :
Members:

There it is!!!

Good old AddXY, I knew it was there.

Now where is it? and what imports are used?

get_func(man.AddXY, line_nums=True, output=False)

-----------------------------------------------------------------
File path: ... C:\arc_pro\Resources\ArcPy\arcpy\management.py
Function: .... AddXY ....
Signature .... In [1]: AddXY(in_features=None)
Line number... 4145
Defaults:  ... (None,)
kwdefaults: .. None
Variable names:
    in_features, gp, gp_fixargs,
    convertArcObjectToPythonObject, retval, e

Source code:
4145  @gptooldoc('AddXY_management', None)
4146  def AddXY(in_features=None):
4147      """AddXY_management(in_features)
4148  
4149          Adds the fields POINT_X and POINT_Y to the point input features and
4150          calculates their values. It also appends the POINT_Z and POINT_M
4151          fields if the input features are Z- and M-enabled.
4152  
4153       INPUTS:
4154        in_features (Feature Layer):
4155            The point features whose x,y coordinates will be appended as POINT_X
4156            and POINT_Y fields."""
4157      from arcpy.geoprocessing._base import gp, gp_fixargs
4158      from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
4159      try:
4160          retval = convertArcObjectToPythonObject(gp.AddXY_management(*gp_fixargs((in_features,), True)))
4161          return retval
4162      except Exception as e:
4163          raise e

-----------------------------------------------------------------

 

Is GPError a method or a class?

import ConversionUtils as CU

get_module_info(CU, max_number=100, verbose=True)

:-----------------------------------------------------------------:

Package: ConversionUtils
File:    C:\arc_pro\Resources\ArcToolbox\Scripts\ConversionUtils.py

Functions/methods:
    CopyFeatures, CopyRasters, CopyRows, ExceptionMessages, Exists,
    GenerateOutputName, GenerateRasterName, GenerateUniqueName,
    SplitMultiInputs, ValidateInputRaster
Classes :
    GPError

Members:

( 1) : arcgisscripting
    package: arcgisscripting
( 2) : os
    package:
( 3) : re
    package:

Bingo!

Code in npg_utils.py 

or more generally in NumPy and Geometry  or NumPy and Geometry on github.io 

So I just try to remember these the next time I am lazy

 

About the Author
Retired Geomatics Instructor (also DanPatterson_Retired). Currently working on geometry projects (various) as they relate to GIS and spatial analysis. I use NumPy, python and kin and interface with ArcGIS Pro.
Labels