Questions tagged [function]

A programming function is a type of procedure or routine. Some programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value.

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

Error in overlay - formula not vectorized

I've run into another error while trying to get my predictive model to work. My base model is basically done (extracting locational parameters from archaeological sites in an area, and calculating a ...
2
votes
1answer
36 views

Insert/Update/Delete table from another table changes in PostGIS

I'm trying to build a function that Insert/Update/Delete rows of a table based from another table changes. Unfortunately I could not continue, some problems occured: DELETE isn't work correctly: Any ...
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
1answer
30 views

EVI2 function (GEE)

I wrote some code to calculate EVI2 from Sentinel2 imagery. But, I wasn't able to make it run as the .map() function seems to not work well with an image that has multiple bands. Error Message: img....
0
votes
1answer
21 views

Function to calculate time series wise max and min

I have image collection from that I want to make a loop function where I want to call all images that have the same temporal resolution but date range varies (like 2000-06-09 to 2019-06-17) through ...
1
vote
1answer
37 views

Map function over imagecollection Error

I have sentinel-1 dataset and I want to map Frost filter function on each image in the dataset. The problem is that when I try to do this. using map, I get the error: Required argument (count) ...
0
votes
2answers
42 views

Pass temporary output between definitions / functions to use as input to next def

Lets say I have two functions: class AnalyseDTM(): def __init__(self): self.DTM = ('C:/Users/EH/QGis/Kvit_Tiny.tif') self.CreatePolygons() self.test() def ...
0
votes
1answer
38 views

Create loop that calculate new images from imagecollection based on different bands

I have imagecollection from sentinel 1 and I would like to create function that wil calculte new rasters based on a model that I have. my imagecollection called FrostDB and I want to create new ...
1
vote
1answer
47 views

Create a function with many parameters and apply it over a list in R

I have a list which includes 2 data.frames and would like to apply some analysis to each data.frame. I performed my analysis to a single data.frame and I want to do the same steps over my list. I am a ...
3
votes
0answers
60 views

What is tilde (~) for in R? [closed]

