Questions tagged [python-parser]

For questions about ArcGIS Python Parser for labelling expressions and field calculations

Filter by
Sorted by
Tagged with
2
votes
1answer
547 views

Specifying Font Size/Style in Label Expression?

I want to create a label expression with two lines of text, this should be simple but I'm having a lot of trouble. Basically, I need the top line to be 10 pt font, and the next line to be 8pt font ...
2
votes
1answer
512 views

Calculating row in field based off another row in same field using ArcGIS Field Calculator?

An attributes table has 3 fields: ID, Field1, and Field2 and looks something like this: ID | Field1 | Field2 1. | text......| 10 2. | text......| NULL 3. | text2....| NULL 4. | text2....| ...
2
votes
1answer
825 views

Replacing characters after certain word in Python parser of ArcGIS Field Calculator?

I have a table with field which contains path to database. The same thing in this field will be the extension of file. Here is how it looks like D:\Проекты\Москва для тестов\Test.gdb\graf_fd I need ...
2
votes
1answer
261 views

Python if, and, or to compare field values and assign new value

I have 3 fields in a table that i need to evaluate and return a new value based on the results using the field calculator (PYTHON) They are: SETSPAID (long) This field must = 0 TYPEOFSERVICE (string)...
2
votes
1answer
716 views

ERROR 000539: Invalid Field !FULLNAME!

I am very new to Python and my first attempt hasn't gone too well. I'm trying to overwrite a field that is a spatial join of a couple of features in order to, in the end, generate a beginning and ...
2
votes
1answer
2k views

Concatenate fields in Field Calculator using Python [duplicate]

I'm trying to concatenate fields together and used this post as a guide: <Adding hyphen in ArcGIS Field Calculator to merge two columns?> ; however, I'm still getting a 989 parsing error. Here's ...
2
votes
1answer
117 views

Python codeblock to remove numeric characters from a column not working

I am trying to make use of a codeblock found in this thread: Removing numeric characters from alphanumeric value in field calculation? I put this code into the pre-logic script field of the field ...
2
votes
1answer
8k views

Converting values in datetime field to strings in text field using Python parser of ArcGIS for Desktop?

In the attribute table of my file geodatabase feature class I have a populated field called DateField of type date, and a text field called TextField. I have not yet hit on a way to convert the dates ...
2
votes
1answer
473 views

ERROR 000989 Issue with Python Script and Field Calculating distance between two long lat points

very new to scripting and I have been struggling with my script for a while. I'm not sure why it doesn't work in field calculator. I am trying to calculate a list of distance between two long lat ...
2
votes
2answers
8k views

Writing Python script in Field Calculator in ArcGIS Desktop?

I'm a programmer, I have programmed in C#, Java, but not with Python. And I'm not a geographic worker. How can I write a python script into Field Calculator to be able to check the other column value. ...
2
votes
1answer
165 views

Scoring fields between 0 and 1 using ArcGIS field calculator?

I am starting to get to know ArcGIS 10.2.1 and I need to the following, but I am not sure how to build the expression into the FIELD CALCULATOR: I need to add first a new field called ...
2
votes
2answers
51 views

Finding and replacing with if then else statement in field calculator of ArcGIS Pro?

I have a column of strings that always start with the first two characters being numbers, like 39 or 07, etc. In a new column I want to process the original column so that I replace any of those ...
2
votes
1answer
52 views

Keeping only 7 digit number within field name using ArcGIS Pro field calculator and regex

I have a field titled GEOGRAPHY, which contains hundreds of records containing various strings of all similar format, for example: "Witless Bay (1001559) T 00000 ( 6.5%)" "Laniel (2485905) NO ...
2
votes
1answer
22 views

Modify script so only empty fields are changed in ArcGIS Pro?

I currently use a script that converts the integer in OBJECTID to a string and combines it with another string (in this case UAW,) to populate a field Field = str(!OBJECTID!) + "UAW" Now that I have ...
2
votes
1answer
24 views

Splitting ID number along hyphens and creating new field with only parts of ID In Field Calculator?

I have a shapefile with polygons and each polygon has an ID number that follows a pattern like this: SMP_ID 1077-1-1 8-2-2 1281-1-3 304-2-1 In have created a new field and I need to populate it ...
2
votes
1answer
309 views

Calling %Variable% in Python Code Block in ModelBuilder?

