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
0answers
14 views

PgRouting - Adding matrix table to 'Create Function' script

I was wondering if anybody has ever added an origin-destination matrix table (i.e. from ONS) to a 'create function' wrapper. I want my script to automatically route from all origins and destinations I ...
0
votes
0answers
30 views

How can I merge the bands for each ID to create two multi-band TIFFs in R?

I have 16 separate raster files, named by ID and band, for 8 bands and 2 IDs. How can I merge the bands for each ID to create two multi-band TIFFs? Here are my data: dput(rastlist) c("...
0
votes
1answer
79 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 ...
0
votes
1answer
37 views

Calling a function with an image output to add in map layer

I am trying to estimate the LST using the thermal band (Band 10) of Landsat 8. I have written the final calculation of LST from the brightness temperature under a function. But I am getting trouble ...
1
vote
1answer
201 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 ...
1
vote
1answer
51 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 ...
1
vote
1answer
54 views

Showing only maximum value for each point feature

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&...
3
votes
0answers
279 views

How to use a custom function inside GEE ee.Reducer?

I have generated a segmentation using SNIC on GEE and calculated some statistics/features for each segment, using ee.Reducer e.g. mean, std, median, etc. I want to calculate more features based on my ...
2
votes
1answer
50 views

PostGIS trigger : table and materialized view

I have a PostGIS polygons table for my "cities". I have a point table for my "boreholl". I created a "mv" materialized view defined by a spatial join as follows: SELECT ...
1
vote
3answers
979 views

R: Reclassify a raster stack through the range of the quantiles of each layer. Generic quantiles function ; layer by layer

I have a raster stack that contains terrain bends extracted with different neighborhood windows "crosc_nxn" (e.g. 3x3, 5x5, etc ...). crosc_nxn <- raster::stack(path.files.list) > crosc_nxn ...
1
vote
1answer
358 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, ...
0
votes
1answer
22 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
1answer
76 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 ...
1
vote
2answers
38 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
2answers
92 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 ...
1
vote
1answer
1k 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 ...
2
votes
1answer
398 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 ...
2
votes
1answer
41 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 ...
2
votes
2answers
151 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....
0
votes
1answer
36 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 ...
0
votes
0answers
41 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 ...
2
votes
1answer
57 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 ...
3
votes
2answers
288 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 ...
0
votes
1answer
80 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 ...
6
votes
2answers
3k views

Style line-width proportionally to maintain relative size in Mapbox GL

I want a data driven line-width to keep its relative size in all sizes I tried using an exponential function for that but it did not work the way I expected. For the sake of the example let's say I ...
0
votes
0answers
57 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 ...
0
votes
1answer
120 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 ...
1
vote
1answer
28 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 ...
1
vote
2answers
59 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 ...
2
votes
1answer
212 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
221 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) { ...
0
votes
1answer
102 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
1answer
1k views

Use a sde.st_geometry function in a PL/SQL trigger

I have a PL/SQL trigger: 1 create or replace trigger "projects_to_meas_trig" before update of asset_id 2 on projects 3 4 for each row 5 declare 6 v_length number; 7 begin 8 ...
4
votes
1answer
2k views

GEE ImageCollection.map() with multiple-input function

I have an Image Collection, I want to Calculate a Normalized difference and got this Function called ND /////normalized Differense/////// function ND(Im,B1,B2){ var four = Im.select(B1) var eight = Im....
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
223 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 ...
2
votes
1answer
65 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
0answers
75 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
188 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
134 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 "...
4
votes
1answer
139 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 # ...
10
votes
1answer
271 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 ...
0
votes
0answers
30 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 "...
4
votes
1answer
163 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
290 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
75 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
63 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, ...
4
votes
1answer
682 views

Calculating weighted values using function in Function Editor

After my previous question Weighted values of field in QGIS, I successfully adapted the following formula in Expression dialogue "Value" / (sum("Value") / (count(CASE WHEN "...
5
votes
1answer
335 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 ...
11
votes
3answers
7k views

Extracting part of string from field in QGIS Field Calculator?

I want to create a new field in my attribute table. My goal: returning all digits between the / and _ characters of the field named "location" by applying the next expression: regexp_substr( ...