The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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.

26 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
189 views

ST_Difference in PostGIS : problem with geometry result (Polygon)

I'm experimenting a result issue using the ST_Difference spatial function in PostGIS. Input : Feature 1 and 2 overlaps each other. Both contains 5 vertices, like a rectangle (4 plus an additional ...
51 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 ...
42 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 ...
54 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 ...
49 views

Populate b.field into a.field when 2 vector points not always coincident but should be coincident

Using QGIS/pgAdmin3, I have a situation where two vector points, should be coincident but I can't guarantee they always are, I need to take feature a.field and populate a field in feature b, upon both ...
31 views

How to obtain Wide Function in QGIS?

Is there a way to compute the wide function in QGIS?. I want to obtain this function to compare the topology of two stream networks. According to Bras (1990) the wide geometrical function N(x) ...
293 views

Splitting / Divide Polygon in same squares

I have a polygon in a table with 100 meters to 100 meters ( 1 row) and I would like to splitt / devide it to same square parts for 10 meters. The result should be then 100 rows with 10x10 meters. How ...
178 views

Application of a Piecewise Logistic Function to Extract Seasonality Metrics

I am working with 16-day MODIS EVI (satellite) data and I want to fit a Piecewise Logistic Function through my 23 EVI data values. The following formula is for the Piecewise Logistic Function: y(t)= [...
28 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, ...
57 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 ...
42 views

QGIS 3.6: variable functions, confusing explanation

The documentation (https://docs.qgis.org/3.4/en/docs/user_manual/working_with_vector/expression.html#id31) says: To use these functions in an expression, they should be preceded by @ character (e....
41 views

Error with generate_series

I`d like to create a Hex Grid using Hex grid algorithm for PostGIS (https://medium.com/@goldrydigital/hex-grid-algorithm-for-postgis-4ac45f61d093) DO  DECLARE _curs CURSOR FOR SELECT geom3857 ...
40 views

Summarize table by group and add logic to keep data

I need to dissolve a polygon layer by group but, at the same time, I need to keep some of the data in extra columns. This is the diagram: This is the logic for the new group: Cod = "Cod" where N1 ...
126 views

Converting @layer_name tokens into Shapefile Attributes (Columns/Rows) using QGIS Expression Editor?

I'm a fairly novice Python user and I've been banging my head against this problem for a number of days now. Assumptions I've made: This is doable within QGIS, and does not need to be done ...
107 views

How to call a stored pgsql function from Geoserver?

I created a stored function in PostgreSQL : myfunction(a text, b integer). I want to create an SQL View in Geoserver using this query : Select * from myfunction('%nom%', %likes%). My problem is that ...
54 views

Using Python function for cost calculation in GIS

I want to calculate the cost of two raster layers (ramdom, simulated) composed of values 1 and two, the first created randomly and the second by optimization using two associated cost layers. The code ...
290 views

QGIS auto fill with increments

i want a shapefile table to be autofilled,for example each new point i place has an attribute column that auto fills its self a set of repeated numbers such as (1,2,3,4,1,2,3,4,1,...etc) and another ...
152 views

QGIS referring to a features length with python in function editor

I tried to modify the code given in https://gis.stackexchange.com/a/212762/7849 so the value from [field_name] would be divided by the length of the feature. I tried to change the last line in ...
147 views

Crop a raster by a grid shapefile with different extensions in R

I need crop a raster by a grid shapefile to obtain raster files cutted according to grid cells (which are named "PageNumber"). My function is: g=shapefile("50x50km_final.shp") f=raster("...
121 views

A mesh points for each polygon: how to create function?

I want to use function for creating a mesh point for each polygon, but I am new in python. what is wrong with the function: def creatingPoints(minX, minY,maxX,maxY,number): while minY < maxY: ...
165 views

How to fill a symbolLayer with a custom texture?

I have this code : pLayer is a QgsVectorLayer * QgsFeatureRendererV2 * lrenderer = pLayer->rendererV2(); QList<QgsSymbolV2 *> lSymbols = lrenderer->symbols(); QgsSymbolLayerV2 * ...
57 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 ...
59 views

Two points that are the same

In my dataset there are two points that are identical in every way. I'm looking for a way to run some kind of query or functional attribute to make it such that there is only one point at this ...
213 views

Connect to local file or PostGIS layer in field calculator QGIS

I'm trying to make query from field calculator so that it would be possible to connect to PostGIS layer (or local file on computer) and select data according to condition so that use this selection ...