Tag Info

Hot answers tagged

10

If you wanted to do this and not bother with the code block, just express this as a logical Python statement in the expression parameter. {!field2! if !field1! is not 0 else !field1!}


10

In the code block window, using python as parser: def my_calculate(field1_value, field2_value): if field1_value == 0: return 0 else: return field2_value In the expression window: my_calculate(!field1!, !field2!) This could also be done by using the "Select Features by Attribute" and selecting all the features with 0 in field 1, calculating ...


8

There is actually an ArcGIS tool specifically for this task: Convert Time Field. You don't even need to use the Field Calculator. Just specify the format of the source date/time field and your desired output format and the tool will create a new field and populate it with the converted values. It can be used for converting dates, times, or a combination of ...


4

Use the cursor.updateRow(field) instead of cursor.updateRow([field]). You should supply an object, not the list.


4

esri leaflet is an alternative to the ArcGIS API for JavaScript, not something that makes much sense to try and combine. L.esri.DynamicMapLayer provides comparable functionality (within Leaflet) for loading dynamic map services published to ArcGIS Server to the class 'esri/layers/ArcGISDynamicMapServiceLayer' in the JSAPI please check out the esri leaflet ...


3

You're using an expression type of 'PYTHON', but to support the calculation you're trying, you need to use 'PYTHON_9.3'.


3

Adding to MC5's answer, I get this info using the LMUTIL.EXE in the license manager ..\bin folder. Here is the DOS command I use: lmutil lmstat -a -c @LMservername Regarding "inactive" licenses, there is no way to get anything like this using Flexera. I've tried and ESRI has confirmed it is not possible. All the LM will tell you is who is connected and ...


3

You say you've read some stuff that has still not helped you. The ESRI help is really good, so hopefully after following the steps below you can go back to the documentation and learn more about this process. There are normal toolboxes (.tbx) and python toolboxes (.pyt) but to the user they act the same. The following is the procedure for a script tool in ...


3

Use the built-in str.translate(table[, deletechars]), but with None for the table argument (requires at least Python 2.6). E.g.: 'N. First St., Unit #1'.translate(None, '.,#') shows: 'N First St Unit 1' Or for ArcGIS' calculator, this can be a one-liner: !yourField!.translate(None, '.,#')


3

In getParameterInfo, set a dependency between the two parameters. units.parameterDependencies = [inFC.name]


3

If you have the unique IDs in an Excel file, you can join this file to your points feature class and then query on the joined file. See Esri's information on joining Excel files to feature classes. Say that your feature class has a field IdRPL, and your Excel file has IDs in a field called UniqueID. Right-click on your feature class and choose Joins and ...


3

A query layer pointing to the original DB of features would allow you to generate a limited version of your dataset. A query layer uses full SQL, rather than the limited SQL available in a definition query. Your select statement should only include the desired fields instead of the default "Select *." ...


3

A definition query cannot hide columns of data. It is used to filter out rows of your data. For what you want to do I would either create a view of your feature class that doesn't include the columns you want to hide or if you are publishing this as a map service you can turn those columns off within the map document. Within ArcMap right click the layer ...


3

You are describing things that are actually handled in a couple of different ways in the network. First, one way (also known as direction of travel) is handled by a one way attribute for the network edge (the lines). You can get more info about that from my answer at Does OSM data contain the direction of travel? Next, when you talk about modeling ...


3

Move your "is None" check up to the first evaluation. if Btype is None: return 'Olive' elif (Btype.startswith('Fig')): return 'Grape' elif(Btype.startswith('Lychee')): return 'Mango' Basically, if Btype is null, you can't do .startswith, etc. on it.


3

If you suspect the vector streams are incorrect, I'd start by trying a different data source but often this is approached the other way by burning the streams into the DEM. Convert Vector Streams to Raster with a value of 1 Use the Con tool or the "Minus" tool (under Math) in Spatial Analyst to subtract values in the DEM. This will create a DEM with ...


3

Set up Enterprise Geodatabase The Create Enterprise Geodatabase tool creates a database, storage locations, and a database user to be used as the geodatabase administrator and owner of the geodatabase depending on the database management system (DBMS) used. It grants the geodatabase administrator privileges required to create a geodatabase, then ...


