Tag Info

New answers tagged

3

For this line: arcpy.RasterToPolygon_conversion(inraster, outPolygons, "NO_SIMPLIFY", field) You are inserting a list not an individual raster file, trying changing it to: arcpy.RasterToPolygon_conversion(i, outPolygons, "NO_SIMPLIFY", field)


0

Yes it was the data type that was the issue. On advice of @dklassen switching the value passed to LinkID to an int data type solved the issue.


0

This answer was submitted by @Vince in the comments to the initial question. In a direct connection the Instance parameter needs to look like this INSTANCE = sde:sqlserver:(servername) and the Server parameter is ignored. More information can be found here


3

I think you might be somewhat along the right lines, but, what about something more along the lines of: lab1 = line's value lab2 = line's value ... if line 1 condition >= 90 lab1 = bold and green + lab1 + end bold and green if line 2 condition >= 90 lab2 = bold and green + lab2 + end bold and green ... label = bold and underline + header ...


2

Try casting the variable as a string: for folder in gh: os.mkdir(os.path.join(root_path,str(folder)))


2

I would use an UpdateCursor approach. You will first need to add a new text field to your FC so that you can store the commas. You cannot add commas to integer, float, or double type fields: arcpy.AddField_management(fc, "newField", "TEXT") Then loop through your rows and apply the proper formatting (e.g. convert 300000.456 to 300,000) newValue = ...


2

What's the end goal? If you simply want to display the numbers rounded to whole values with thousands separators, you can do so using Number Formatting within ArcGIS. Search the documentation for "thousands separator" to see all the places this formatting can be configured. You can use that Python string in a Calculate Field function. Before you can ...


1

This is a pretty straightforward task. Hopefully this will get you started: import os, arcpy folders_in = [] #Build this manually or with os.walk()/os.listdir() folders_out = [] exp = '"{:,}".format(!SUM_Acres_!)' #Loop over each folder and get the shapefiles inside for f_in, f_out in zip(folders): arcpy.env.workspace = f_in shapefiles = ...


2

You appear to be mixing different geoprocessors, you do not need to use the arcgiscripting. Try this code, replacing the folder and file names as appropriate import arcpy #Set environment settings arcpy.env.overwriteOutput = True arcpy.env.workspace = "C:/Temp" #Build Raster Attribute Table arcpy.BuildRasterAttributeTable_management("myRaster", ...


3

With cursors and the csv module, this should go pretty quick: import arcpy, csv, time arcpy.env.workspace = <path to gdb> table_list = arcpy.ListTables() csv_out = <path to csv> #Get name of fields from first entry fields = [x.name for x in arcpy.ListFields(table_list[0])] start = time.time() counter = 0 with open(csv_out, "wb") as f: ...


3

Instead of using the same csvfile1 each time, define a variable that depends on the feature class name. For example: fcList = arcpy.ListFeatureClasses() for fc in fcList: csvFileName = 'CSV_{}.csv'.format(fc) # or just = fc + '.csv' for field in arcpy.ListFields(fc): csvwriter(csvFileName,field.name)


0

Here is your code, this will serve your requirements. import webbrowser import os def open_file(directory, filenames): """ open the files in new window """ if os.path.isdir(directory): for dir_file in os.listdir(directory): if dir_file in filenames: webbrowser.open_new(os.path.join(directory, dir_file)) else: ...


0

Try defining the resource first and pulling the layers from it: myResource = cat.get_resources(store='storeName', workspace='workspaceName') layers = cat.get_layers(myResource)



Top 50 recent answers are included