Create a Unique Value Python List from a Feature Service

This script and video show how to create a unique value list from a feature service.

The script references the Park Amenities layer from the City of Sacramento’s Open Data Portal (actually the URL to where it is stored on the ESRI cloud (AGOL)).

This example shows how a search cursor can be used to generate a unique value list from the Amenity attribute. A for loop loops over the unique list to generate a query statement that is then used to create a feature layer (this mimics the action of a definition query). The script completes by simply printing the name of the amenity and how many features make up the queried data.

Script/Jupyter Notebook