Tag Info

New answers tagged

0

I can't find a recent example of this, or an example in C#, but you can call any tool in your toolbox (including custom models) via ArcObjects. This older example in VBA provides the basic structure for this process. EDIT: This more recent example makes use of the modern geoprocessor to call a custom toolbox and execute a tool. There are VB and C# ...


1

I wrote some VB code to try and handle this with an if/then, seemed a bit more simple than python. Here is the code, %BlockID (in quotes)% is the user input value, [BlockID] is the field being evaluated/written, and Expression = "Output". If IsNull([BlockID]) Then Output = %Block (in quotes)% Elseif [BlockID] <= "" Then Output = %Block (in quotes)% ...


2

This function will give you an angle (courtesy of Curtis Price): def get_angle(xy1, xy2): arcpy.AddMessage(xy1) """Calculate azimuth angle from two points. (Zero is north.)""" try: # ArcPy point objects x1, y1, x2, y2 = xy1.X, xy1.Y, xy2.X, xy2.Y except: # xy strings, e.g. "0 0" if isinstance(xy1, basestring) ...


0

I solved it using the JSON to Features tool. I write my inputFeature value to a json file using a web method which is saved in a predefined location. After the json file is over written i call my gp service. And from now on i will make sure none of my services will have complex data types as parameters.


1

Yes, atleast with QGIS 2.6.1. In the Processing Toolbox, right-click your model and select the Edit rendering styles for outputs: Then locate your style file: Hope this helps!


2

There are two ways to accomplish this. In ArcMap load the layer in question and edit the symbology of the layer to your desired results. Then click ‘Save As’ in the Symbol Selector window and Name the symbology exactly the same name as the data layer. Now whenever that data layer is loaded in to ArcMap it will acquire the symbology with the same name. ...


0

Problem Solved: Initially the input files (for O-D and barriers) were saved in GDB, and they did not have the FID for each entry. Then when the input files were saved as shape files (not in any GDB), it got FID values. Then it started to give me correct results for all of them. But I don't know what difference that made on adding the points and barrier ...


0

As your data follows a pattern of A1 matches B1 and A2 matches B2, etc you can achieve your processing using a FOR iterator and inline substitution to pass the matching numeric part. The model would look as below: By selecting from each layer their matching counterparts (e.g. A100 and B100) the clip tool will honor these selections during the clip. Make ...


2

In your case you could also use the raster calculator directly, because you have constant intervals Int("your_raster"/200) then you can use raster to polygon


2

I think an easier way to do this would be to use the Reclassify tool. You'll need the Spatial Analyst Extension. Then, you just use the Raster to Polygon tool. If you don't have spatial analyst, there are open source options. Just search this site for reclassify.


0

Without trying to understand everything that you have written, I suspect that your fishnet may have either an incorrect or an Undefined coordinate system. The Create Fishnet documentation says: The coordinate system of the output can be set either by entering a feature class or layer in the Template Extent parameter or by setting the Output ...


0

Try to add "Minimum Bounding Geometry(with Geometry Type of RECTANGLE_BY_AREA)" before "Create Fishnet" in your model. It works to me.


2

This is a problem that I've encountered many times, getting a disc full of tiles and needing to find the ones that are in/near an area to subset the rasters for building VRT, mosaic dataset or mosaicing (depending on requirements)... I am not aware of any tool in Model Builder that will help with this, there is a limit to what can be done in model builder, ...


1

You are so close to the answer but in your comments you have mentioned your need to select that line based on attributes and not spatial criteria. As Michael and PolyGeo answered your questions in the comments, You can use Select from Analysis toolbox or Make Feature Layer (with where clause) to select that specific line and then buffer it. Here is the ...


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



Top 50 recent answers are included