3

PerfQAnalyzer does just that. From that page: In the Spring of 2012 we released the PerfQAnalyzer tool, which assists users in capturing render and edit times within ArcGIS for Desktop. This tool is a free, unsupported, downloadable tool offered to the Esri user community which can be run from within ArcMap (as an add-in) or as a stand-alone ArcGIS ...


3

Your function is not returning anything. I've modified your code to return the value of aspect_m60. # Calculate Field import arcpy # Set environment settings arcpy.env.workspace = "c:/W/Sik" # Set local variables inTable = "Point" fieldName = "aspect_m60" expression = "getCalc(!aspect!)" codeblock = """def getCalc(aspect): if (aspect < 60): ...


3

It is much more intuitive, in my opinion, to work with Cursors (rather than trying to emulate the field calculator in a script) for this type of problem. This is how you would port the problem over to an Update Cursor: import arcpy # The input FC fc = "C:/W/Sik.gdb/yourFC" with arcpy.da.UpdateCursor(fc, ["aspect", "aspect_m60"]) as cursor: for row in ...


3

I would usually suggest the da.SearchCursor as well, but its order by clause only works withe data in a database. So, if it is in a database: a_table = "YourTable" order_fld = "Time" return_flds = ["Time", "SomeOtherField"] where_str = """Time > DATEADD(minute, -2, GETDATE())""" sql_clause = (None,'ORDER BY {} DESC'.format(order_fld)) last_row = '' ...


2

Not that I"m aware of, one quick alternative would be: Select Index layer features to exclude In attribute table, switch selection of features Use the Selected option for exporting pages See image below: You could add that idea here: ArcGIS Ideas


2

This is potentially a very difficult problem when the borders are ragged. A brute-force search of the optimum could require computational time that is proportional to the square of the number of cells in the image (a value that often will be in the billions, trillions, or greater). One promising approach is to relax the conditions a little bit and actually ...


2

It definitely should. One of the ways to test it is to publish a map service and access it with REST Service Directory JS API Viewer. Then go ahead and edit the attributes and geometry of a certain feature. If this attribute is used as the symbology field, after refreshing the page or zooming in and out (forcing the map image to re-draw), you will see ...


2

Think you have to modify the model environment variable for fields not to use qualified field names...I don't remember doing that in a model but in principle it is the equivalent of turning 'off' (setting to false) with arcpy.env.qualifiedFieldNames = False, see this: http://desktop.arcgis.com/en/desktop/latest/tools/environments/qualified-field-names.htm ...


2

You need to make sure the pageNum is an integer, and you need to split the input values. For this example, you'll need to enter the pages like 1, 2, 3 with spaces. Give this a try: import arcpy mxd = arcpy.mapping.MapDocument("E:\\User Folders\\Recreation.mxd") ddp = mxd.dataDrivenPages pageNumbers = raw_input("Enter Page/s: ") for pageNum in ...


2

'Export data' does not retain subtypes...use one of the geoprocessing tools like 'Copy Features' or 'Feature Class To Feature Class' -- if you do this within the same ArcGIS process or 'session' as I like to think of it as (such as the current map doc within which you have interactively selected features), then selected features are honored, subtypes are ...


2

Suggesting a workflow: Starting point is after the creation of Buffer B. For Buffer A use the multiple ring buffer creating two buffers. The original one and another one which is 1.5 times the distance. E.g 12 meters and 8 meters. For buffer B open a new field (float, named "expand"), and feed it with [BUFF_Distance]/2 Use intersect to create an ...


2

A quick solution to this is to set the Options for the Editor as required and save the map document. When users will open this .mxd all the settings will be preserved. Alternatively, you could put the saved map document into the C:\Users\%user%\AppData\Roaming\ESRI\Desktop10.2\ArcMap\Templates. Then this document will appear in the list of available options ...


2

Since it looks like you are running this in a separate arcpy script (as opposed to inside the Field Calculator), there may not be a need to use Code Blocks. Maybe better to use an UpdateCursor... From what I can tell from the code, you are testing to see if the field you need to fill is either Null or 0, and if it is, fill the field with the value from the ...



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