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
18 views

Accessing elements from a list in Google Earth Engine

I am accessing the properties of an image collection in GEE. I have created an image collection and assigned it to the variable "collection". When accessing the date range I used the ...
1
vote
2answers
34 views

Undesirable behavior of PostGIS function st_isvalid

I deal with forest inventory geodatabase that contains a lot of polygons. Those polygons come from some software that allows topologically incorrect data. So I should check the polygons. Performing ...
1
vote
1answer
39 views

Google Earth Engine-function (image) condition

Is there a way to set a condition inside function(image) in GEE? In my case, I am trying to return images with NDVI<0.2 only and use them in qualityMosaic function to generate a composite (with ...
2
votes
1answer
40 views

Vector line layer classification with two functions in QGIS

I have a linear geometry layer with the attribute: "uuid_przys". I would like to classify my layer with the uuid-attribute, but only for the objects in the current map view or for the ...
0
votes
0answers
38 views

Temporal subset and mosaic from a Landsat 8 image collection for each image in Google Earth Engine

What I need are image mosaics from a cloud-masked, chronologically ordered Landsat 8 image collection for each position in the collection. So, the first mosaic should be built from all images 1 ...
3
votes
2answers
194 views

Statistics of each image in an ImageCollection in Google Earth Engine

I have an ImageCollection that I made calculation with so that it now contains images that show a ratio of one band within a given Polygon. I would like to get the mean and standard deviation for each ...
2
votes
1answer
51 views

Mapping ratio function over ImageCollection in Google Earth Engine

I am trying to map a function over an ImageCollection to receive the ratio in a polygon, how it compares to a certain point (pt) for each image. So all pixels within the polygon divided by the value ...
0
votes
1answer
54 views

Resolving “Dictionary does not contain key” error applying function to feature collection in Google Earth Engine

I am adding two properties to each feature in a feature collection based on two images within each feature, currently represented as properties themselves. I got this feature collection through ...
1
vote
2answers
79 views

QGIS function layer_name in fieldcalculator batch-mode

Working with QGIS 3.10, I want to use the @layer_name function in batch mode for all layers in a project. In individual cases, I do this via the field calculator. I also found the script for the field ...
0
votes
0answers
48 views

Calculating 3x3 pixel Neighborhood in GEE

I'm trying to calculate 3x3 pixel kernel for each image on my NDVI image collection. My goal is to do in GEE focal statistics like in Arcgis. My code is below and it generates an NDVI image collection ...
1
vote
1answer
25 views

Mapping a function to an image collection, then displaying specific images from new collection Google Earth Engine

I'm trying to extract fires from a collection of Landsat images. I have this function that can process a single image, but when I try to use the Map function to map it onto a collection it doesn't ...
2
votes
1answer
181 views

Using PyQt in PyQGIS inside QGIS 3.16

This code Using PyQt5 extracted from http://www.tutorialspoint.com does not work when I add it in a script in the console of QGIS 3.16. Can you enlighten me on this subject? import sys from PyQt5 ...
1
vote
1answer
163 views

Error “Element.get: Parameter 'object' is required” mapping to a list in Google Earth Engine

I'm running my code where I create weekly averages of a variables which are mapped to a list of days of year (DOY). var SSTA_7d = ee.ImageCollection.fromImages( years.map(function (y) { ...
1
vote
2answers
58 views

Add unique id to merged attributes tables QGIS

I need to find a way to stack up numeric id fields from two tables without duplications. To put it simply here is what I want to do schematically : Table 1 Id 1 2 Table 2 Id 1 2 3 Expected ...
0
votes
1answer
81 views

Error using.getInfo function within a function Google Earth Engine

I'm applying a function to map a calculation over a list of dates. In the old calculation I just manually entered each date and ran the code. As part of if that code I would use .get('year).getInfo() ...
0
votes
0answers
28 views

Using a feature in a function in OpenLayers

I want to use in the get_pdf_data function the data loaded in the "imobile" vector so that I can perform operations with the "imobile" vector. The code I'm trying to do this with ...
0
votes
0answers
182 views

Google Earth Engine: mapping a FeatureCollection to a list of dates

I have some code that creates FeatureCollection for SST a specific date range, which I combined and export as a csv. A link to which can be found here. I would like to map the FeatureCollection to a ...
0
votes
0answers
63 views

Apply function to calculate NDVI on list of images

I'm looking for a simple for-loop to apply a function to create NDVI images from an original list and save those in a new folder. I've created a function and show how I would apply it on one image but ...
2
votes
1answer
140 views

ST_Line_Substring doesn't work

I want to split some line strings using ST_Line_Substring. My basic query works: SELECT ST_LineLocatePoint(b.geom_way,ST_ClosestPoint(a.geom,b.geom_way)) as Loc_Point FROM splitpoints a CROSS ...
5
votes
4answers
121 views

Reclassify raster values continuously instead of assigning them to specific groups

I want to create a Habitat Suitability Index (HSI). I have several variables (raster layers containing information about e.g. precipitation, slope, food resources, etc.). I have to create an "...
10
votes
1answer
256 views

Listing all functions available in QGIS's Virtual Layer

How can I get automatically a list of all functions available for usage in QGIS's Virtual Layer? From my own understanding/experience and the QGIS Documentation, QGIS's Virtual Layer employes a ...
4
votes
1answer
114 views

Subsetting multiple rasters with multiple shapefiles using Python

I want to subset multiple raster files with multiple shapefiles and the following code is working (it is not the whole code, only the part for the subsetting). I am using Python 3.6.8 i_shp = 0 # ...
0
votes
0answers
29 views

GeoServer filter function reference

This Program/Project is working. Using the centroid function, I am able to filter the layer but I am confused about how to add another function where I can get the integer value from the column "...
2
votes
1answer
58 views

Function-based spatial index: Use sdo_geometry() constructor instead of custom function?

I have an Oracle 18c table that has XY columns, but not a SHAPE column. I've created a query on the table that dynamically generates an sdo_geometry SHAPE column. sdo_geometry(2001, 26917, ...
0
votes
1answer
67 views

Google earth engine: function to apply code to sequential dates

0 I have a code which creates a value for several different variables for a specific time period (usually over 1 month) and exports these as a csv to my google drive. You can find a link to the code ...
4
votes
1answer
161 views

Create a PL/PSQL function that performs as fast as a normal query?

I'm trying to create a PL/psql function that cuts one user-defined geometry to a predefined border geometry. If the user-defined geometry does not intersect with the border geometry, it should return ...
1
vote
1answer
265 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
63 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
56 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
1answer
173 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 ...
5
votes
1answer
303 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
15 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
23 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
44 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
59 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
37 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 ...
2
votes
1answer
2k 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
289 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
488 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
112 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
178 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 ...
1
vote
1answer
97 views

Property Is not like. GeoServer

Which function/condition should I use to get the opposite of "PropertyIsLike" in GeoServer?
1
vote
1answer
162 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
34 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
94 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) ...
2
votes
2answers
92 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
63 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
73 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
164 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
122 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 ...