Tag Info

New answers tagged

1

I would avoid using ArcGIS (arcpy) in this case and do this using a pure Python solution. This will be faster and much cleaner. Since you are renaming tif files you do not need to use ListRasters() or arcpy.Rename()...see this example: import os import glob def rename_files(new_names_file, file_folder): files_list = glob.glob(os.path.join(file_folder, ...


3

You can do this sort of renaming by utilizing enumerate. The general idea is to add an index with each raster name and then call that index to reference the specific item in the text file list. import arcpy arcpy.env.workspace = r'C:\path\to\input\rasters' txtfile = r'C:\path\to\textfile.txt' # Generate a list of items from text file with open(txtfile, ...


0

I was able to take the answer @DWynne gave me for Python Toolbox Error Messages and apply it to this problem. The issue of enabling/disabling ID, Begin and End Measure fields using updateParameters was a red herring. Instead, preventing the user from even selecting bad data (i.e. a polygon feature) could be handled using the updateMessages method. def ...


1

Arcpy geoprocessing fails with file names that contain special characters like spaces or periods. I ran into this recently when I was able to use os.walk to read file names that contained periods, but arcpy.da.walk failed. I learned more about this problem in the help topic "Validating table and field names in Python". Please try your script again with no ...


2

Geoprocessing tools (with the exception of Spatial Analyst tools) return a Result object, which is what arcpy.ApplySymbologyFromLayer_management returns here. It doesn't have a save method. You may be getting this mixed up with a MapDocument or Layer object.


0

The code number 102988 is not an EPSG one, but defined by ESRI. If you run gdalsrsinfo on the projection file, it reports: +proj=tmerc +lat_0=31 +lon_0=-111.9166666666667 +k=0.9999 +x_0=213360 +y_0=0 +ellps=GRS80 +units=m +no_defs You have to create a custom CRS with these parameters to work with the dataset. GDAL comes with a similar CRS named ...


2

I think it might be because you do not add a layer to Mxd in code, because if it is in accordance with your code, the final layer will only exist in memory, and will not be automatically added to your Mxd, so when you keep Mxd when the layer will not be saved. Therefore, you need to add this section of code. # AddJoin ...


0

As I mentioned before, the "AttributeError: 'NoneType' object has no attribute 'issparse'" error occurs the second and subsequent times I run the tool containing DBSCAN for a given feature layer. For a clean exit, I put a "try" block around the DBSCAN call. try: db = DBSCAN(eps, min_samples).fit(X) except AttributeError: arcpy.AddError("Error ...


2

I had set pythonpath to my default python 2.7.9 installation in the environment variables. i.e i had PYTHONPATH = path/to/python/site-packages Removing this resolved the issue.


2

I faced the same issue, which seems to be related to the integration of the raster module in django 1.8's gis extension. I think I found where the problem comes from. Looking at django.contrib.gis.gdal.libgal, you can see this: ..| 47| # This loads the GDAL/OGR C library 48| lgdal = CDLL(lib_path) 49| 50| # On Windows, the GDAL binaries have some OSR ...


0

If you want to calculate the sum of the depth , texture , drainage and slope into one a new field sum of (depth , texture , drainage and slope) then you can use the field calculator (using either python or vba code). Create a new field within your shapefile and then follow the syntax in the link. You might have to make sure all of the fields are the correct ...


1

No error if you put only gdal_retile. See image below: If you want to run gdal in the IDLE Python GUI or in the MS-DOS Console you can try this: gdal ImportError in python on Windows



Top 50 recent answers are included