|
POST
|
It looks like you are missing some information:
p = subprocess.Popen([pythonExe,# path to python exe
workerScript, # path to script
scriptVar1,... #variables as strings
],\
cwd=os.path.dirname(scratchWrksp),\
shell=False,\
stdout=subprocess.PIPE,\
stderr=subprocess.PIPE)
Try adding that information and see what happens. Here is the help on subprocessing: http://docs.python.org/release/2.6/library/subprocess.html
... View more
09-27-2011
05:30 AM
|
0
|
0
|
2075
|
|
POST
|
Try this, if you use the Layer object you can do what you want, where the where clause appears in the layer properties.
import arcpy
from arcpy import mapping
fc = r"C:\fGDB.gdb\states"
statesLayer = "tempLayer"
where = "\"State_Name\" = 'Alabama'"
arcpy.MakeFeatureLayer_management(fc,statesLayer)
lyr = mapping.Layer(statesLayer)
lyr.definitionQuery = where
lyr.saveACopy(r"c:\temp\statelayer.lyr")
del lyr
del fc
del statesLayer
del where
... View more
09-16-2011
05:58 AM
|
0
|
0
|
1136
|
|
POST
|
Use the MakeFeatureLayer_management() and specify the where clause, then save that layer to disk.
import arcpy
import os
arcpy.MakeFeatureLayer_management(States, States_Layer, "\"State_Name\" = 'Alabama'")
arcpy.SaveToLayerFile_management(States_Layer, PathToLayer + os.sep + "layername.lyr", "")
Hope this helps.
... View more
09-16-2011
04:50 AM
|
0
|
0
|
1136
|
|
POST
|
Sure you can call the REST endpoint using the urllib and urllib2 libraries in python, but it seems overkill. Why not just use the ArcToolbox tools to do what you need?
... View more
08-24-2011
09:03 AM
|
0
|
0
|
580
|
|
POST
|
I get the error for both editors. If you look at the MapDocument object, the path parameter states the following: A string that includes the full path and file name of an existing map document (.mxd) or a string that contains the keyword CURRENT. I do not believe this object honors the environmental workspace parameter, and unless run from ArcMap, the full path should always be used for the map document. You can find more information here about MapDocument
... View more
08-22-2011
02:24 AM
|
0
|
0
|
932
|
|
POST
|
Does it fail if you use the full path to your arcmap document?
... View more
08-19-2011
09:40 AM
|
0
|
0
|
932
|
|
POST
|
Your where clause is incorrect, you need to format it as such: "ADDRNO" = 1 AND "ADDRSTREET" = 'GOLD' AND "ADDRSUFFIX" = 'TRAIL', but in the code provided, you do the following: whereClause = "ADDRNO = PAR1_int AND ADDRSTREET = PAR2 AND ADDRSUFFIX = PAR3" Try the following:
whereClause = "\"ADDRNO\" = " + str(PAR1_int) + " AND \"ADDRSTREET\" = '" + str(PAR2) + "' AND \"ADDRSUFFIX\" = '" + str(PAR3) +"'"
This also assume that you will always be using a shapefile for the field names. You might want to look at arcpy.AddFieldDelimiters() which will format the fields for you based on the workspace. Enjoy
... View more
08-17-2011
07:21 AM
|
0
|
0
|
2081
|
|
POST
|
DateTime? means the object can be nullable, so you need to do an extra step to get the value:
DateTime? dateOrNull = myCalendar.SelectedDate;
if (dateOrNull != null)
{
DateTime newSelectedDate = dateOrNull.Value;
}
Here is a MSDN reference: http://msdn.microsoft.com/en-us/library/1t3y8s4s(VS.80).aspx Enjoy
... View more
08-04-2011
08:48 AM
|
0
|
0
|
1330
|
|
POST
|
Can you use the Make Feature Layer against the where clause you are trying to use in arcmap? The tool can be found in arctoolbox -> data management tools -> Layers and Table Views -> Make Feature Layer Try copying and pasting that where clause for use of the update cursor. Also, are you the only person using this dataset? You need to be able to get an exclusive data lock on your datasets.
... View more
07-29-2011
08:48 AM
|
0
|
0
|
2287
|
|
POST
|
It looks like you might have an incorrect where statement in your code: Try this:
where = "[CITY_ID]=\"KAUK\""
cur3 = arcpy.UpdateCursor(inFeatures, where)
... View more
07-29-2011
08:17 AM
|
0
|
0
|
2287
|
|
POST
|
Hey Dave, It appears you have a projection problem. If you project your data from NAD_1983_UTM_Zone_15N to WGS1984 it works. The one feature in the southwest might be outside the UTM Zone 15N. I've attached the image of my output. To test this, I did the following: 1. Project your attached file to WGS-1984 using the project tool. 2. Using the newly projected data, run the buffer tool to create the buffer. For testing purposes, I used the following code after I did the projection:
import arcpy
fc = r"C:\TEMP\scratch.gdb\line1450_proj"
rows = arcpy.SearchCursor(fc)
for row in rows:
arcpy.Buffer_analysis(row.Shape,
arcpy.CreateUniqueName(r"c:\temp\scratch.gdb\buff"),
"150 Meters",
"#",
"FLAT", "ALL"
)
del row, rows
print 'finished'
This will loop through all three records and create a buffer for each shape in the LineM feature class.
... View more
07-20-2011
02:15 AM
|
0
|
0
|
2766
|
|
POST
|
Can you post your feature class? Are you running ArcInfo? Thanks
... View more
07-19-2011
10:02 AM
|
0
|
0
|
2766
|
|
POST
|
The reason you cannot get the path is because mxd is an object, not a string path. To get the path, you need to use the filePath property on the MapDocument object.
import os
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
mapPath = mxd.filePath
fileName = os.path.basename(mapPath)
print fileName
If your map document isn't saved, you will get returned an empty string.
... View more
07-14-2011
03:19 AM
|
0
|
0
|
1551
|
|
POST
|
Try using None instead of empty quotes ("")
if arcpy.env.mask == None:
proMask= ""
else:
proMask= "Mask"
... View more
07-11-2011
10:22 AM
|
0
|
0
|
967
|
|
POST
|
You can use the arcpy.mapping.MapDocument() to alter those properties. You cannot create an map document from nothing, so you need a blank map document file. I named is blank.mxd. You could do things like load base map data, set the relative path, etc... Then alter the properties of the map. In my example below, I set the author to the current windows user by grabbing the environmental variable. Use os.system() to launch arcmap with newly created map document. You can also create a .NET Event listener to alter your map document. See this help.
import arcpy
import os
blankPath = r"c:\temp\blank.mxd"
savePath = r"c:\temp\test.mxd"
mxd = arcpy.mapping.MapDocument(blankPath)
mxd.author = arcpy.GetSystemEnvironment("USERNAME")
mxd.saveACopy(savePath)
del mxd
os.system(savePath)
... View more
06-16-2011
02:31 AM
|
0
|
0
|
1544
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2017 05:56 AM | |
| 1 | 03-28-2018 03:28 AM | |
| 1 | 07-24-2017 05:39 AM | |
| 1 | 06-01-2016 03:48 AM | |
| 1 | 01-27-2016 02:53 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|