Using Python function in ArcPy script?
I have an script to transform DN into Reflectance of each band of several images. The unique variable of the equation, apart of the Band itself, is the Divisor: (B1 – 1) / 508 (B2 – 1) / 254 (B3 – 1) /...
View ArticleAuto adding map elements using ArcPy? [closed]
I am very new with Python scripting in ArcGIS Desktop. Just wondering if there is a way to auto add in map elements?
View ArticleValid input for ArcPy raster to polygon in 10.1?
I’m experiencing some strange problems with this code starting from files with *.tif.tif to what seems should be *.tif.tif.shp according to the code. The code is not working because of the...
View ArticleUsing arcpy.gp.Int_sa in ArcMap gives Error 000824: The tool is not licensed?
My Arcpy code is not working in ArcMap 10.1 because an error with the last line: Error 000824: The tool is not licensed. I have all my extensions turned on, so I don’t know why I would be getting this...
View Articleimport arcpy failed Python 2.7 with ArcGIS 10.3 64-bit Background...
I want to run a python script that uses arcpy. It was running earlier on a 32-bit machine without problems. On a 64-bit machine I get a MemoryError. The 64-bit backgroundgeoprocessing of ArcGIS 10.3...
View ArticleExport feature classes in geodatabase to CSVs
I am trying to export feature classes within a geodatabase to CSV format using “Export Feature Attribute to ASCII” in ArCGIS. I am getting the following error Traceback (most recent call last): File...
View ArticleHow to access Spatial Analyst extension from stand alone script?
If I run this script: import arcpy arcpy.AddMessage(arcpy.CheckExtension("Spatial")) from arcpy.sa import Con from arcpy import env fDir=r'd:scratchfdir' outFolder=r'd:aerialsimages' env.workspace =...
View ArticlePortal for ArcGIS WMTS layers are optimised & un-cacheable
When a WMTS in Portal for ArcGIS 10.3.1 is opened (via Portal) in an mxd, the WMTS layer properties are not standard. The; Source, Layers, and Advanced tabs are missing. When the portal WMTS layer used...
View ArticleIs there a site with templates for Arcpy where I can just fill in the blanks?
I have a Shapefile containing near 7000 pour points across the globe (GCS, WGS84). I’m using the following model to select the first feature point of the Shapefile, copy the selected feature in a new...
View ArticlePython Script to Add Multiple Fields to Feature Classes
I am trying to add 2 (multiple) fields to each feature class in a gdb. I based the script off of Python Script to Add Fields to Feature Classes. I feel like I am missing something and can’t figure it...
View ArticleHow to combine two rasters based on the relationship to a polygon mask?
I am looking to combine two single-band, 1-bit rasters of the same spatial extent based on their relationship to a polygon (mask). The image shows a polygon displayed with a cross-hatch and the two...
View ArticleGeocoding arcpy slow startup time
When scripting with arcpy.GeocodeAddress_geocoding (http://resources.arcgis.com/en/help/main/10.2/index.html#//002600000006000000), there’s always a major lag to start up the geocoder. The issue here...
View ArticleKeeping layer name when exporting to CAD?
I am trying to export selected features from layers from SDE into a DXF using python, but it does not retain the layer name. But if I do it manually using the ArcToolbox tool, it does work. Example...
View ArticlePerfom SQL queries in Python and process the result
I query column names from a PostGIS table with following Python code: colnames = [] sql_getcolumns = "select column_name from information_schema.columns where table_name='shp2py';"...
View ArticleClipping Feature Classes by Data View Extents with ArcPy?
Have a fully functional script about 90% of the time. It is that 10% that is really bothering me and I cannot seem to deduce a solution. Script will take the user defined dataframe view extents and...
View ArticleArcpy scripts run time dialog keeps deactivating tkinter window
I’m using tkinter in my scripts to get field names of the user in case the hard coded field names were not found in the target feature. it runs from python IDE, but when run from arcmaps toolbox the...
View ArticleArcMap 'in_memory' trouble?
Being new to ArcMap, and ArcPy I have a problem with a script including several geoprocessing functions. The number of functions inspired a search for a means to save outputs (subsequent inputs) to...
View ArticleConverting points using FeatureClassToNumPyArray to interpolate cross-section...
I’m trying to plot elevation cross section and extract elevations along a cross section using scipy’s “interpolate” function. I’m converting a point feature class of profile elevation points to 2 numpy...
View ArticleInserting accumulative attribute in dynamic text element based on Date field...
I’ve got a line feature class that contains Date field. I’ve made a layout view in order to display time animation of this feature class. I’ve managed to enable the time option in the layer and to...
View ArticleValue Error with Float/Integer/double Fields in Python?
When running this Code: import arcpy from arcpy import env import os #Specify the map document and the data frame mxd = arcpy.mapping.MapDocument(r"G:\PythonCode\mxd_test.mxd") env.workspace =...
View Article