Feature class input as Geometry type through Model Builder

569
3
09-22-2014 08:12 PM
Highlighted
New Contributor II

Hi,

I am trying to provide a feature class as an input to "Get Cell Value", but it only strictly accepts a Point Geometry (or x & y coordinate value) - not a feature class/shapefile etc. How can I actually grab the point data from the feature class?

I am doing it in ArcMap 10.2.2, using model builder to build the workflow. Thanks in advance.

Reply
0 Kudos
3 Replies
Highlighted
MVP Esteemed Contributor

Try the Calculate Value tool.

Here are the parameters to use for the Calculate Value tool. For the purposes of the example, I am assuming the name of your input feature class model element is: "Input Point Feature".

Expression:  GetPoint(r"%Input Point Feature%")

Code Block:

import arcpy

def GetPoint(fc):

  pt = arcpy.da.SearchCursor(fc, "SHAPE@").next()[0]

  return pt

Data Type:  Point

Calculate Value always returns a text representation of the value; the Data Type parameter is used to tell the tool you connect the output to what the output is, in your case, a point geometry. So, if you use Data Type "Point", you should be able to connect the "Point" output to the Get Cell Value tool.

Set your feature class to be a precondition to your Calculate Value tool. This makes sure "Input Point Feature" variable is populated and ready to go when you run the Calculate Value tool.

Hope this helps you out.

Reply
0 Kudos
Highlighted
New Contributor II

Hi, I'd tried your suggestion and it works...to a certain extent.

I was able to connect the output from calculate value to as Location  parameter for Get Cell Value. However when validating/running the tool, it seems to refused to acknowledge that location input was there. I.e.: Error 000735: Location: Value is required.

Any clues? Thanks!

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

You may want to try shape@xy instead of shape@

Reply
0 Kudos