POST
|
I installed the scipy and numpy binaries from this person - http://www.lfd.uci.edu/~gohlke/pythonlibs/. Initially I thought they worked. It looks like something in the Spatial Analyst explodes when you upgrade numpy. Ugh, what a pain!
... View more
04-20-2015
05:50 AM
|
0
|
0
|
619
|
POST
|
I am trying to get SciPy installed on arcgis server 10.2.2. The 32 bit install works swimmingly in desktop. I cannot find a binary install for 64 bit. Anyone have any luck getting SciPy installed on arcgis server 10.2.2?
... View more
04-17-2015
01:09 PM
|
0
|
5
|
3985
|
POST
|
How are you kicking off the script manually? Through Idle, doubleclicking or in CLI via python xxxx.py ? If you have multiple versions of python installed the arcgisscripting library might not be in the one that the scheduled task is hitting. Probably a shot in the dark, but worth checking out.
... View more
08-19-2011
04:43 AM
|
0
|
0
|
119
|
POST
|
Your best bet is to do this automation with a cursor. Check out * Update cursor - http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v0000003m000000.htm * Working with geometry - http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Working_with_geometry_in_Python/002z0000001s000000/ I haven't tested this, but you will do something like:
shapeField = arcpy.Describe("Feature Class").ShapeFieldName
deltaX = 10
deltaY = 10
c = arcpy.UpdateCursor("Feature Class")
for row in c:
partnum = 0
feat = row.getValue(shapefieldname)
for part in feat:
for pnt in feat.getPart(partnum):
pnt.X = pnt.X + deltaX
pnt.Y = pnt.Y + deltaY
c.updateRow(row)
... View more
08-19-2011
04:39 AM
|
0
|
0
|
457
|
POST
|
What is the schema for your featureset input? It sounds like something might be wonky with that since you are getting data out the other end, just missing fields. 1) Check schema of featureset input for tool. 2) If this is correct, you might want to do some error checking in your tool itself before you output to feature class. Make sure all the fields are going into your featureclass->featureclass
featureset = your featureset
fields = arcpy.ListFields(featureset)
for field in fields:
arcpy.AddMessage(field.name)
arcpy.CopyFeatures_management(featureset, outputFeatureclass)
... View more
08-15-2011
04:38 AM
|
0
|
0
|
1072
|
POST
|
Exclamation marks in the Calculate Field calculation demarcate Fields in the table you are working with. Ex. !FIPS! = the value in the fips field In VB it used to be the square bracket. This is just one of those annoying things that you have to remember. Another way to write this that might be easier is: "(!%s!/!SUM_%s!)*100" % (popfield, popfield) This uses python's string formatting structure. I find it is a bit easier to read than having all of the plus signs and stuff. code example: arcpy.CalculateField_management(outputfc, percentfield, "(!%s!/!SUM_%s!)*100" % (popfield, popfield), "PYTHON")
... View more
07-26-2011
05:45 AM
|
0
|
0
|
359
|
POST
|
Not sure if this will work, but worth a shot. Wrap three quotes around your return value. return """COM_NAME""" [\CODE]
... View more
07-19-2011
01:06 PM
|
0
|
0
|
272
|
POST
|
You should use a try/except statement http://docs.python.org/tutorial/errors.html def getDOT(dot):
def getDOT(dot):
try:
result = int(dot)
except:
result = Null
finally:
return result
... View more
07-18-2011
06:16 AM
|
0
|
0
|
465
|
POST
|
lyr = arcpy.MakeFeatureLayer_management(fc, desc.basename + "_lyr") It looks like you set lyr to a feature layer object earlier on. The os.path.join is getting caught up on that because it isn't a string. You might want to do
outFC = os.path.join(outpath, desc.basename+"_lyr")
instead
... View more
07-12-2011
10:18 AM
|
0
|
0
|
1525
|
POST
|
I highly recommend checking out http://www.voidspace.org.uk/python/configobj.html A config file looks like:
# This is the 'initial_comment'
# Which may be several lines
keyword1 = value1
'keyword 2' = 'value 2'
[ "section 1" ]
# This comment goes with keyword 3
keyword 3 = value 3
'keyword 4' = value4, value 5, 'value 6'
[[ sub-section ]] # an inline comment
# sub-section is inside "section 1"
'keyword 5' = 'value 7'
'keyword 6' = '''A multiline value,
that spans more than one line :-)
The line breaks are included in the value.'''
[[[ sub-sub-section ]]]
# sub-sub-section is *in* 'sub-section'
# which is in 'section 1'
'keyword 7' = 'value 8'
[section 2] # an inline comment
keyword8 = "value 9"
keyword9 = value10 # an inline comment
# The 'final_comment'
# Which also may be several lines
Reading Config File looks like
from configobj import ConfigObj
config = ConfigObj(filename)
#
value1 = config['keyword1']
value2 = config['keyword2']
#
section1 = config['section1']
value3 = section1['keyword3']
value4 = section1['keyword4']
#
# you could also write
value3 = config['section1']['keyword3']
value4 = config['section1']['keyword4']
... View more
07-12-2011
08:36 AM
|
0
|
0
|
853
|
POST
|
Two routes: 1) Use model builder and the "Export to Python" functionality (File / Export / Python) http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w00000001000000.htm 2) Check out the documentation on the support site for the tools you would like to string together. This helped me a bunch http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/A_quick_tour_of_geoprocessing_tool_references/002t0000000z000000/.
... View more
07-07-2011
10:48 AM
|
0
|
0
|
190
|
POST
|
I am having an issue with this bit of python. Basically I open up a cursor to loop through a feature class. At each row, I take every field and put the values in a dictionary. I then append this to a list. I am specifically interested in ObjectID and SHAPE Next I unpack the list of dictionaries and print the ObjectID and SHAPE. For some reason the SHAPE component isn???t saved properly. But the ObjectID is. I think this is a bug with ArcPy, but it could just as likely be a bug with my code. I get the following output: 1 - -8359910.19268255 4842313.47802997 NaN NaN 2 - -8353926.32475581 4846897.25034694 NaN NaN 3 - -8359087.54168308 4842848.29488585 NaN NaN ************ 1 - -8359087.54168308 4842848.29488585 NaN NaN 2 - -8359087.54168308 4842848.29488585 NaN NaN 3 - -8359087.54168308 4842848.29488585 NaN NaN
import arcpy
fc = r'C:\Users\cfricke.GISINC\Documents\BOMBED\Test.gdb\Stores'
cursor = arcpy.SearchCursor(fc)
fields = arcpy.ListFields(fc)
geo = arcpy.Describe(fc).ShapeFieldName
idField = arcpy.Describe(fc).OIDFieldName
###
# Part A
# Output Cursor into List of Dictionaries
# Print ObjectID and Shape at each iteration
###
fcList = []
for row in cursor:
fcDict = {}
for field in fields:
fcDict[field.name] = row.getValue(field.name)
if field.name == geo:
print "%s - %s" % (row.getValue(idField), row.getValue(field.name).getPart())
fcList.append(fcDict)
del fcDict
print ""
print "************"
print ""
###
# Part B
# Loop through list of dictionary, print objectID and shape
###
for x in fcList:
print "%s - %s" % (x[idField],x[geo].getPart())
del fcList
... View more
07-07-2011
05:32 AM
|
0
|
6
|
1212
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|