I have a parameter in a ModelBuilder model I am running that defines the geodatabase that all of the temporary files will be written to. I need to be able to call that variable in a field calculator ...
2
votes
1answer
42 views

Conditionally omitting field values while calculating new field in ArcGIS Desktop?

I have six fields in a table and I want to calculate a new field based on a formula using these six fields. Suppose the formula is simply: newField = field1 + field2 + field3 + field4 + field5 + ...
2
votes
1answer
44 views

Using Field Calculator to correct the nomenclature of APN values

I am currently working (in ArcMap 10.4) with two datasets that use different nomenclature for their assessor parcel numbers (APN) values. In one dataset the APN is a string dataset with the format "...
2
votes
1answer
56 views

How to Modify and Combine rows in an attribute table?

I would like to modify this attribute table. This is an example First arrange column “ORG_FID” in ascending order If the number of rows corresponding to the column “block Number” is same as well as “...
2
votes
2answers
49 views

Merging Fields into new field using python and eliminating space in before and after the field using field calculator

Am interested in combining ClASS1 and SUBCLASS1 to form the one combined class. I wrote the expression as follows "() ()" format( !CLASS1!replace(" "","" ),( !SUBCLASS1!replace(" "","" ))as shown in ...
2
votes
1answer
845 views

What is the Python expression for calculating Lat/Long in Decimal Degrees in ArcGIS?

I'm calculating 4 double fields for a polygon feature class (exploded, single-part features): SquareFeet, Acreage, Lat, and Long I found the correct python expressions to calculate SquareFeet & ...
2
votes
1answer
403 views

Using Field Calculator to assign consecutive letters for each feature?

I have a feature class generated in ModelBuilder using a transect script that contains multiple transects. Before moving on to further build the survey I would like to assign ID's to each feature in ...
2
votes
1answer
45 views

Combining values in shapefile using ArcMap?

I have a shapefile with 10 different values (geological ages) which I want to combine into four values (into broader age categories). Is there a tool which I can use to selectively combine values in ...
2
votes
1answer
75 views

Convert Float to Time Format in ArcMap

