Tag Info

Hot answers tagged

4

To update the field values, your function needs to include a return statement, like so. def function(A,C): if (A == 0): A = (C/3) if A < 1: A = 1 return A The reason you get the 'The field is not nullable' error is that shapefiles don't support nulls and since your function didn't explicitly return anything, it is trying to Calculate ...


4

Sounds like the original model was developed in ArcMap. If you look at the syntax section of the help for the Select Layer By Attribute tool it explicitly states the data type of the input layer to be a feature layer or table view. If you are running your model from ArcCatalog and navigating to the dataset in the folder then you are accessing the source data ...


3

You're in need of a global variable where you can increment your new fid_1 field as CalculateField moves from record to record. Substitute this in for your last few lines of code: (Your first record will have a value of 0, the second will be 1, the third will be 2,...) codeblock = """id = -1 def getCalc(): global id id += 1 return id """ ...


3

Use the Get Count and Calculate Field tools. Make sure the output of Get Count is a precondition for Calculate Field. The output of Get Count is passed to Calculate Field via in-line variable substitution. E.g.


3

I would do this the other way around from current comments/answer. I am assuming your scenario changes are where the flood values, not the buildings, change. Convert your buildings to raster with Polygon to Raster, using your flood raster as the extents and matching cell size/row column count/etc. There is some risk that a resulting cell won't be classed as ...


3

This is probably a bit of a roundabout way of performing this analysis, but I just did a quick test and it worked for me: Use the Raster to Polygon tool convert your raster, with the simplify polygons option unchecked. This should provide a polygon representation of the raster cells with the 'gridcode' attribute being the value of the raster cells. ...


3

I would recommend the Parse Path tool in ModelBuilder. Make sure to select the "Name" parse type. In this (very simplified) model, I included a "workspace" variable that I can call at any point and combine with the name value from the parse path output. The syntax for that would be %Workspace%\%Value% in the output path parameter. You should also attach ...


3

I think you are encountering a limitation of the Dissolve tool which is described in its documentation: • The availability of physical memory may limit the amount (and complexity) of input features that can be processed and dissolved into a single output feature. This limitation could cause an error to occur, as the dissolve process may require ...


2

Use the Dissolve (Data Management) tool, select your number and material fields, then click OK. I'm not sure if the lengths will be added, but a simple "Calculate Geometry" length should fix that.


2

You may use the Merge tool: Combines multiple input datasets of the same data type into a single, new output dataset. This tool can combine point, line, or polygon feature classes or tables. Open you model drag in the Merge tool, double click on in and add the many gdb tables within the input parameter, define out name and location, and then save ...


2

In this screen shot I have wind turbines and randomly buffered 10km around 4 different ones. I manually selected the lower left buffer, ran the model and got a result - you can see that 4 turbines exist in this buffered area and only this area (no overlap to the other areas) Heres the model. I noted the type of selection required for each tool. The dashed ...


2

There two things going on here. '==' evaulates truth, while '=' assigns the value. A == (C/3) translates to: does A = C/3? No. This returns False. As DWynne also points out, you need to return a value. def function(A,C): if (A == 0): A = C/3 return A function(!A!,!C!)


2

It looks like you don't actually produce an output from your tool, only modify the input file. Although you have an argument for outFc you're not creating the output. Notice: all fields added and field calculations are performed on the input feature class. If you change your outFc to: outFc = arcpy.GetParameterAsText(2) the user can specify an output ...


1

I would've just commented but my rep is too low. As Stimson has suggested, go Python. I would think that a simple if statement with the conversion process nested inside of it would work. So: for fc in arcpy.ListFeatureClasses(): if arcpy.Exists('arc'): SelectData_mb (in_dataelement, {out_dataelement}) ...


1

You're using the selection tools incorrectly. Specifically, you're running two side by side and then adding a third when you just need two chained together. The output of your select by location should feed into your select by attributes. The current active selection is a single thing, so first you select within your buffer, then from that selection you ...


1

As I stated in my comment one solution is: Add in 21 project tools into MOdelBuilder Define the input and output for the 21 tools Add in the merge tool and source all the project tool outputs as the input for the merge tool Or, the work around you noted: Add in the feature class iterater and run fc through the Project tool Reference output object of ...


1

In a model, this is just a combination of Calculate Value and Calculate Field. Use a bit of Python code/cursors in Calculate Value to pull out the first value from the data source. If your data elements are different in your model, adjust the use of '%Feature Class%' and '%Field Name%' as appropriate. And then hook that up to Calculate Field. With ...


1

I would recommend using Erdas to build the pyramids. Not only can you build pyramids in batch mode using multiple cores, but you will avoid the ArcGIS/Erdas pyramid incompatibility issue (i.e. pyramids built in ArcGIS are not recognized by Erdas). However, if you need to build pyramids using ArcGIS, you will want to make sure to check the "Recursive" ...


1

I want to offer an alternative solution following up on your last paragraph, which is easily accomplished in a single analysis without the need for iteration or even Model Builder unless you wish to repeat it many times. You cannot use the Near tool in this case, as that only returns the closest feature. You could use the Generate Near Table tool with an ...


1

It's possible in model builder. You could do a series of selections. For example, for Wind Farm A: Select Layer by Location tool to get points within buffer of Wind Farm A Select Layer by Attribute tool (to filter out those that belong to other wind farms, based on their 'name' attribute, or whatever it is). You could use an expression like "name" <> ...


1

You should use each select operation one at a time. The first one, that is in your model should be defined as NEW_SELECTION only; Then use another Select Layer by Location (or by Attributes, it shouldn't matter) on the output of the first Selection, and choose SWITCH_SELECTION without defining any expression. This should do the job. EDIT: Further ...


1

You run your model from ArcMap which is aware of the Database Connections folder present in Catalog window. However when you execute your code in an external Python file, the arcpy cannot find the Database Connections. You need to supply the .sde connection file stored somewhere on your disk. I always recommend use an .sde file even in models. You can find ...


1

The USGS phenology project might inspire you a little. http://phenology.cr.usgs.gov/other_resources.php


1

Geodatabase feature class (and raster, etc.) naming rules: Names must begin with a letter, not a number or special character such as an asterisk (*) or percent sign (%). Names should not contain spaces. If you have a two-part name for your table or feature class, connect the words with an underscore (_), for example, garbage_routes. Names should not ...


1

Are you saying once you run this model you end up with one table, the last worksheet in your workbook? You need to be using inline substitution. Use the Name variable coming out of the iterator in your output featureclass in the project tool. An example would be c:\temp\myData_%Name%.shp


1

The process seems to involve two steps: KML To Layer to convert a KML file to a geodatabase feature class (it cannot create a shapefile as output) Feature Class To Feature Class to convert a geodatabase feature class to a shapefile Consequently you should be able to: open a new model drag these two tools in join the output of 1. to the input of 2. ...



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