Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Can we no longer reference an ArcMap layer to get the spatial reference?

$
0
0

I’m currently using ArcGIS 10.2.1. In previous custom geoprocessing tools, I’ve used the following code to create a feature class in-memory, and set the spatial reference using an existing layer in ArcMap:

polygon = arcpy.GetParameterAsText(0)

mem_point = arcpy.CreateFeatureclass_management("in_memory", "mem_point", "POINT", "", "DISABLED", "DISABLED", polygon)

Where polygon is a layer in the ArcMap TOC. This has always worked in the past, but I just went to use one of the tools, and I got the following error:

Traceback (most recent call last):   File "", line 23, in <module>
     mem_point = arcpy.CreateFeatureclass_management("in_memory", mem_name, "POINT", "", "DISABLED", "DISABLED", polygon)   File "",
line 1800, in CreateFeatureclass
     raise e ExecuteError: ERROR 000622: Failed to execute (Create Feature Class). Parameters are not valid. ERROR 000628: Cannot set
input into parameter spatial_reference.

Did this just recently change?


Viewing all articles
Browse latest Browse all 767

Trending Articles