Tag Info

New answers tagged

1

If your Have field is of type date and you Needed field type is string, you can do it with the following statement in the field calculator of Arcmap: !DateFieldName!.split( )[1]


-2

Have you tried .replace(X,Y) code in python? -replace one with another in the string


2

Take a look at this tool Feature Class To Feature Class (Conversion), the help section contains sample scripts if you want to go the arcpy path. Right clicking on the tool reveals a "batch" option, you can set the names how you want.


2

You could use the Parse Path (ModelBuilder) tool with the input being your MXD. The resulting PATH will be your input to the Create File GDB (Data Management) tool. Below is a simple model showing this. It seems that you cannot use the output value from the Parse path tool as a direct input into the Create File GDB tool. This is probably because the File ...


0

If you want your feature class from your sub model to connect to the Make Feature Layer tool just drop the Collect values tool and expose the MKey_MUL3 output as a parameter in your sub model. Then that should connect in the master model.


0

You can run the output of the Proxy_Background through the copy features tool with the output called in_memory\temp then connect it to your make feature layer tool.


1

If you are running a model from within ArcMap or ArcCatalog, go to Geoprocessing>Geoprocessing Options and put a check in the box next to Overwrite the outputs of geoprocessing operations. If you are going to export your model and run it as a Python script, add this line to your script. arcpy.env.overwriteOutput = 1


2

This can be achieved in several steps. Run a Spatial Join for your buffer polygons and road network layers (right-click the buffer polygons layer in the TOC and choose Join and Relates > Join). You will get an output polygon feature class which contains information on how many road features were located (even partially) within the buffered polygons. ...


1

Here is a bare-bones example (borrowing from both Jim and Richard's answers): import arcpy fc = r'C:\junk\FILE_GDB.gdb\Export_output_gdb' # input feature class field1, field2 = 'Distance', 'Type' # fields to sort, and group fcOut = r'in_memory\blah' # output feature class # set up counters bankcount = 0 churchcount = 0 ...


0

The SearchCursor syntax in the previous comments and posts is outdated and 10 times slower than a data access cursor if you have Desktop 10.1 or later. Only use DA cursors. Here is my script, assuming your categories of banks and churches are in the same field in the feature class, this script will get the top ten items for all categories or only specified ...


1

I think we can handle this using an arcpy.SearchCursor (I still use the Old School SearchCursor) and usage of the arcpy.Select_analysis() tool. The following is probably inefficient but I hope it helps. This assumes the Banks and Churches layer is held in a File Geodatbase (.gdb): import arcpy BanksAndChurches = r'Path\To\BanksAndChurches\FeatureClass' ...


1

Without seeing the model or the exported Python script it is hard to say this definitively but ... If you have the line below in your Python script: arcpy.env.overwriteOutput = True then it should take care of ensuring that what you try to write can be written. Alternatively, you could use two lines like the following to ensure that the outputFC does ...


0

Feature Layers are temporary. Your data currently will only exist for the duration of the model. Per ESRI documentation of Make Feature Layer: Make Feature Layer (Data Management): Creates a feature layer from an input feature class or layer file. The layer that is created by the tool is temporary and will not persist after the session ends ...


2

If Shapefile you can only delete (single delete) one feature set. Or use Iterate with Feature Datasets (Geodatabase) Delete Fields http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000004n000000


2

Personally I would avoid the batch tool approach. Create a sub-model and cycle through the datasets using an iterator deleting the fields as necessary.


1

This code has not been tested, but it should get you going in the right direction: import arcpy from arcpy.sa import * arcpy.env.workspace = "Path/To/Workspace.gdb" arcpy.CheckOutExtension("Spatial") #Static Variables field = "VALUE" #Build list of years rasters = arcpy.ListRasters("x_*, "ALL") #Loop through names, get year and use it to select rasters ...


0

Sounds like you want to derive a field from a layer, this can only be done in a script tool, it is discussed here. You will need to convert the logic of the model into python code.


1

I think the only way to do this currently is to instruct the user to create a point layer (with one point) which is then used as vector layer input in the Processing model. As far as I know, the Processing scripts and models currently don't provide any user interaction capabilities. If you need user interactions, you can write a plugin instead. The plugin ...


0

You're on the right track, you have two inputs: Main_Lanes Seg1_WZ Which when you want to name other files based on those names, you would reference them as: %Main_Lanes% %Seg1_WZ% However, you want your output to have the same name as your Main_Lanes input, but the issue is you're appending _File to your output parameter name, when you should be naming ...


1

I'm not sure where %Name% is coming from, so I may not be able to answer your question entirely, but wrapping something in exclamation points is how you get a value out a field in a python code block. %Name% is a model builder variable, not a field name. So remove the the exclamation points and just use %Name%[3:] and see if that works.


0

I reading this to mean ignore the Height value and use the Points to Line tool in Model Builder.


1

With instances of ArcMap and ArcCatalog no, each one creates a temp session directory in your %TMP% folder called arc<4 hex digits> like arcA7B0 and is thus unique. For instances of python, yes, it happens frequently. Multiple running instances of python scripts started from command line will cause each other to crash randomly. This limitation does not ...


0

You can actually do this in model builder without python but it is finicky and a bit of a workaround. 1) create your model with the iterators for the first reclass and make the reclass table a parameter in the model. 2) right click on your model and set it to batch. 3) Now you have the reclass table as the parameter. 4) Use the + button to add the number ...


0

Note that you don't need to delete the feature in your case. Just make sure that you use a SQL statement together with your "Make FEature Layer" in order to only select the feature that you want to use for processing. You can also use "select layer by attribute" with the "switch" selection if you have a selection. If you really want to delete, you can use ...


2

You could add a Boolean variable and expose it as a parameter then connect it as a precondition to the Make Feature Layer. This will allow ALL layers to be loaded if TRUE or none of them if FALSE. I don't think you can control each layer as this would require you to interact with the model on every iteration and model builder does not work that way.


3

You need to separate your model into two models. As you have it now, the results table gets created with every iteration. Step 1 needs to be in separate model that calls a sub model, which performs the rest of the steps. Refer to this help file on how to set up nested models.


3

A check box means user interaction so you will need to look at using either a Python script tool / Python toolbox or a Python Add-in. What you are actually needing is called a value table. Have a look at this link in the help doco.


3

You will need to create a boolean variable and define it as a model parameter. This will add a check box option when double clicking on the model. OR Create a script tool that runs your code and has a boolean data type. Either way you will have to check the boolean value using an if statement.


0

I found a way to solved it, is not a very best practice solution though. I did it in 3 separate ways. Using model builder I do a batch slope conversion Using python script I get raster properties (MAXIMUM) and do a mathematic calculation of it then write the result into a dbf file (you need this http://dbfpy.sourceforge.net/) Using model builder I do ...


3

in the code block you'll define a function, and then in the expression, you'll call the function with the needed field names, like so : Code block : def picture_name(current_name, map_number): return current_name[current_name.rindex("\\"):] + "|" + map_number + ".tif" Expression : picture_name(!Pictures!, !MapNumber!) I haven't test this code, ...


-1

There is a cheap add-on called ET GeoWizards for ArcGIS that makes this easy and it does lots of other great tricks. It's built by Ianko Tchoukanski.


2

You have made the classic mistake that people do when they start using an iterator. EVERYTHING runs in a model that has an iterator. So everything up to and including the collects tool must be in a sub model. Expose the collects tool as a parameter. Then drag that model into the master model which has the merge tool. Connect your output from your sub model ...



Top 50 recent answers are included