I have been trying to convert a float value, for instance, 6.764789 minutes, to a time formated number 00:00:00. First, I created a New Field of Time, and then used this two ways (using the Field ...
2
votes
2answers
110 views

Truncating table values using ModelBuilder?

I currently have this table with the "ACT_DATE" field displaying a long string of numbers and characters. I only need the first 4 digits, for the year, and everything else I am attempting to discard. ...
2
votes
1answer
91 views

ArcGIS Field Editor if/else syntax with python

I am just starting with Python and ArcGIs so here is my question: I have the column "DB_Low" (Type "Long") and want to fill a new column by changing values. The new column will be a Float-Type field. ...
2
votes
1answer
68 views

ArcGIS 10 Split string from OSM data

maybe you can help I have a string: "width"=>"6","name:be"=>"Калінавы завулак","name:ru"=>"Калиновый переулок","surface"=>"asphalt","int_name"=>"Kalinavy zavulak","maxspeed"=>"40" necessary as a ...
2
votes
3answers
756 views

Calculating Statistics of attribute field to use it in another calculation?

I want the statistics of an attribute field to use in another calculation, i can view the statistics using the field properties menu I want these to normalised the data of field 'Ia' using the ...
2
votes
2answers
4k views

Error msg “Name is not defined” when trying to populate a field with the shape file name

I am trying to populate a field with corresponding file name. For example, if the file name is Route1.shp then the field value will be Route1 as well. However my code is not working. Can you please ...
2
votes
2answers
121 views

ArcGIS Field Calculator passes European-formatted floats as tuples

I have the problem that the ArcGIS Field Calculator doesn't read a float number when it is included in Python by referring to the field that contains it, in this way: def giveResult(floatValue): if ...
2
votes
2answers
95 views

Calculate field does not update using ArcPy

I want assign 33 if the field no_apt is zero and 34 if no_apt is any else value. The model run without any error, but no value are assigned the field GGV_kW. What is wrong with the code since it doesn'...
2
votes
1answer
73 views

ArcGIS Pro Field Calculator completing without error, but no change to Feature?

I'm attempting a research project in which I am seeking to categorize a municipality's Property Use Codes as Generalized Land Uses. For example, "AGRII - Developed Farmland" and "INDGR - Grain ...
2
votes
1answer
90 views

Calculating field on if-else-condition checking input parameters for <Null>?

I want to calculate a field depending on 3 input string parameters. Two of them can contain Null-values. My old VB expression was not able to work with Null-values, so the script stopped. Now I want ...
2
votes
1answer
200 views

Replacing values with non-English characters in attribute table field using ArcGIS field calculator and python parser?

I'm new to python and trying to write a python script using the field calculator in ArcMap for a specific field in an attribute table that will calculate and place the values in the other field. My ...
2
votes
1answer
67 views

Determining distance on line of point, given measure?

I need to determine into a standalone python script the distance of a point on a polyline with M-values and its' coordinates, at a specific measure. For example, I have to calculate the X,Y of a ...
2
votes
1answer
304 views

Python in ModelBuilder calculate field tool

Code works on ArcMap "Field Calculator..." when I click on attribute and calculate. But if does not work in ModelBuilder calculate field tool. Any ideas? Pre-Logic Script Code: def ifBlock(...
2
votes
2answers
54 views

Using field calculator to find the next nearest (next minimum value)

I'm new to Python, but I'm attempting to find the next smallest value in a field, using another field as a case field (within field calculator in ModelBuilder). I've drafted the following, but it does ...
2
votes
1answer
678 views

Python script to iterate through geodatabase and assign field value based on spatial location

I have two types of spatial data. One is a geodatabase of parcel data by county in Florida, and the other is a shapefile containing wind_zones through out Florida (used for enforcing certain building ...
2
votes
1answer
180 views

Copying some values from several columns to another column in attribute table? [closed]

I am trying to copy selected values from several columns to one single column in the attribute table. Specifically, where columns (Grid_code, grid_code1, grid_code2.... etc) have values of 4 and 10, ...
2
votes
2answers
343 views

Performing Conditional Calculate Field with Many to One using ArcMap?

Anyone have experience calculating a field based on a many to one scenario? I have a feature class in a geodatabase with a field of unique names. Feature Class Table (let's call this "MAINTABLE") ...
2
votes
0answers
59 views

Using Python nested if statement for labels in ArcMap?

I am trying to use python to write a label expression that will display a specific set of labels based on nested if statments. The expression should result in a 4 line label if the value is greater ...
2
votes
0answers
226 views

Auto-Refresh Field that has been Calculated with Python in ArcGIS Pro

Is there a way to get a calculated field to auto-refresh? For example, I have an expiration date field with dates filled in. I have another field that I will use to show the number of days left till ...
2
votes
0answers
544 views

Reclass or other if/then logic expression in field calculator [closed]

I'm trying to reclass values in field calculator using Python (recreating something I did successfully last month and am failing now). I've reviewed many questions and answers on this site with no ...
2
votes
0answers
56 views

select 8 rows in the table and calculate statistics for them, then select next 8 in the same table and calculate statistics for them [closed]

I have a large table which structure looks like that: This is just to show you what I want to achieve, because my original table has nearly 1 million records. Now imagine that I have temperature ...
2
votes
0answers
202 views

python label expression [closed]

Can't get advanced python label expression to work. I am trying to get my if else expression to either concatenate or not based on if two fields are blank or not. If SUB_UNIT_TYPE and SUB_UNIT_ID ...
2
votes
0answers
387 views

Converting Atn function of VB Script for Python parser of ArcGIS Field Calculator? [closed]

I would like to convert the Atn function (which returns the arctangent of a number) of VB Script to Python but I cannot find exactly the same function. Any help? I want to convert the slope of ...
1
vote
3answers
205 views

Making one field/values equal to another field/values

I have created a new field called "SFX" in a shapefile called "myshape.shp": input = r"C:\files\myshape.shp" arcpy.AddField_management(input, "SFX", "TEXT", field_length=100) There is now a field ...
1
vote
2answers
294 views

Using Asterisks in Python parser of ArcGIS Label Expression Builder?

I am trying to create a label expression that labels features that contain hike in their name (versus those that don't). I have tried something like this: def FindLabel ([Name]): if [Name] is "...
1
vote
3answers
352 views

Lists in field calculator in ArcMap?

Would anyone please indicate to me why this is not working. I am trying to convert all instances of '02ND' to '2ND' for example where some of the input fields (f1) are already converted and some are ...
1
vote
2answers
1k views

Parsing field values using ArcGIS Field Calculator?

I am using 10.0 ArcView and am trying to get the "R" in R12345678910 to drop. The numbers are in a column in the attribute table and i've always used VB scripting. I was using Field Calculator.