Questions tagged [conditional]

Conditional, also known as Con, is a raster processing tool or expression that evaluates an if/else condition on each cell.

Filter by
Sorted by
Tagged with
0
votes
1answer
16 views

How to set all raster pixels within a shapefile to null?

I'm working with ArcGIS Pro 2.4.0. I have a raster dataset consisting of several plots of crops. Within each plot, there is a small ground target that has differing reflective values than the ...
0
votes
0answers
25 views

Trouble using IF statement for adding and renaming output layers [closed]

I have created a model using ModelBuilder. The model has multiple outputs (I refer to the original output names as XX1 and XX2) which I want to Add each of them to Table of Content (TOC) with specific ...
1
vote
1answer
38 views

Conditional Reclassification using Raster Calculator

There are several questions about conditional reclassification on the Stack Exchange, but I haven't been able to find exactly what I need... In my workspace, I have a list of raster layers (8 bit ...
1
vote
1answer
32 views

Conditional formatting with color and icon for table in print layout

I used the conditional formatting option in the attribute table (figure 01) in QGIS 3.12. I created a layout with the map and the attributes table (figure 02). With the option “apply layer ...
2
votes
0answers
36 views

Get feature from another layer when layer attributes match

I am trying to use field calculator in a layer 'Active_Assessment' to return the attribute values of another layer 'Active_Zone' when a condition is met. The condition is that I need to only return ...
0
votes
1answer
24 views

Property Is not like. GeoServer

Which function/condition should I use to get the opposite of "PropertyIsLike" in GeoServer?
1
vote
0answers
53 views

Conditional formatting QGIS Legend

I use QGIS to create surface plots for measurements made in the field. I use the contour plugin. I usually create ~50 contours in order to make a smooth surface. When I use print composer, I generally ...
3
votes
2answers
94 views

Conditional statements in Field Calculator QGIS

Is it possible to modify the following syntax somehow that it would be applicable in Field Calculator in QGIS? The input layer is point layer and I would like to do following calculations which I can'...
1
vote
1answer
33 views

Conditional statement using Long and Text fields with Python Parser of Calculate Field in ArcGIS Pro

I have 3 fields: "ISL_Numero" - Long (values are '1', '2', '3', '4' etc.) "Subtipo_IS" - Text (values are 'A', 'B', 'C' etc.) "Ambiente_C" - Text (values I want to calculate) An example of what I ...
5
votes
1answer
200 views

Conditional calculation using raster calculator in QGIS

I have two rasters with the same extent, resolution, and projection, let's say raster A & B. What I want to do is something like this: IF A = 3 OR A = 11 THEN A+B ELSE B How can I do such a ...
1
vote
2answers
48 views

Writing if/then Statements for Python Parser of ArcGIS Field Calculator

For some reason I cannot get this code to work in the Field Calculator of ArcGIS Desktop 10.6.1. I'm trying to use the Python parser to populate the field "SHAP_CLAS" with multiple conditional ...
1
vote
1answer
115 views

Iterate through raster in R and apply conditional statements

I have a raster data set in R with numeric values ranging from 0 to 61.5, including some random NAs throughout. I would provide a reproducible data set, but I don't know how to create a raster with ...
5
votes
1answer
104 views

Clustering only if name attribute is same using QGIS?

I have a point layer on a world map with several attributes. Each point marks the position of a berth at a terminal in a port in a certain country. When I zoom out, it's getting too crowed so I ...
3
votes
1answer
82 views

Clustering geometry points, return a point's label if the point does not belong to a cluster?

I am clustering geometry points using the k-mean algorithm. The result is a list of clusters. Some clusters contain multiple points. Others only contain a single point. On the client side, we would ...
2
votes
1answer
72 views

PostGIS query from three tables

I am new in PostGIS and want to learn. I faced the query where I have to find one point in two different layers or table. I created a query like this but it is not giving the desired result: SELECT b....
2
votes
1answer
75 views

Conditional statement in PyQGIS field calculator

I am trying to perform a if/elif/else routine in the field calculator environment from PyQGIS (i.e. coding in Python). My code is the following, however I keep getting indentation errors. The field ...
2
votes
0answers
24 views

Conditional Expanding in ArcGIS Desktop?

I would like to reclassify a LC map given some conditional rules (raster with 8 classes total). Using the illustration, I would like to expand the green pixels (two distinct classes) on the white ...
3
votes
1answer
301 views

