The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Tag Info

Hot answers tagged calculate-values

6

The Esri supplied code starts from 0 and increases by 1. Your method will do the same only if your FID starts at 0 and increases sequentially. An ObjectID or FID is system managed, so if you delete a record you will have gaps, and in a geodatabase you could have a feature class that has an ObjectID starting at 300000 (for example), so you're not going to ...

6

Lightly tested formulas follow, so proceed with caution. But following along with an example here: https://www.mathopenref.com/arcradius.html If your circular arcs have a vertex at the middle point along the arc (which I am saying is x1, y1 in the figure), you could use it along with the start and end points to calculate the chord length "W" and the height "...

6

I've not used the PV tool and don't know the units on the raster, but can give you a general idea for one way to accomplish this. Generate the raster, as you have done (don't necessarily need to clip to polygons yet if you don't want to). It may be easier to do the math using a 1m x 1m raster size so each cell is 1 square meter, assuming this isn't too ...

6

You need to interact with the row object, not fields. Consider the example from UpdateCursor: import arcpy fc = 'c:/data/base.gdb/well' fields = ['WELL_YIELD', 'WELL_CLASS'] # Create update cursor for feature class with arcpy.da.UpdateCursor(fc, fields) as cursor: # For each row, evaluate the WELL_YIELD value (index position # of 0), and update ...

5

Can you provide data for an example? Anyways, try this: library(sf) f <- st_read("shapefile.shp") f\$area <- st_area(f) #Take care of units Best

5

Have a look at this tool: SEBE (included in the UMEP toolkit, which has recently been added to the QGIS official plugin repository). As described in the official site, SEBE (Solar Energy on Building Envelopes): ... can be used to calculate pixel wise potential solar energy using ground and building digital surface models (DSM). SEBE is also able to ...

5

This should do the trick as long as your field types work out. arcpy.CalculateField_management(newFc, "HouseNumber", '!TEXTSTRING!', "PYTHON_9.3") I also suggest always checking the ESRI help page when you run into one of these problems. The examples can be super helpful. Calculate Field

5

What a shame the to_interval expression treats each month as 30 days! Here's an ugly expression which will do what you want: to_date(concat(year("date")+floor((month("date")+"months"-1)/12), '-', right('0' || ((month("date")+"months"-1)%12+1) , 2),'-', right('0' || day("date"),2))) It breaks the date down into year, month and day, then uses ...

4

I will recommend using QGIS instead of ArcGIS, as QGIS can handle KML files properly in terms of parsing attribute table. I tested your file using both ArcGIS and QGIS. ArcGIS gives all the data as tags exactly as ou described in your question, while QGIS opened KML file and parsed the the fields properly as you can see below: You can save the the file as ...

4

I recommend Raster calculator. If your raster layername is RasterA, then try (RasterA@1 >= 0) * RasterA@1 If the cell value is 0 or greater than 0, (RasterA@1 >= 0) returns 1 (i.e. True) If the cell value is less than 0, (RasterA@1 >= 0) returns 0 (i.e. False). In short, (RasterA@1 >= 0) acts as a Boolean mask.

3

You should be able to follow these steps to delete the rows with the value of interest, in your case 2. You will need to make the layer editable Open the attribute table and select the features of interest Then click the delete button. Not sure if you could use the field directly to delete.

3

It may be a formula an algorithm I think this, not a tool you have to calculate this using the raster image, try to find the algorithm and apply on raster

3

After searching for five minutes more, I found the function "enumerate table field" which does exactly this if you leave the attribute as "not set". It was hidden under Table - Tools; maybe it should be moved into the Table - Calculus menu.

3

You can use the python regex module. Something like: import re def find_geoid(txt): result = re.search('<th>GEOID<\/th>\s+<td>(.*?)<\/td>', txt) try: return result.group(1) except: return '' # or 'not found' if you prefer

3

You could read more about the documentation here. You'll find the different operators available as well as an overview of the tool and sound methods. Essentially, you want to "add" all values in each of those individual fields and create a "total" field represented by field "A1". You can use the field calculator tool within the options of field "A1".

