Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Got an easy one, that's got me stuck. I'm moving some models that were created in 9.3.1 to work in 10.

Part of the model is calculating the X coordinate of a polygon to a specified field.

The code that works (in 9.3.1) is

Dim Output As Double
Dim pArea As IArea
Set pArea = [Shape]
Output = pArea.Centroid.X

Expression = output

It doesnt work in 10 as i get the following error.

General error executing calculator.
ERROR 999999: Error executing function.
Expected end of statement
Failed to execute (Calculate Field X_COORD).

I've tried the following using the python parser

def calc(shape,x):
    x = "shape.CENTROID!.split()[0]
    return x

calc(!SHAPE!, !X_COORD! )

But that gives an error - invalid syntax on line 2.

Any pointers? Thanks

share|improve this question
    
you are missing an end quote on your second line –  Hotpepper May 15 '13 at 17:19
add comment

closed as too localized by whuber May 15 '13 at 17:25

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.