Hot answers tagged

8

I modified the original code a little bit to avoid some confusion when defining the RasterCenter function, since the argument named raster used in def RasterCenter(raster) and the variable named raster used in raster = arcpy.Raster(raster) within the function can cause confusion and make things not working properly. I modified parsing the path when reading ...


2

I run the process on a server where both the 64-bits and 32-bits versions of Python are installed, as the server holds both ArcGIS Desktop and ArcGIS Server. By default, the 64-bit version is launched, and my script fails. I forced the 32-bit version use by launching the script from the command line, and the update went through successfully. C:\>C:...


2

You're right that using the OBJECTID isn't a good idea, it might change when the data is copied/exported/imported etc. A simple solution is to add a field and copy the OBJECTID to it. See also this technical article from Esri to create sequential numbers in a field using Python in the Field Calculator.


2

If you need to create a variable for the new shapefile name, then you can use "Parse Path". This is a model builder tool where an inline variable can be created and used through the model. You can set this as a model parameter so that the user can input the new shapefile name before running the model. Please see Parse Path (ArcGIS Desktop Help) for more ...


1

Looks like you want to use the first value in a field to rename the output feature class. I would use the feature class as an input rather than whatever C_parameters is. You can just make the input a user defined parameter and they can choose which input to use. Also set Field as a parameter to allow the user to choose which field this will work on. Copy ...


1

I do this all the time. In my particular case I maintain a one-off database that needs to be synchronized with the actively maintained data, but it cannot be overwritten by the original database, since I maintain additional fields in my copy that are not in the original. The fastest approach for this scenario requires the use of dictionaries and cursors. ...


1

The Select Layer by Location tool by itself will not change the data. It sounds like the Union (analysis) tool may be more appropriate. It will assign the attributes of the city to each street segment, and break the streets at city boundaries.


1

I think this is what you're trying to do: import arcpy, itertools, os # Define the input and output workspaces arcpy.env.workspace = r"C:\Users\Jenny\roos" outws = r"C:\Users\Jenny\roos\gmehome.gdb" # List the fcs in your workspace my_pts = arcpy.ListFeatureClasses() DayList = [] # a shiny new empty list.. for ThisFC in my_pts: if ThisFC.upper()....


1

Here's a very simple approach that uses numpy and will handle fields with null values (if you don't want to, then change null_value to any other number): import arcpy fc = "<my fc>" # Get all numeric fields that aren't required. fields = [f.name for f in arcpy.Describe(fc).fields if f.type.upper() in ['DOUBLE', 'INTEGER', 'SINGLE', '...


1

Model builder does not have the functionality you seek, you will need to do this using python. Below is the code that will do this, obviously you need to edit myTable and the parameter "SmallInteger" to suit your needs import arcpy import array myTable = r"C:\Scratch\fGDB_Scratch.gdb\tblTest" # Get list of fields fieldList = [f.name for f in arcpy....


1

No need to export to single bands, there are a couple of ways of adding individual bands directly from the original multiband dataset: double click on the raster dataset in the file dialog. click on the + symbol next to the raster name in the Catalog window in ArcMap (or ArcCatalog). If you can't see any + symbols in the Catalog window tree, click the ...


1

You can do this geoprocessing in QGIS by first making the image bounday of all DTED. This will convert all DTED to polygon shapefiles. Then run the spatial query for touches/intersects between your AOI and DTED polygon. You need to download the Image boundary plugin for this.



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