I know this is an almost too simple question. But maybe there is a fast answer. Looking through some code to build a leaflet map in R I found that part of code: mypal = colorNumeric( palette = "...
1
vote
0answers
30 views

Error User-defined methods must return a value - what should my function return?

I have written a function that supppose to reproject my sentinel 1 image (Resolution 10 meters) to my sentinel 2 images (20 meters). I have written the function but I am missing the return part ...
0
votes
1answer
46 views

Create Layer of pixels with value higher than 0.3

I have code that suppose to calculte NDVI and calssify it according to the NDVI value. I have tried to add a function that will create for me a new layer that will have only pixels with value higher ...
1
vote
2answers
65 views

Reclass NDVI value using a function

I'm trying to reclass the values of a sentinel 2 NDVI creating a function but I don't know exactly how do to it. What I exactly want is: When NDVI values are between -1 and 0, return (-1) ; 0 and 0....
2
votes
1answer
36 views

Error in create list of the images new names

I have code that calculates NDVI and then give each image name based on the date.I want to create list after that that will contain the names-dates of each image, but I keep getting the following ...
1
vote
0answers
48 views

Calculating NDVI using ArcPy

I have a custom function that I'm trying to write (using Arcpy in ArcGIS 10.7.1), but I'm having a little trouble writing a successful function because I'm new to custom function writing. I want the ...
1
vote
1answer
90 views

Use SDE.ST_GEOMETRY functions in a custom function

I have a dummy query where I generate an SDE.ST_GEOMETRY point: select shape as srid_test from ( select sde.st_geometry ('point (10.01 50.76)', 4326) as shape from ...
0
votes
1answer
69 views

Using geometry stored in SQL Server table instead of WKT as input to function

I am new to SQL Server, I have a function called STVectorize that takes a geometry and breaks it down into its constituent vectors: SELECT e.[id], e.[element_id], e.[subelement_id], e.[vector_id], ...
1
vote
1answer
82 views

Count the number of pixels according to their value using for loop

I have script that does the enxt procedures: create imagecollection from Landsat7 clip the images according to specific geometry and calculte NDVI for each one filter the rasters according to the ...
1
vote
1answer
44 views

Filter ImageCollection by year and create one mean Image for each year

I'm trying to calculate the mean NDVI for a polygon in an urban area. I have a code that takes Landsat7 images, clip them according to the geometry and knows to select only images with certain number ...
0
votes
1answer
68 views

Internal problem using Google Earth Engine function

I need help solving this GEE internal error. I am trying to reduce my script lines in GEE. So, I tried to use a single function to compute polarization indexes. However, the console shows a warning ...
1
vote
0answers
50 views

Leaflet plot map.on(zoomend) function into addEventListener(function)

Continuing the previous query: Leaflet set zoom for clickable layers on the map I would like to fix my zoom feature, which doesn't work correctly as per in the picture below: for this purpose I ...
1
vote
1answer
38 views

Using elevatr and apply function

I'm trying to use the "apply" function with the R "eleavatr" package. I'm getting an error message but I'm not sure if the problem is in my understanding of the apply function (perhaps the root of the ...
1
vote
2answers
93 views

QGIS 3.4 feature filter maximum() does not work

I would like to filter a layer with the maximum value of field_a, grouped by field_b. I tried this expression: "field_a"= maximum ( "field_a","field_b") But it doesn't work (there are no more features ...
1
vote
1answer
138 views

Google Earth Engine: Error for mapping expression function over feature collection

I'm having an issue when trying to create a function to map over a feature collection. I'm trying to create SST thresholds for several regions where over a certain SST value is 1, under another SST, ...
3
votes
1answer
228 views

Difference between two vector layer

I have two vector layer land cover for 2016 and 2018. I want to get result layer that will show changes in land cover e.g. the forest has changed into a meadow. What option in QGIS can I do that. In ...
1
vote
1answer
252 views

Formula not vectorized, error in R [closed]

I have the following traceback and I would like some help to understand/solve it. Can anyone explain to me what to look here? 6: stop("cannot use this formula, probably because it is not vectorized"...
2
votes
1answer
230 views

Summarize Land use changes over time with Google Earth Engine

I'm trying to detect how many times land type has changed between 2001 and 2018 (inclusively). For example, suppose a pixel that was: Forest from 2001 to 2003 Bare ground from 2003 to 2010 ...
1
vote
1answer
101 views

Arcpy reclassify with function

I have two rasters, one with NDVI values, and one with greyscale values (=(red band + green band + blue band) / 3). The rasters have the same name. I need to reclassify them in arcpy with the ...
2
votes
0answers
45 views

Calculating line length to both sites in QGIS

Is there a function or a plugin for QGIS that works like this? I have a line, for example, 7 km I click on that line at any point A popup or something gives me the distance to the left an to the ...
1
vote
1answer
110 views

Using double offset in QGIS Expression String Builder?

I need to dynamically translate points 20 metres from their original point to a suitable cartographic position. I have a rotation value stored in a rotation attribute. I cannot use this tool right ...
2
votes
1answer
125 views

Apply function from rgeos package to data sets

I am using gDistance function from rgeos package to calculate the nearest distance from points to a polygon. Originally I used for loop to calculate the distance for each row in my points data set, ...
2
votes
2answers
62 views

Clipping Lines Using Expression in QGIS?

I have a set of roads that I wish to clip. How ever I only need a segment of each road based on the state its located in. I can do this independently but seems like there should be a better way. Ill ...
1
vote
1answer
165 views

Determining which layer in raster stack is first to meet condition using R?

I want to analyze a raster stack and determine the first layer in the stack that meets a condition for every pixel. Here's a reproducible code example generating rasters and making a stack. # ...
0
votes
0answers
23 views

What are the main uses or advantages or general definition of spatial functions in PostGIS? [duplicate]

After my search in website, I didn't find any solution for the general definition or uses or advantages of spatial function in PostGIS. I hope this question would help me in getting solution.
2
votes
0answers
74 views

Getting travel time while performing pgrouting i.e. what are parameters and function required?

While doing the pgrouting to find the shortest distance I got success in getting the output but when I thought to come up with the time consumed for travelling, I cannot find the proper source to get ...
0
votes
1answer
2k views

Why does Uncaught TypeError: Cannot read property 'trim' of undefined occur in esriRequest

I am trying to use esri/request to pull in some data from an API. I am have two weird problems. First, when I try to run this, it doesn't complete and throws the following error in the browser console:...
1
vote
0answers
85 views

How to create a function for getting a largest polygon from 2 polygons using case statement in PostgreSQL?

CREATE OR REPLACE FUNCTION public.largest_polygon1( geom1 geometry, geom2 geometry) RETURNS geometry LANGUAGE 'plpgsql' COST 100 VOLATILE AS $BODY$ begin Return Case ...
0
votes
1answer
459 views

Filtering area through defined time period using Google Earth Engine?

I tried the following code in the Google Earth Engine through the various countries which have different dry season. But I cannot understand how to iterate the code. can anyone generate iteration ...
1
vote
1answer
167 views

How to create a function for finding the largest of 2 polygons by area in PostGIS?

I tried my level in creating the function but it shows error while running. I have enclosed the code here : create function largest_poly (geom1, geom2) returns geometry as $largest_poly$ begin from ...
1
vote
1answer
87 views

Raster calculation over multiple layers using a function or do-loop

I have a bunch of raster calculations that are working, but there must be a more efficient way to do this with a do-loop or function. Essentially I have a bunch of combinations of: rates (county ...
1
vote
1answer
129 views

Seeking Function to calculate red-edgeNDVI in Google Earth Engine?

I am trying to calculate the red-edgeNDVI ((NIR – red edge)/(NIR + red edge)) of an Image.Collection in Google Earth Engine. There is a built in function for NDVI but not for red-edge NDVI. The code I ...
1
vote
0answers
85 views

QGIS 3.6: variable functions, confusing explanation

The documentation (https://docs.qgis.org/3.4/en/docs/user_manual/working_with_vector/expression.html#id31) says: To use these functions in an expression, they should be preceded by @ character (e....
1
vote
0answers
67 views

Error with generate_series

I`d like to create a Hex Grid using Hex grid algorithm for PostGIS (https://medium.com/@goldrydigital/hex-grid-algorithm-for-postgis-4ac45f61d093) DO $$ DECLARE _curs CURSOR FOR SELECT geom3857 ...
1
vote
1answer
108 views

Applying function to all files in directory using PyQGIS?

I have a problem for apply this function in all files. This script is about the extraction of the bands from a raster and I want to use it on all the file raster in the folder. It works on the single ...
5
votes
1answer
162 views

How to re-use an expression, stored as a string, in QGIS Field Calculator

As discussed in this question, QGIS automatically saves recently used expressions in the field calculator. But recently used expressions are deleted after a while. Sometimes I need to re-use an ...
0
votes
1answer
137 views

Google Earth Engine formaTrend function

So I'm using the formaTrend() function in Google Earth Engine to detect differences in forest cover over time (via long-trend). My question is if there's a paper or an explanation to what exactly ...
1
vote
1answer
166 views

Earth Engine how to avoid timeout for buffer calculation?

I have a function that takes a feature and creates a buffer around it. createBuffer = function(feature){ var AOI = feature.geometry().buffer(3000); return ee.Feature(AOI).copyProperties(feature)...
0
votes
1answer
329 views

Earth Engine create user defined function with default parameters

I am creating a user based function that I will save in my repository for re-use later. But I'm facing a problem with putting default values in my parameters. var myFunction = function(number, power ...
0
votes
1answer
111 views

IDL - calculate mean ignoring zeros [closed]

Imagine the following array: a = [10768,10764,10893,10763,10723,10792,0,0,0,0] Using a function like "MEAN" in IDL, is there a way to calculate the mean value, ignoring the zeros? I know this can ...
2
votes
1answer
372 views

Earth Engine - function for printing multiple histograms

I have several time periods within a feature where the precipitation was very low stored in a FeatureCollection with the properties "begin", "end", "amount", "days".I want to use the feature ...