What is arcgisscripting

1826
1
09-08-2022 05:46 PM
Labels (1)
DanPatterson
MVP Esteemed Contributor
5 1 1,826

First, their locations 

Your install path = YIP

  • arcpy
    • C:\YIP\Resources\ArcPy\arcpy    # see the __init__.py file for details on what is done
  • gp  # geoprocessor
    • C:\YIP\Resources\ArcPy\arcpy\geoprocessing    # ditto... see the __init__.py
  • env  # environment
    • C:\YIP\Resources\ArcPy\arcpy\geoprocessing    # ditto... see the __init__.py
  • arcgisscripting
    • C:\YIP\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgisscripting  # ditto...

Now that you have entertained yourself with some light reading, here are some tips as to the contents when importing.

import arcgisscripting as ags

dir(ags)
['ClearCredentials', 'ExecuteAbort', 'ExecuteError', 'ExecuteWarning',
 'Extent',
 'ImportCredentials', 'Mensuration',
 'NumPyArrayToRaster',
 'Raster', 'RasterCellIterator', 'RasterInfo',
 'RasterToNumPyArray',
 'SignInToPortal',

 '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__',
 '__package__', '__path__', '__spec__',
 '_addTimeInterval', '_analyzeForSD',

 '_arcgisscripting',  # --> a *.pyd file
 '_attachLocator',
 '_convertWebMapToMapDocument', '_createGISServerConnectionFile', '_createGeocodeSDDraft',
 '_createMapSDDraft', '_createimageservicesddraft', '_getImageEXIFProperties', '_getRasterKeyMetadata',
 '_getUTMFromLocation', '_hasLocalFunctionRasterImplementation', '_hgp',
 '_ia',
 '_listDateTimeStringFormats', '_listStyleItems', '_listTimeZones', '_listTimeZonesLabels',
 '_mapping',
 '_reserved', '_setRasterKeyMetadata', '_sharing',
 '_ss',
 '_wrapLocalFunctionRaster', '_wrapToolRaster',
 'charts', 'checks_helper',
 'create',
 'da',
 'geocodingx', 'getmytoolboxespath', 'getsystemtoolboxespath', 'getsystemtoolboxespaths',
 'metadata',
 'na',
 'un']

Some of the biggies would include those on lines 5, 7, 8, 9, 21, 23, 25, 27,29,32, 33 plus others.  Look familiar?  They should.

How about a little Data Access module

C:\YIP\Resources\ArcPy\arcpy\da.py which you can import via arcpy or via arcgisscripting

# --> option 1 .. the usual
from arcpy import da

# --> option 2 .. hmmm I wonder what is da.py
from arcgisscripting import da  #  trade secrets warning

# --> option 3 .. I only like typing arcgisscripting once
import arcgisscripting as ags

dir(ags.da)  # -- it has the functions that I need. --
['ContingentFieldValue', 'ContingentValue', 'DatabaseSequence',
 'Describe',
 'Domain', 'Editor',
 'ExtendTable',
 'FeatureClassToNumPyArray',
 'InsertCursor',
 'ListContingentValues', 'ListDatabaseSequences', 'ListDomains',
 'ListFieldConflictFilters', 'ListReplicas', 'ListSubtypes', 'ListVersions',
 'NumPyArrayToFeatureClass',
 'NumPyArrayToTable',
 'Replica',
 'SearchCursor',
 'SyncReplica',
 'TableToArrowTable',
 'TableToNumPyArray',
 'UpdateCursor',
 'Version',
 'Walk',
 '__doc__', '__loader__', '__name__', '__package__', '__spec__', '_internal_eq', '_internal_sd', '_internal_vb']

Familiar again for sure.

 

Others you may have missed.

Get the geoprocessor and the environment

--------
from arcpy.geoprocessing import gp

dir(gp)
[... snip
 '_arc_object',
 '_gp',
 ... snip
 'addMessage', 'addReturnMessage',
 ... snip
 'describe',
 ... lots of snips
 'listEnvironments',
 'listFeatureClasses',
 'listFields',
 'listFiles', 'listIndexes', 'listInstallations', 'listPortalURLs', 'listPrinterNames',
 'listRasters',
 'listSpatialReferences',
 'listTables', 'listToolboxes', 'listTools', 'listTransformations', 'listVersions',
 'listWorkspaces',
 ... snip
 'overwriteOutput',
 'parameterCount', 'parseFieldName', 'parseTableName', 'productInfo', 'removeDataStoreItem', 'removeToolbox',
 ... homework
]

from arcpy.geoprocessing import env
dir(env)
[... snip
 'addOutputsToMap',
 ... snip again
 'workspace']

 

Other packages ... only a few to mention.

dir(ags._ss)  # -- spatial statistics ! --
dir(ags._mapping)  # -- for the mappy types ! --
dir(ags.un)   # -- utilities anyone? --

# don't ignore the dunders, interesting reads.

 

and don't forget the ...site-packages... folder, there are a few gems there.  If the package doesn't have documentation or help on the methods and properties like most packages came from, you might begin to think .... where did it originate from??? Experiment

So, when you have some time, open the scripts in your installation path and learn what they do and their origins.

If you want to do a comparison on namespace, try ...

import arcgisscripting as ags
dir(ags)
# ...snip --> versus

import arcpy
dir(arcpy)
# ...snip

 

 

 

1 Comment
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