Code & tools

Spatial Reference Checker

When vector layers come from different sources, their coordinate systems need checking before the layers are combined or used for measurement. I wrote this script to inspect a folder or file geodatabase, identify datasets already in the target system and bring the others into NAD83 UTM Zone 12N.

The output is a consistent set of vector datasets and a summary showing which inputs matched the target, used another reference or had no defined reference.

Target system
NAD83 UTM Zone 12N
Target WKID
26912
Tools
Python, ArcPy, ArcGIS Pro

Checking and standardising the layers

I read each dataset's spatial reference and compare it with WKID 26912. Matching datasets are left as they are. For the others, the script creates projected temporary outputs and uses those to replace the originals. The workspace path is set in the script.

The summary makes the coordinate system issues visible across the batch, including the names of inputs whose reference was unknown. That is useful preparation for a project that needs a common local coordinate system, but it does not check the positional accuracy of the source features.

The assumption that needs checking

For unknown inputs, this version defines geographic NAD83 before projecting. Defining a reference describes existing coordinates; it does not discover what system those coordinates originally used. An incorrect assumption can therefore place the output in the wrong location.

I would verify the source reference from metadata or a known reference dataset and work on copies, since this version replaces the originals. I would also confirm that UTM Zone 12N is appropriate for the project area before choosing it as the common target.

Data and references

Get in touch

I’m looking for GIS opportunities across Canada. You can reach me by email or on LinkedIn.