Questions tagged [if-else]

An if-else statement is a programming conditional statement that runs a different set of statements depending on whether an expression is true or false.

Filter by
Sorted by
Tagged with
5
votes
1answer
39k views

Writing conditional (if/then) statements into ArcGIS Field Calculator using Python Parser?

I have gotten stuck on seemingly simple ArcGIS field calculator python expression. I obtained a great answer to a another similar question a few years ago: Using Range in Python expression of ArcGIS ...
11
votes
1answer
2k views

QGIS Modeler if/else condition, custom script for Modeler

I want to make a simple if/else function inside my Model and I wanted to know if it's possible or not. I want this thing to do that if an Input for 'Segment Layer' is selected that it doesn't have ...
3
votes
2answers
169 views

If statement in Python QGIS Raster Calculator

I would like to perform a raster calculation with the if condition and I wrote this code: import qgis import gdal from qgis.analysis import QgsRasterCalculator, QgsRasterCalculatorEntry from qgis....
2
votes
1answer
2k views

Using If Then Else statement in ArcMap ModelBuilder?

I have a model that adds several fields, two which are manual inputs (County Name and User). I am manipulating several parcel layers (approx 90 counties). In my model, one field takes the state and ...
2
votes
1answer
154 views

Using if statement with ArcPy and GetCount?

I am looking to get a count on the polygonNieghbor and if it has polygons in it then I want to move to the next step MakeFeatureLayer. and If it doesn't have any features I would like it to finish. ...
1
vote
1answer
487 views

Simple condition on rasters with different extents, R

I have multiple raster objects, with the same resolution but slightly different extents. I have use the following function in order to reclassify them and now their values are between 1-6. What I ...
1
vote
1answer
101 views

Using Python Code from QGIS modeler with if and else

I am using QGIS 3. The following script code is generated from a model. At the end the code has to create a field Fl_m2, if the blnFl is true. if ['blnFl'] is True: If it is not true the ...
1
vote
1answer
355 views

Checking field type in ModelBuilder using if else?

I am creating a model in gis ModelBuilder. I want to check the type of a particular field and if it is long integer than the tools should be different and else (i.e. not a long integer) my tools ...
0
votes
1answer
42 views

Using expression operators in if/else conditions without getInfo in Google Earth Engine

İ have a two-segment list with id and value and i want to make a new list from imageList using second element value. i want to get the first values in first column until 100 in second colum and save ...
0
votes
1answer
405 views

Spatial Reference not working with If-Else

I'm attempting to use a script to check a folder of data sets to see if they match a projection of another data set in a target folder. I need to be able to re project any that don't match the same ...
0
votes
2answers
97 views

ArcGIS Pro Python Field Calculating

I am trying to use Python in ArcGIS Pro to cleanse some data via imported Excel sheets. The expression works, but the Code Block if-else statement to return nothing if !Street_Id! is returns an error....