Tag Info

New answers tagged

0

Do an OS walk to iterate all folders and sub folders. For each folder list all the feature class. Split the name of the feature class at your underscore and compose a list, then process that list so the names are unique. Use those unique names as a wild card while relisting all the feature class in the same folder. Lastly run it through the merge tool. I ...


0

Ok folks, I figured it out. First, the problem was not that some file called 'arc' was missing. The problem was that the select data tool would put an empty folder in the 'Output Values' list that would then cause problems in the Featureclass to Shapefile conversion tool as it was trying to convert null values. As was suggested throughout this thread, I ...


0

From the screen shot it looks like you are starting the output names with a number? Geodatabase tables are not allowed to start with a number or have spaces in them.


0

Another alternative to skipping errors would be to instead pre-test for issues that would lead to errors. So, in your example above, after you iterate to the next raster, you could write a small Python script that could pre-test the raster and either pass or fail the raster, at which point your model could read the results (True/False?) either pass the ...


0

This is how I would do it in model builder: Your sub-model takes a geodatabase and collects the contents into a list The Master model calls the sub-model but this has a precondition on it which is the calculate tool. This has a tiny piece of python code to test if the input geodatabase has a feature class called arc. You could adapt this for folders. ...


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 """ ...


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}) ...


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.


0

I have eventually got it working with SearchCursor and Select_analysis arcpy.env.workspace = strInPath # create a set to hold the attributes attributes=set([]) # ---- create a list of feature classes in the current workspace ---- listOfFeatures = arcpy.SearchCursor(strInPath,"","",strFieldName,"") for row in listOfFeatures: ...


0

You can use the Join Field tool within ModelBuilder to add fields from a table to a feature class/shapefile based on a join, without the need to export a new file to make the join permanent.


0

I'm not familiar with the Iterate Feature Selection tools in ModelBuilder, but exporting just that as Python code indicate that they can be called using arcpy. # Created on: 2015-05-19 15:26:10.00000 # (generated by ArcGIS/ModelBuilder) # Description: # --------------------------------------------------------------------------- # Import arcpy module ...


0

You can use a geometry token (SHAPE@) within Copy Features (Data Management) to export each feature. import arcpy, os shp = r'C:\temp\yourSHP.shp' outws = r'C:\temp' with arcpy.da.SearchCursor(shp, ["OBJECTID","SHAPE@"]) as cursor: for row in cursor: outfc = os.path.join(outws, "fc" + str(row[0])) arcpy.CopyFeatures_management(row[1], ...


0

In Arcpy, Cursors honor layer/TableView selections. By according to this SE question, you can simply iterate feature selections. However if you want to make a selection using arcpy, use SelectLayerByAttribute_management tool.


0

You need a subtle change to your model. See the image below: Configure Expression parameter of Calculate Value like this: Set Output Dataset or FeatureClass parameter of Project tool to %output_value%


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

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 ...


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. ...


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

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 ...


0

Looking at your screen shot I cannot see any immediate problem with the general workflow of it. I would imagine (based upon the reported error message) that you have not set up the iterator correctly. Did you set the group by field? If not, the iterator would serve out the entire point dataset. You need to set the group by field to a field that will ...


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 ...


0

Here is the model that worked for me. Note that you have to turn your 'intersect' and 'switch selection' into TWO parts in the model. In my model I was intersecting the Feature layer with the outline of the United States. In the final step I used 'Copy Features' to create a feature class that will appear on my map.


0

Python Script List all columns from every FC within a dataset GIS 10.1 SP 1, FGDB import arcpy import os arcpy.env.workspace = "C:\NBU_GIS_10_1\NBU_GIS_10_1_GDB\NBU_GIS_10_1_GDB.gdb" datasets = arcpy.ListDatasets(feature_type='feature') print datasets for ds in datasets: for fc in arcpy.ListFeatureClasses(feature_dataset=ds): path = ...


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" ...


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 ...


0

Have you tried creating a variable of the type 'Extent', and using that as a variable? Some additional string manipulation will likely be required to coerce your string into a format that ModelBuilder can recognize as an extent (ModelBuilder is misery for working with datatypes).


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 ...


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" <> ...


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!)


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 ...


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 ...


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 ...


0

So, just to get this clear:) When in doubt if your single polygon feature class contains self-overlapping polygons, and when this constitutes an error in your final product, you could run the intersect tool. I didn't know that the tool itself could handle a single input, but it turned out that it works in precisely the same way which it would have done when ...


1

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


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. ...


0

nmperterson is correct with the naming rules. Names must begin with a letter, not a number or special character such as an asterisk (*) or percent sign (%). However, this was not the full solution to the problem. What was done to carry over the Name 20130101 to the output file in my case was utilizing the Parse Path Function and outputting a new Variable ...


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 ...


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.


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


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 ...


0

If you are creating the buffers from line segments, then you could always try using the following with a Standard License - Convert the polyline feature class being buffered into a [Route] using create route within the Linear Referencing Toolbox, Then within the feature class properties dialog, click on the [Hatches] tab, Then you could add a Hatch that is ...


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 ...



Top 50 recent answers are included