6

You almost had it right with your first attempt. What you are doing is trying to call the extent property with a filename as its parameter, when you need to construct a Raster object with that parameter. In practical terms, that means: extent1 = arcgisscripting.Raster('stg1_05.jpg').extent Although it is usually better practice to break it down into two ...


6

I found out that if I changed the direction of the output workspace from 'output' to 'input', then the script ran without an error.


5

Your script is trying to save each input to the same output shapefile. Since it is not set to overwrite existing data, it works the first time but not any time after that. The relevant line is: outdata=os.path.normpath(ConversionUtils.gp.GetParameterAsText(1)+path) To fix it, you will need to incorporate the outdata= line into your for input in inputs: ...


4

It is for your own protection. To not get that error, you need to enable this option:. Alternately, change your Output_Workspace to an input parameter rather than an output parameter.


4

You are not opening/closing the file properly. This is how it should be done (check the csv help page): A = [[1.0,153.0016399,-27.6402685],[2.0,153.0783324,-27.4669576]] A_header = ['ID','x','y'] csv_path = os.path.join(r'C:\GIS\Temp', 'Mylist.csv') with open(csv_path,'wb') as csv_file: data_writer = csv.writer(csv_file) data_writer.writerows([...


4

You can avoid ERROR 000725: Table Name: Dataset editViewStormBill already exists. by setting arcpy.env.overwriteOutput = True Otherwise you can use arcpy.ExecuteError to catch the exception and arcpy.GetMessages() to print it out. import arcpy, pythonaddins #Stuff... try: tableView = arcpy.MakeTableView_management(fc, "editView" + str(button2....


3

If you don't want to save a CSV file each time, then you can just use an InsertCursor directly. import arcpy import os outWorkspace = r"C:\data" sr = arcpy.SpatialReference(4326) counter = 1 main_loop_that_does_calculaton: uniqueName = "calculation{0}.shp".format(counter) arcpy.CreateFeatureclass_management(outWorkspace, uniqueName, "POINT", ...


3

You need to put the model up to and including the collects value tool in its own model and expose the collects tool as a parameter. Then put that SUB model into a model and connect its output to your merge tool.


3

You aren't specifying a name for your output shapefile. arcpy is treating out as a file and appending ".shp" for you. You want a unique name for each output so that it isn't overwritten each loop. import os Buffers = ['JF1','JF2','JF3','FF','FB'] # This is a workspace env.workspace = r"C:\Mydirectory" # This is present in the workspace network = "...


2

The message is telling you that Dataset E:\GIS\Data\Final already exists. However the output from Merge should be a feature class or table instead of a folder name so as a test try setting: FinaloutLocation = "E:\\GIS\\Data\\Final\\test.shp"


2

Ok, the first error is easy to avoid. It's failing because you are trying to find the datasource of a group layer, and group layers don't have data sources. Filter the group layers out by doing this: for lyr in arcpy.mapping.ListLayers(mxd, "" ,df): if not lyr.supports("DATASOURCE"): continue #further code here for non-group layers The ...


2

If you are running this in the Python window, then you need go to the Geoprocessing menu -> Geoprocessing Options and check the setting for "Overwrite the outputs of geoprocessing operations". If it is not checked than the script is behaving correctly, since your current setting is not supposed to not let tools overwrite outputs. Once that setting is ...


2

GDAL has a gdaltindex command-line utility that does the same thing you are after: gdaltindex Extent.shp *.jpg The utility was intended for tile indexing for MapServer, but it works just the same for any other purpose. One caveat (which is the same for your script) is that it does not rotate the polygon footprint for rotated rasters.


2

Add a check for whether the buffer feature class exists before you run your buffer. You can use this check to delete the existing buffer, or just print a message. # Script arguments v15_Miles = "15 Miles" #15 Miles Hurricanes_Counties_SpaJoi = "F:\\Projects\\Working\\ModelProject\\ModelData.gdb\\Hurricanes_Counties_SpaJoi" # provide a default value if ...


2

Thanks for the above comments, this has helped me with a solution. The problem was in the source paths but there was also problems with overwriting.


2

This error means that you have already created an output feature class and now the script is trying to overwrite the existing dataset which is not allowed by default. You should either delete this dataset each time prior to run scripts (manually or automatically from the script) or set the environment variable responsible for overwriting outputs to True. ...


2

The workflow you describe works as expected for me in the Python window. Perhaps copy/paste all of the python window session into your question, showing the result of each operation. In short, yes, you can delete items out of the in_memory workspace. >>> arcpy.CopyFeatures_management(r"Exterior Editing\Trees", "in_memory/foo1") <Result '...


2

You could try using CreateUniqueName. This tool appends incrementing numbers to the end of an input name until it finds one that is unique, e.g. temp_graph_3 uniquename = arcpy.CreateUniqueName("temp_graph") arcpy.MakeGraph_management(graph_template, [...], uniquename) arcpy.SaveGraph_management(uniquename, "{0}/{1}_graph.pdf".format(folder, name))


2

It may initially seem counter-intuitive but the location for where you want to write your outputs should be a parameter with a Direction of Input. Your tool dialog asks the user for two inputs: a Raster Dataset a Folder location (where you want to write your outputs)


1

I usually use tempfile import tempfile my_unique_file = tempfile.mktemp(preffix="filename-", suffix=".tiff", dir="/tmp/myoutput/dir")


1

One method I use to create unique file names is to append the current date to the end of the filename. Sample code is below: import os import datetime now = datetime.datetime.now() currentDate = str(now.month) + "_" + str(now.day) + "_" + str(now.year) file_output = os.path.join(r"C:\bla\bla\path\to\folder\filename_" + currentDate) so if you execute the ...


1

If you dont care about the output, You can either delete the prior output before running the loop again as suggested in an above comment or you can enable overwrite. If you want to keep that file you can append an ascending number to the end of the file name with something like this (this worked for me in a different task, but I'm not a python pro so there ...


1

There is a Moving or copying a mosaic dataset page in the Help that specifically talks about moving/copying mosaic datasets. Also you appear to have invalid file paths, "<path to new file gdb>" is not a valid path. If you are trying to hide the actual path, this is not very helpful as the error could be caused by the very thing you are deliberately ...


1

You're trying to split an arcpy object using the os module. You are only renaming the .shp extention of the component file. You are not renaming the shapefile, and all its components. There's an easier way to rename feature classes or shapefiles using the arcpy.Describe function. See more information here. Try this: import os import arcpy from arcpy ...


1

Here is a link to an ArcGIS Toolbox Tool that will loop the Surface Model Tool and write the outputs to a text file. https://github.com/gerry1138/ArcGIS-Loop-Surface-Volumes


1

It looks like this is working for me: import arcpy >>> import os >>> from arcpy import env >>> env.workspace = "C:\FOR MIKEK\GPS Files\GPS_ANDY" >>> for dirname, dirnames, filenames in os.walk("C:\FOR MIKEK\GPS Files\GPS_ANDY"): for subdirname in dirnames: env.workspace = os.path.join(dirname, subdirname) ...


Only top voted, non community-wiki answers of a minimum length are eligible