3

You can't assume that the Earth is flat and provide coordinates in angular units. But you can assume that the Earth is a sphere and make simple spherical trigonometric calculations. Define a radius for the sphere, something like R = 6371 km. (Mean radius) Then: lambda_1 = lambda_0 + ( X / ( cos( phi_0 ) * R ) ) phi_1 = phi_0 + ( Y / R ) Where: ...

3

The problem stems from the encapsulation of the arguments passed to Calculate Field, from the help: CalculateField_management (in_table, field, expression, {expression_type}, {code_block}) Your calculation syntax float("!BufferAcreage!")/float("!Acres_Whole!") * 100 is undecipherable by the python parser to the function, as it's several units separated ...

3

In this case, in the Calculate Value tool... The 'Code Block' field should be empty The 'Expression' field should be: "%value%"[0:6] (The expression should include the quotation marks.) Explanation: The 'Expression' is a simple one-liner Python expression that returns the result. The 'Code Block' is an optional more complex Python script that will be ...

3

Despite being a date field, the "Da" field would be treated as unicode within the Field Calculator. You may need to first convert the field value to datetime format, as described here: https://stackoverflow.com/questions/22219210/convert-the-unicode-to-datetime-format?rq=1 While you have defined a function, you are not calling it, and the function itself has ...

2

Found out that for some reason, the data has to be in a geographic coordinate system without a projection, and you can on-the-fly project into WGS84 (in the case in the code below) or NAD83 when calculating. The code below ended up being a solution to calculating Lat/Long for polygons in decimal degrees: arcpy.CalculateField_management(inputData, "LAT", "...

2

Put in an extra step behind from WetlandA_out and pss_out in Step 1) Right Click in model builder and GET FIELD VALUES that way you aren't dividing outputs but just ACRES.

2

If you use focal statistics, you can set up your own irregular kernel to accomplish this task quite easily. See how focal statistics works for detail on how to structure the simple text file for the irregular kernel. Alternatively with old Arc/INFO AML and grids or new Python/ NumPy arrays, you can use neighborhood notation to solve such a task.

2

I don't know, whether you directly can delete rows via the calculator (doubt so strongly), but you can use select by expression, type "width" = 2 and then delete the marked rows manually.

2

Some "Polygons_To" are in more than one "Polygons_From" so you should decide to: Duplicate polygons in "Polygons_To" to match number of intersections with "Polygons_From" layer. To do this You can use 'Join atributes by location' with one to many option selected. Or use Union tool from 'Vector' menu to split "Polygons_To" that intersect with more than one ...

2

See Accessing Model Only tools: There are two ways to access Model Only tools in ModelBuilder: from the Insert menu or from the shortcut menu.

2

As BERA mentioned in comments, you need to specify PYTHON as your expression type. The default is VB. arcpy.CalculateField_management(fc, "KM_FontSize", "!FontSize!", "PYTHON")

1

I am assuming you have a shapefile defining 'area of interest (city center). If yes,then you can use zonal statistics tool (require spatial analyst extension) where in_zone_data = shapefile of city center in_value_raster = raster image Edit: If you don't have spatial analyst, why not clip the aoi using data management -> raster toolset -> raster ...

1

Here is one method: Clip wetland layer to parcel boundary Use spatial join to join parcel layer to clipped wetland layer Dissolve joined layer by parcel id On dissolved layer open table, add numberic field, and field calculate acres Finally, join dissolved layer by parcel id to original parcel layer. This should provide you a summarized acre value for each ...

1

I figured it out myself - It is 2 steps process: 1. intersect the lines with the grid layer so all lines are split into segments. 2. Using field calculator: \$length of the line layer

1

Four ways to find the length of a line in QGIS Method One: Identify tool Click on segment using Identify tool. Open the "Derived" section in the Identify results window. Tips: Select the button "Expand New Results by Default" (circled in red) -- now the "Derived" section is open by default every time you identify a feature. Drag and drop the Identify ...

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