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
1 answer
37 views

Using intersect analysis within if loop as part of function

I'm currently trying to create a function for calculating an intersect of one of two shapefiles with another shapefile. I am later looping through the list of files and, depending on which one the ...
user avatar
  • 13
1 vote
1 answer
44 views

median function of GEE

I want to do some reprocessing with ee.ImageCollection("NOAA/VIIRS/DNB/MONTHLY_V1/VCMSLCFG"). For example,I want to caculate median value of each pixel in 12 images. var imageCollection = ee....
user avatar
0 votes
0 answers
22 views

Multiple functions linked to parameter in ArcPy Python Toolbox

I would like to link some parameters directly to its function, so when i call a .map() function it could apply for several images in the collection. def __init__(self): """...
user avatar
0 votes
2 answers
44 views

Calculating number of days where a condition is met over multiple regions in Google Earth Engine

I have been trying to calculate the number of days where the wind speed average per day exceeded 25 m/s for all municipalities in Colombia during the year 2015. My goal is to know how many days ...
user avatar
1 vote
1 answer
122 views

Filtering and adding GeoJSON features using function in Leaflet

I have a Leaflet map where I am adding the features from a GeoJSON file. I am able to filter the features depending on the properties in the GeoJSON. I am writing out the same giant block of code each ...
user avatar
2 votes
0 answers
54 views

Calculating Annual Standard Deviation of Daily TRMM Precipitation

I am trying to calculate the annual standard deviation of daily data from 3hr TRMM observations at the catchment scale. First, I take a temporal sum of 3hr measurements to get daily P sums. Then I ...
user avatar
0 votes
0 answers
23 views

Custom function (R equivalent) for quantiles in GEE

We are working on a problem in GEE where we want to extract the 90% quantile of NDVI values from a time series of MODIS images. The quantile function in GEE extracts the empirical value (i.e., the ...
user avatar
1 vote
0 answers
44 views

Passing table name as an argument in PostGIS function [closed]

How can I pass my table name as an argument of a function? CREATE OR REPLACE FUNCTION public.countries_name1( z integer, x integer , y integer, name_prefix text default 'B' ) ...
user avatar
  • 41
0 votes
1 answer
45 views

GoogleEarthEngine: Calculate histogram for every image in ImageCollection using map function and reduceRegion

I want to calculate histograms for every image in an ImageCollection with reduce.histogram. It works with a single image but I have problems mapping the function over the ImageCollection. I think the ...
user avatar
  • 53
0 votes
1 answer
139 views

Set a property as a band value in Earth Engine

I have an image collection of MODIS monthly burn (MODIS/006/MCD64A1), in which BurnDate band is selected. I then have a function that calculates total burned area for each image (monthly). However, ...
user avatar
1 vote
1 answer
67 views

Scale Factors application not working on GEE PyQGIS

I'm trying to load some Lansadt 7 Collection 2 images on a QGIS project trought the following script: import ee from ee_plugin import Map ecorregiones = ee.FeatureCollection('users/paullcfias/...
user avatar
2 votes
1 answer
68 views

Create Function to a RasterStack

This is the function that I want to create: Erosivity_Factor = 1.74 * log[sum(montly²/annual)]+1.29 I have solved it using a loop: # Reproducible RasterStack with 12 layers Monlty<- stack(lapply(1:...
user avatar
0 votes
1 answer
81 views

Create a function that will return geodataframe

I have created the following function to take Origin = str, Destination = str, line = shapely.geometry.linestring.LineString, node = GeoDataFrame def create_lines_df(Origin, Destination, line_, nodes_)...
user avatar
0 votes
1 answer
67 views

GeoServer SLD env function does not work

I have a database: and I made with it a GeoServer getMap request which works great for one year (one column). But I want to change the year programmatically with JavaScript (I am open for better ...
user avatar
0 votes
1 answer
227 views

Python skipping functions

I have created the below code to grid an XYZ file to GeoTIFF using Python. However, when I run the code it seems to be skipping my functions within the class. I tried print statements within them and ...
user avatar
3 votes
2 answers
146 views

Calling specific row using ArcPy search/update cursors

When working with search and update cursors, how do I call upon a specific row? In this example: import arcpy, os # I want to find a row where the FID is 10 # print value field in the row where FID ...
user avatar
  • 69
0 votes
1 answer
39 views

Raster calculator - negative exponential transformation gives single-value output

I'm trying to apply a negative exponential transformation to a raster with values ranging from 0 to 1. In the literature, the function to do so is R = 100 - 99 * ((1 - exp(- c * H)) / (1 - exp(-c))) ...
user avatar
1 vote
0 answers
161 views

What is function of .horizon files in file geodatabase?

What is the function of the .horizon files that are present whenever a file geodatabase is created in ArcMap, I understand it is all proprietary formats for Esri, but is there any explanation? I have ...
user avatar
  • 11
2 votes
1 answer
79 views

lidR classify by shapefile (merge_spatial) issues with user defined function

I have successfully classified buildings via a buildings shapefile input for a single las file but I am having trouble with making a function to use this feature in the catalog format. Here is the ...
user avatar
0 votes
1 answer
88 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("...
user avatar
  • 150
0 votes
1 answer
42 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 ...
user avatar
2 votes
1 answer
100 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 ...
user avatar
  • 713
0 votes
1 answer
172 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 ...
user avatar
1 vote
2 answers
51 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 ...
user avatar
  • 791
1 vote
1 answer
256 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 ...
user avatar
  • 11
2 votes
1 answer
45 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 ...
user avatar
  • 55
0 votes
0 answers
90 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 ...
user avatar
3 votes
2 answers
767 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 ...
user avatar
  • 111
2 votes
1 answer
109 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 ...
user avatar
  • 111
0 votes
1 answer
295 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 ...
user avatar
1 vote
2 answers
202 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 ...
user avatar
1 vote
1 answer
115 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 ...
user avatar
2 votes
1 answer
538 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 ...
user avatar
1 vote
1 answer
584 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) { ...
user avatar
1 vote
2 answers
96 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 ...
user avatar
0 votes
1 answer
210 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() ...
user avatar
0 votes
0 answers
37 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 ...
user avatar
2 votes
1 answer
388 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 ...
user avatar
  • 23
6 votes
4 answers
200 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 "...
user avatar
10 votes
1 answer
432 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 ...
user avatar
  • 22.7k
4 votes
1 answer
272 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 # ...
user avatar
  • 87
0 votes
0 answers
37 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 "...
user avatar
  • 1
2 votes
1 answer
127 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, ...
user avatar
  • 754
0 votes
1 answer
159 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 ...
user avatar
4 votes
1 answer
182 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 ...
user avatar
1 vote
1 answer
485 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(...
user avatar
0 votes
0 answers
89 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, ...
user avatar
1 vote
1 answer
332 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 ...
user avatar
5 votes
1 answer
539 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 ...
user avatar
  • 22.4k
1 vote
0 answers
29 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?...
user avatar
  • 55