restricting input dataset coordinate system

01-17-2020 02:18 PM
New Contributor

How does one restrict the input datasets to a certain coordinate system projection?

I think it involves setting up some kind of parameter dependency filter that I have been writing in the def getParameterInfo(self): section of a python script.

param03 = arcpy.Parameter(displayName = 'Input Regional DAMAGE_POINTS_FLAT_ALBERS dataset(s) from file (no need to load into the Table of Contents)',
name = 'Input_Regional_Damage_Point_Dataset',
datatype = 'DEFeatureClass',
parameterType = "Required",
direction = "Input",
multiValue = True)
param03.filter.list = ["Point","Multipoint"]

I also want to restrict this points and multipoints to the albers projection (or any specific coordinate system).

I presume it is something like this, but have been unable to figure it exactly out:


perhaps with enviroment worked in: param03.parameterDependencies.environment

Thanks, for I am a python novice willing to jump in and try to figure out syntax, but have had no formal python training.

0 Kudos
1 Reply
MVP Esteemed Contributor

Provide the check and if it isn't what you want, bail.

from arcpy.da import Describe 

# Spatial reference object
def get_SR(in_fc, verbose=False):
    """Return the spatial reference of a featureclass."""
    desc = Describe(in_fc)
    SR = desc['spatialReference']
    if verbose:
        print("SR name: {}  factory code: {}".format(, SR.factoryCode))
    return SR‍‍‍‍‍‍‍‍

Note that "Describe"  in the 'da' module has a 'spatialReference' access point.  On line 9, you can use a variety of things (name, factoryCode etc) to compare against.  so just pull in the information from the featureclass, get its SR and compare, bailing if it doesn't match