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
4
votes
1answer
56 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
39 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
56 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
36 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
23 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 ...
2
votes
1answer
116 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
127 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
68 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
149 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
81 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
64 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
93 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
24 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
95 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
47 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
69 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
81 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
85 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
149 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
127 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
206 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
47 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
55 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
314 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 ...
0
votes
1answer
73 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? ...
2
votes
2answers
337 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
122 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
635 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
64 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
339 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
24 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
61 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
93 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
218 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
315 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 ...
1
vote
2answers
39 views

Conditional to update field not working properly - Arcpy

I am attempting to update a text field with a shortened version of what is currently there. Currently, there are values from 1 to 4 with a description of each. I would like to return only the value. ...
1
vote
1answer
105 views

UpdateCursor - how to pass over certain rows based on value using conditional statement

I have a script that is supposed to update several fields based on the values of several other associated fields. My script is almost working as it should. However, it is overwriting my "High" and "...
1
vote
1answer
77 views

Parsing error: in Conditional raster calculator?

I was trying to calculate Soil types based on the FAO's guidline using the Con tool in raster calculation with ArcGIS 10.3. from three layers (silt, clay & sand). But, I got an error saying: ...
0
votes
1answer
47 views

UpdateCursor not filling correctly with conditional statement

I am attempting to update a table so that a field, "ALLREADY", fills with "Y" or "N" depending upon if "dmready" equals "total_records" AND if "dm_stat" is equal to "Ready for DM". When I run my ...
2
votes
1answer
443 views

Conditional statement ENVI

I am trying to do conditional statement in ENVI to calculate multiband image: result = (b1)^2 - (b2)^2 if (b1 eq 0) or (b2 eq 0) result * 0 else result * (result gt 0.0) Is there a way to combine ...
0
votes
2answers
1k views

SetNull() failing with input raster in ArcPy?

In ArcGIS 10.3, I am trying to use SetNull to identify streams in a raster based on an existing flow accumulation raster. The process involves setting all raster cells with flow accumulation value of ...
2
votes
1answer
40 views

Graphing attributes if they fulfill a condition

I have a dataset with schools, school coordenates, if the school is private or public and a variable containing the decile of attainment of the school in a test. I am trying to map schools in a city ...
2
votes
2answers
59 views

Raster conditional tool unexpected results. What's wrong?

I have a DEM raster (High: 53441, Low: -3444, unit: cms) with negative values, and I want to make all values 100 or less to be 100. I've tried Raster Calculator, and also python. I've got the same ...
0
votes
0answers
178 views

Using Near Feature Tool with Conditions

I am using near feature tool in ArcGIS 10.1. However, I need to add another condition to it (not only the nearest). The feature (point) that i am looking for, is the nearest (point) and also doesnot ...
3
votes
2answers
263 views

Field Calculator - conditional function and string variable?

I know this question has been asked before in different fashions, but I can't seem to get my python script to work despite looking at all the relevant questions I could find. I am simply trying to ...
0
votes
1answer
928 views

compare three rasters and three conditions with overlay in r

I'm trying to run an overlay function with rasters where I want to meet all of 3 different conditions at each cell and produce a single raster as output. Running ifelse with the & operator ...
4
votes
2answers
98 views

Conditional Combine Rasters and Track which Raster pixel used

I have 6 rasters with pixel values ranging from 0 to 1. I want to extract the highest pixel values from each raster to create a new raster, but also have a way to show which raster the highest value ...