ArcGIS Developers

ArcGIS API for Python

Download the samples Try it live

Which areas are good cougar habitat?


Cascadia state park is a recreational paradise for camping, picnicking and hiking in the state of Oregon, US. Many visitors usually hike from the park to Soda Creek Falls on trails or old logging roads that continue into the Willamette national forest. It is about a mile and half from park. Research by US forest service indicates that the national forest is a habitat of approximate 6,400 cougar's population. With increase in cougar population, there is a tremendous increase in sightings by people. Park officials are therefore concerned about the safety of their visitors. On the other hand, they don't want to alarm potential visitors as this would mean reduced funding for the park in next year's state budget.

In view of this, a technical committee is set up, with wildlife experts from three agencies (State Park, National Forest, state's Department of Fish and Wildlife) to undertake a study of cougar populations in and around the park.

This sample presents an approach to using ArcGIS API for Python to help committee identify potential cougar habitat. The process uses suitability analysis to identify areas that meet the specified criteria. Through this notebook, we will demonstrate the utility of a number of spatial analysis tools including create_buffer, extract_data, dissolve_boundaries, and derive_new_locations.

Further, based on the results of the analysis, the committee can identify large habitat areas for various management goals - conservation, management of wildlife, recreation, and so on.


Necessary Imports

In [1]:
%matplotlib inline

import pandas as pd
import matplotlib.pyplot as plt
from IPython.display import display
from datetime import datetime as dt

from arcgis.gis import GIS
from arcgis.features.use_proximity import create_buffers
from arcgis.features.manage_data import dissolve_boundaries
from arcgis.features.manage_data import extract_data
from arcgis.features.find_locations import derive_new_locations

Connect to your GIS

In [2]:
gis = GIS('home')

Get the data for analysis

Search the GIS for feature layer collections by specifying the item type as 'Feature Layer Collection' or 'Feature Layer'. We will specify our search by specific tag as cougar_habitat_case_study.

In [3]:
items ='cougar_habitat_case_study', 'Feature Layer')
In [4]:
for item in items:
Which areas are good cougar habitat?Feature Layer Collection by api_data_owner
Last Modified: December 04, 2019
0 comments, 4 views

We will use the first item for our analysis. Since the item is a Feature Layer Collection, accessing the layers property will give us a list of FeatureLayer objects.

In [5]:
cougar_item = items[0]

The code below cycles through the layers and prints their names.

In [6]:
for lyr in cougar_item.layers:

Let us assign a variable to each of these feature layers.

In [7]:
state_park = cougar_item.layers[0]
vegetation = cougar_item.layers[1]
slope = cougar_item.layers[2]
sub_watershed = cougar_item.layers[3]
highways = cougar_item.layers[4]
streams = cougar_item.layers[5]

Let's plot the state park on map for visualization.

In [8]:
m1 ='oregon')