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
1
vote
1answer
21 views

Google Earth Engine: set band as property without reducing

I have a function that takes an ImageCollection and sets a mean value as a property for another ImageCollection. var DHW = HS_SSTA_7d.map(function(im) { var res = im.reduceRegion(...
0
votes
0answers
15 views

Add variable name to layer box in GEE

I am trying to display a month worth of daily images to a map to visually inspect them for the presence of dust. I was able to add the images to the map but the name in the layer box is not helpful. I ...
0
votes
0answers
37 views

PostgreSQL/PostGIS/pgRouting function (written in PL/pgSQL) not found nor run in user but can be used and gives correct result by admin

A function using pgr_dijkstra (pgRouting) is returning correct answer when run from "admin". The same function run from a simple user returns an error (ERROR: function pgr_dijkstra(unknown, ...
1
vote
0answers
32 views

Making ring buffers (donuts) in Google Earth Engine

I am trying to generate multiple buffers around a layer that represents cities (FeatureCollection). Use the following code to create the buffers: // Function to create buffers of different sizes in ...
4
votes
1answer
145 views

Creating a new custom PostGIS function

I'd like to create a new, custom PostGIS function that would return a point geometry from a polygon that I can use for generating label points from a polygon, but I am not sure how to go about ...
0
votes
0answers
11 views

Setting same custom Icon marker for various JSON layers

I am attempting to set the same icon for three diferent JSON layers on a leaflet API map, but it does not show the requested image. Here's the code function popupwindow(feature,layer){layer....
1
vote
0answers
21 views

Function that samples region for daily images within multiple years

I am trying to sample daily meteorological data from 1990 to 2018 within a region and export as a CSV file. How can I write a function within a function to filter first by year and then by day of year?...
0
votes
1answer
41 views

Showing only maximum values for each point

I have a dataset with concentrations of copper from different stations taken over several years. I would like to show only the highest concentration (mikromolar) for each station (STATN), and I tried ...
2
votes
1answer
49 views

Display_expression function on QGIS 3.14

I would like to know what exactly do the function display_expression introduced in QGIS since version 3.14. The 3.14 Changelog is not clear on it and also reading the GitHub commit didn't help me to ...
2
votes
1answer
29 views

How does gridmetrics handle IF condition in user defined functions?

I noticed a kind of "inconsistency" in the values returned from two user-defined functions. I tested on a tile of 200mx200m to return a raster of pixel size 50m (16 pixels) In the following ...
0
votes
0answers
13 views

Exporting many tables with incrementing date file name in GEE

I am classifying exposure status of point features within a county. The majority of the time all the point features will be unexposed and so I would like to write a general function that will export a ...
2
votes
1answer
149 views

Call a function multiple times with different argument for date

I need to call the same function 10 times, each time with a different year for the end date argument. For example, the end date needs to start as "2011-01-01", then "2012-01-01", ...
3
votes
1answer
259 views

How to use a Processing Algorithm in a expression function used in a Geometry Generator (Points Along Lines “on the fly”)

I want to use the Processing Algorithm, pointsalonglines, in the expression function used in Geometry Generator. This is because I want to create points "on the fly" along my line and in a ...
1
vote
1answer
72 views

Google earth engine - set null band values as zero

I have a function which assigns a score depend on the value of a band, which I then map to an image collection. However, in some cases, I have null values, where no value is given. In these cases I'd ...
0
votes
1answer
47 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
58 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
50 views

Property Is not like. GeoServer

Which function/condition should I use to get the opposite of "PropertyIsLike" in GeoServer?
1
vote
1answer
55 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
26 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
46 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
56 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
46 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
50 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
86 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
41 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
47 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 ...
2
votes
2answers
90 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
37 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
67 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
110 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
106 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
243 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
60 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 ...
1
vote
1answer
84 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
86 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
48 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
125 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
201 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, ...
1
vote
1answer
325 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
276 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
105 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
131 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
163 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
72 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
218 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. # ...
2
votes
0answers
91 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
4k 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
101 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 ...
1
vote
1answer
951 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 ...