Reproject in ModelBuilder using the Feature Dataset Projection

4375
1
09-23-2014 11:44 AM
CraigPrisland1
New Contributor II

Hello all,

 

I have a question regarding reprojecting a feature class in ModelBuilder.  I have a feature class that I wish to reproject so using the Project tool I can easily do this.  I also created a parameter variable for the output coordinate system so the user can select the desired coordinate system to reproject the data to.  What I am looking into is that when this tool is run this in the future, we will always be reprojecting (outputting) to a geodatabase that contains a feature dataset that includes a projection.  Since this is the case, I was wondering if it is possible to set this up in ModelBuilder where the user would not need to select the desired outputted coordinate system but alternatively this tool could use the projection from the feature dataset to reproject to and there would be no user parameter to select the coordinate system.  I have played around with this for a while now and any help would be greatly appreciated.  Thanks in advance!

0 Kudos
1 Reply
FreddieGibson
Occasional Contributor III

You should be able to determine this with calculate value tool. You would need to build execute something similar to the following:

def GetSpatialReference(dataset):
    return arcpy.Describe(dataset).spatialReference

You would need to pass the above function the path to the feature dataset. This function will return you a spatial reference object. You'll need to ensure that you set the output type of the calculate value tool to SpatialReference so that you can use this as input to your tool that requires a spatial reference.

0 Kudos