Recommendation in navigating the ArcGIS API for Python

1041
6
Jump to solution
03-22-2021 06:47 AM
AndresCastillo
MVP Regular Contributor
Is there a recommended way to navigate the ArcGIS API for python?
an example of how I've been navigating it:
the search() method shows up in different classes in the api reference (ContentManager, UserManager, GroupManager, DataStoreManager, etc).
Once I use ctrl-f and type "search(", I need to scroll up quite a ways in order to find out the correct class the specific search() method belongs to, which makes it hard to keep track of where I am in the API reference.
 
By contrast, the ArcGIS API for JavaScript makes it simple for the developer to navigate the API by separating each class with its' properties and methods into a separate page, like this:
 
AndresCastillo_0-1616420783435.png

 

0 Kudos
1 Solution

Accepted Solutions
simoxu
by MVP Regular Contributor
MVP Regular Contributor

I agree ArcGIS Python API help document is not as easy to navigate as the JS API help document.

In the JS help, the html pages are based on classes, but in the Python API they are organised at higher (module) level.

So, to navigate the Python API Reference, you need to know what you are looking for, which means you need to know the big picture of modules and even the potential classes. In this case, the Guide is helpful:

https://developers.arcgis.com/python/guide/overview-of-the-arcgis-api-for-python/

 

View solution in original post

6 Replies
DanPatterson
MVP Esteemed Contributor

 have you tried navigating this?

API Reference for the ArcGIS API for Python — arcgis 1.8.4 documentation


... sort of retired...
0 Kudos
AndresCastillo
MVP Regular Contributor

@DanPatterson 

The link you provide shows a listing of all the modules, submodules, and classes in the api reference.

When you click on a specific one, it takes you to the same api reference page I describe in my question.

Then, when I search for a method, like the "search(" method, it finds that in the webpage multiple times, and I need to scroll quite a bit in order to find out which class the resulting "search(" refers to.

In the ArcGIS API for JavaScript, once you click in the class, and search for a method, you don't seem to get multiple finds on that same method because classes are broken up into separate web pages.

I suppose another way is for me to use intellisense if available in vs code, or within a Jupyter Notebook, do the help() function or control-tab I believe.

@RohitSingh2 

0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

I agree ArcGIS Python API help document is not as easy to navigate as the JS API help document.

In the JS help, the html pages are based on classes, but in the Python API they are organised at higher (module) level.

So, to navigate the Python API Reference, you need to know what you are looking for, which means you need to know the big picture of modules and even the potential classes. In this case, the Guide is helpful:

https://developers.arcgis.com/python/guide/overview-of-the-arcgis-api-for-python/

 

DanPatterson
MVP Esteemed Contributor

Or explore

import arcgis

dir(arcgis)
Out[3]: ['GIS', 'GeoAccessor', 'GeoSeriesAccessor', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_impl', '_jupyter_nbextension_paths', 'aggregate_points', 'apps', 'calculate_density', 'choose_best_facilities', 'connect_origins_to_destinations', 'create_buffers', 'create_drive_time_areas', 'create_route_layers', 'create_viewshed', 'create_watersheds', 'derive_new_locations', 'dissolve_boundaries', 'enrich_layer', 'env', 'extract_data', 'features', 'find_centroids', 'find_existing_locations', 'find_hot_spots', 'find_nearest', 'find_outliers', 'find_point_clusters', 'find_similar_locations', 'generate_tessellation', 'geoanalytics', 'geocode', 'geocoding', 'geometry', 'geoprocessing', 'gis', 'inspect', 'inspect_function_inputs', 'interpolate_points', 'join_features', 'learn', 'mapping', 'merge_layers', 'network', 'os', 'overlay_layers', 'pd', 'plan_routes', 'raster', 'realtime', 'schematics', 'summarize_center_and_dispersion', 'summarize_nearby', 'summarize_within', 'trace_downstream', 'widgets']

and of course the folders and files here.

C:\Your_install_folder\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis

All the scripts and imports are there and you can differentiate those that depend on arcpy and those that don't


... sort of retired...
AndresCastillo
MVP Regular Contributor

Thank you Dan

0 Kudos
MarkKinnaman
New Contributor III

Adding onto what was mentioned by @DanPatterson, you can use notebooks to find where the various modules are located by using a "?".

import arcgis 
arcgis.features?

 

Also, if you are using an IDE (you mentioned VS Code) you can press F12 or right click > Go to Definition and this will open the file that contains the module.