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

Clipping multiple raster with multiple shapefiles in Python

I am trying to adopt existing code for clipping multiple rasters with multiple polygons based on this link: Subsetting multiple rasters with multiple shapefiles using Python I added the following ...
0
votes
0answers
20 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
20 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
70 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
42 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
52 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
30 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
24 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
32 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
36 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
56 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
90 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 "...
9
votes
1answer
178 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 ...
3
votes
1answer
66 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
28 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
44 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
54 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
152 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
128 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
27 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
50 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
106 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
205 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
22 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
53 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
32 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
14 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
825 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
273 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
224 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
87 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
96 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
72 views

Property Is not like. GeoServer

Which function/condition should I use to get the opposite of "PropertyIsLike" in GeoServer?
1
vote
1answer
91 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
31 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
62 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) ...
1
vote
2answers
73 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
52 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
55 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
121 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
88 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
50 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
120 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
39 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
92 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
146 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
177 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], ...
2
votes
1answer
540 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 ...