earthEngine expression and ternary operator: why does evaluate false value when always true?

Why does EE `.expression('A?B:C') take into account C if A is always true? I am using conditional operations with the image.expression('condition ? true_action : false_action) as documented here. My ...
1
vote
2answers
162 views

How to create a single raster based on the values of three rasters (Conditional)?

I have three rasters of soil granulometric fractions (clay, sand and silt), all in %. I want to make a single raster of the soil texture classes. For that, I need to make some conditionals (i. e.: ...
2
votes
1answer
95 views

Simplifying variable (if condition) with field calculator in QGIS

I want to simplify the variable ("SIOSE_CODE") which has values like this: A(90MTRfr_05PST_05SDN) A(65PST_35MTRfr) A(70FDCfr_10PST_10MTRfr_05MTR_05SDN) The first number (here 90 resp. 65, resp. 70) ...
0
votes
1answer
300 views

Including conditional operation depending on number of images?

I want to do certain operations depending on the number of images in a filtered collection. I am working within a loop, so I need the condition to jump to the next step in the loop given a condition. ...
2
votes
4answers
86 views

More Efficient Conditional Statements - ArcGIS Field Calculator

I am new to Python and have successfully created the following statement that writes a change period value (01 or 02) based on the municipality and date fields. I am wondering if anyone could point ...
0
votes
1answer
125 views

Using Con tool with iterator in ArcGIS ModelBuilder?

I have been using ArcGIS Modelbuilder on 16 years of MODIS LST 8 day data, ie. quite a few files. I want to use the QC pixel data at error <=1, 2, and 3K to overlay on the base LST data so I can ...
1
vote
2answers
139 views

Usage of ELSE Conditional Statement in QGIS Field Calculator

I have an issue about how to change some data in a field not affecting unrelated data. I want to replace '(space)' between words in label_geo_ field data by this '_' sign when (if) this sign appears ...
1
vote
1answer
26 views

Changing values of slope along polyline to 0 using ArcGIS Spatial Analyst?

In ArcGIS 10.1 (advanced license), I have a slope raster of a given area and a polyline. I want to set the slope values along the polyline to 0. I'm thinking of this process - extract the cells ...
2
votes
3answers
103 views

Problem with “if” conditional statement

I have mentioned my QGIS script below. In that script, I have used "if condition". When I open QGIS and run the script first time, after selecting the "Coordinate_System_SLD_99", it works accurately. ...
2
votes
0answers
58 views

QGIS Conditional statements in field calculator [duplicate]

I have attempted to write an expression for hours now by looking through these forums. I want to write if this column equals Blank, than this column equals blank. Ex) If defect_typ = A_FC ...
2
votes
0answers
79 views

How to set diagram color based on conditional expression?

I'm trying to create a map with pizza diagram, and I'm using the following expression: CASE WHEN pH >= 6 AND pH <= 9 THEN Color_rgb (0,166,226) WHEN pH <= 6 AND pH >=9 THEN ...
2
votes
1answer
119 views

Update existing field using CASE -statement

When I run this statement in qgis fieldcalc it returns correct reults only from the first line ('Skog') and the rest gets NULL-values. Any ideas what might be wrong here? Is it not pocssible to run ...
0
votes
1answer
333 views

Using ArcGIS conditional raster calculator?

I have a raster called "aspect" and I want to add 360 to every cells which have a current value lower than 100. How can I do this using raster calculator?
0
votes
2answers
182 views

Passing conditional statements into arcpy.da.UpdateCursor

How do you pass conditional statements from a list into a data access module update cursor? I am using ArcGIS v10.3.1. a = r"...\Default.gdb\New_Shapefile" ConList = ["r[1] >= 1"] with arcpy.da....
3
votes
1answer
213 views

Conditional Statement (CASE-WHEN) in QGIS for slope aspect

After processing a DEM with a mask to get the aspect values of some polygons I would like to create a new field classifying those values as N, NE, E, SE, S, SW, W, NW. I've written this but I can't ...
1
vote
2answers
284 views

Conditional statement in field calculator using Python parser ArcGIS

I have looked at many threads on here asking about coding nested if-then or conditional statements in field calculator in ArcGIS. This seems to be a common problem for beginner programmers. I've ...
1
vote
0answers
49 views

Reclass If/then logic [closed]

Have a binary raster. I would like to remove any 'islands' that are fully surrounded by one of the classes while leaving the 'islands' that are fully surrounded by the other. If 1 is enveloped by 0, ...
1
vote
0answers
61 views

Conditional field calculator in QGIS [duplicate]

I'm trying to code a conditional sentence in QGIS to calculate a vector field. I have 5 variables. I'd like to calculate the simple average if all variables are >= 3. If all variables are not >=3, ...
2
votes
1answer
346 views

Splitting text attribute using conditional function QGIS 2.18.13

i want to split a text column with city names by selecting only the names like 'world (planet)' and not like 'world planet'. Tried before with left( "Name", strpos( "Name" ,' ')) update existing field ...
1
vote
1answer
109 views

Extra conditions in composer controlled by atlas

I want to create a map series controlled by atlas, but some of my features have very different scales. I want to insert a condition to never use a scale lower than X (for instance: 1:5000). Any idea? ...
3
votes
2answers
449 views

QGIS conditional labeling of towns

I'm trying to create a labeled heat-map of incidents. Currently, I can label every town in the state -- which clutters up my map -- or I can have no labels at all. My boss would like me to instead ...
1
vote
1answer
179 views

Multiple Conditionals String with ArcGIS Field Calculator?

I am trying to use Field Calculator to use a multiple conditional based on a string in another field of the same attribute table. I have written the code below, but without success. Pre-Logic Script ...
3
votes
1answer
834 views

Displacing colliding point symbols in QGIS

I have a layer that includes points for electric poles (Circles) and transformers (triangles). Transformers can be on poles or on their own. I would like to displace the transformers only if they are ...
1
vote
1answer
71 views

Change a script to run over subfolders

I posted How to save just some mxds through 'if' in python? yesterday, and now I want to do a change in the script. I changed the script, to run over sub-folders. It goes nice, but when it ...
1
vote
2answers
49 views

How to save just some mxds through 'if' in python?

I have a simple code, that changes a picture in the layout, based on the element name. It works fine, for all MXDs in the same folder of the script. The problem is, the script saves every single .mxd ...
1
vote
1answer
633 views

Get a specific value from a table with using a few conditions in Python

I have a table that each different values in the table is the result of a combination of different conditions. For example in the below image the condition is as follow: if coverType=fallow , ...
1
vote
0answers
26 views

Trying to loop through a directory and create a shapefile of a given threshold using arcpy. [closed]

Below is my code. I'm having issues with this will work sometimes then other times it will not work. # Import dependencies: import arcpy import glob, os arcpy.CheckOutExtension('Spatial') arcpy.env....
3
votes
2answers
2k views

Conditional statement in gdal calc

I have this statement working in arcpy but I want this to implement in gdal, especially with gdal_calc, if possible. Rastercalc = Con(((C-B) > 2) & (B > 100), A, Con(((A-D)>15) & ((A-...
1
vote
1answer
114 views

How to modify values in a raster that are smaller OR larger than two thresholds

In ArcGIS 10.1 (advanced license), I have a raster dataset representing the wind speed (in knots). I want to be able to set the wind speed value to a specific value (say, for the sake of argument, a ...
1
vote
0answers
100 views

Reclassification Issues - Conditional Statements to Change Raster Values

I am looking for help with the statement to put into Raster Calculator that would turn some incorrect raster values (discrete values from 1385-1399) into a "1" without changing the majority of raster ...
1
vote
1answer
285 views

Loop through list of raster and replace values with another raster if they meet a condition

I'm very new to python and arcpy. The task: I have a large series of rasters (r0, r1, r2, r3...) (tif; n=240) and corresponding quality rasters (qr0, qr1, qr2, qr3...) (tif) with values 0,1,2,3 (...
1
vote
2answers
398 views

Conditional Filling Polygons in QGIS?

Is it possible to conditionally fill in county polygon of a state based on a date field? Example: ABCD County has a plan that was approved by FEMA on 10/01/2015 and expires on 09/30/2020. For ABCD ...
2
votes
0answers
40 views

Replacing attributes of raster cells with other raster values?

I have two raster layers. The first is a terrestrial habitat raster that includes an open water value. The second is a lentic habitat raster. I would like to "burn in" the lentic habitat raster ...