Trouble passing coordinates to CreateFishnet_management

288
1
08-21-2013 12:46 PM
TimFast
New Contributor
As part of a Python script I am trying to pass coordinates into CreateFishnet_management. According to the help file, the syntax for the origin coordinate should be '610433.5 4956420.5'; however, my code throws the following error:
Invalid value type for parameter origin_coord.

Here is part of my script

fcFishnet = "C:\\Users\\fastth\\Documents\\Projects\\Eau Claire\\SmallNetTest.shp"
xOrigin = 610433.5
yOrigin = 4956420.5
xOppositeCorner = 610484.5
yOppositeCorne = 4956480.5
plotWidth = 1.5
plotHeight = 5
units = "Feet"

originCoord = "'" + str(xOrigin) + " " + str(yOrigin) + "'"
print originCoord 
oppositeCoord = "'" + str(plotWidth) + " " + str(plotHeight) + "'"

#Create the fishnet
arcpy.CreateFishnet_management(fcFishnet, originCoord, originCoord, plotHeight, plotWidth, oppositeCoord, "NO_LABELS", "DEFAULT", "POLYGON")


The print statement returns '610433.5 4956420.5'
I tried reversinig the use of single & double quotes to get "610433.5 4956420.5"
Finally I tried:
originCoord = arcpy.Point(xOrigin,yOrigin) 


No luck.
Any help would be greatly appreciated.

(code [thread=48475]formatted[/thread])
Tags (2)
0 Kudos
1 Reply
curtvprice
MVP Esteemed Contributor
You are packing extra quotes inside your string that should just contain your two numbers.

Try this:

originCoord = str(xOrigin) + " " + str(yOrigin)


or (better)

originCoord = "{0} {1}".format(xOrigin, yOrigin)


arcpy.Point would have worked except perhaps its string representation doesn't work here, as the point has X,Y,Z and M. This sure looks like a bug as the tool is supposed to be okay with Point.

>>> print arcpy.Point(0,0)
0 0 NaN NaN
0 Kudos