Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
17 views

Earth Engine how to avoid timeout for buffer calculation?

I have a function that takes a feature and creates a buffer around it. createBuffer = function(feature){ var AOI = feature.geometry().buffer(3000); return ee.Feature(AOI).copyProperties(feature)...
0
votes
1answer
14 views

Earth Engine create user defined function with default parameters

I am creating a user based function that I will save in my repository for re-use later. But I'm facing a problem with putting default values in my parameters. var myFunction = function(number, power ...
0
votes
1answer
14 views

IDL - calculate mean ignoring zeros [closed]

Imagine the following array: a = [10768,10764,10893,10763,10723,10792,0,0,0,0] Using a function like "MEAN" in IDL, is there a way to calculate the mean value, ignoring the zeros? I know this can ...
1
vote
1answer
29 views

Earth Engine - function for printing multiple histograms

I have several time periods within a feature where the precipitation was very low stored in a FeatureCollection with the properties "begin", "end", "amount", "days".I want to use the feature ...
2
votes
0answers
39 views

QGIS Create a function in the function editor

In Expression dialogue I introduced the formula "Value" / ( sum( "Value" ) / (count( CASE WHEN "Value" >= 1 THEN +1 END))) In QGIS in the Attribute Table, there are many fields with values for ...
0
votes
1answer
47 views

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 = ...
1
vote
1answer
26 views

Cross-schema function call with PostGIS dependencies

I have an issue where I am unable to make a cross-schema function call because of that function's use of PostGIS. I have both PostGIS and my function in the public schema, but I'm trying to call the ...
2
votes
1answer
41 views

Can you auto-populate a field in Survey123 from another field by only pulling certain characters?

I have a field where the user inputs text Aa1Bb2Cc3 Am I able to auto populate another field by only populating the field with Bb or 3. Auto populate the field with characters [4:6] or just [9] ...
0
votes
2answers
75 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
28 views

image.substract is not a function

Link to GEE function BAI(Im){ var pcr = 0.1 var pir = Im.select('B3') var pcnir = 0.06 var pinir = Im.select('B4') var one = 1 var bai = one.divide(pcr.subtract(pir).pow(2).add(pcnir.subtract(pinir)....
-1
votes
0answers
33 views

Call function from script inserted in Toolbox (ArcGIS)

I'm trying to call a function defined in a script contained in a Toolbox in ArcGIS. I have imported the Toolbox via arcpy.ImportToolbox. The scripts contained are recognized. I cannot call the ...
1
vote
0answers
21 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 ...
0
votes
2answers
32 views

Specific methodology to call a GRASS function like v.transform with Python

I cannot understand if and how I can call with its parameters a GRASS function like v.transform through a Python script from e.g. PyCharm etc. Is there something comprehensible to understand? An ...
0
votes
1answer
20 views

Making the results from function a string [closed]

I am trying to get the features count from feature, then put it in a dictionary that I can call later: ct_dict = dict() ... fipsList = ['13245','06007'] for fip in fipsList: mergedJoinCentroids =...
4
votes
2answers
431 views

How to extract a part of string from fields 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( "Text", ...
0
votes
1answer
122 views

Setting “Map View” instead of “Split View” in Leaflet javascript

I am using geojson-dashboard framework template for Leaflet (http://fulcrumapp.github.io/geojson-dashboard/). By default, the initial view of the screen is "splitted" or "divided" (half view is the ...
3
votes
0answers
97 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 ...
0
votes
1answer
46 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 ...
1
vote
1answer
73 views

Updating PostgreSQL geometry column using SQL (Trgger)

I'm looking to inderstand the role of date_part('epoch'::text, now()) WHERE id=NEW.id; in the trigger function below. CREATE OR REPLACE FUNCTION fn_test_table_geo_update_event() RETURNS trigger AS $...
1
vote
1answer
185 views

NDWI and Cloud Pixel count

I am trying to add the (amount of pixels of) NDWI and Clouds as bands to my image collection. The NDWI works out, but I get stuck when adding the Clouds. The error refers to an incompatible number of ...
1
vote
1answer
23 views

Classifying text field 'B' using integer in field 'A'?

I wrote an if elif statement that will loop through records (field A) and populate a new field (field B) based on A's contents. Field A name is 'CLASS'. Field B is 'class_desc'. reclass(!class_desc!...
0
votes
1answer
105 views

Overview of available images per image collection?

I´m trying to make an overview in a table or graph of the available images in Landsat, Sentinel and Modis series for a certain area of interest. Although I could solve it as follows, this is obviously ...
1
vote
1answer
73 views

Filtering number of features in GeoServer using SLD?

I have published point file in geoserver from postgis table as store. I had huge data in my table(rows) and the data will keep udate daily (at least one point for one day). Now I want to show only ...
0
votes
1answer
98 views

Why is arcpy.ListUsers() not able to open SDE workspace?

I am working with ArcGIS Pro 2.1 and Python 3.6.2. and I am writing a script that involves the arcpy.ListUsers() function and whenever I run the code I receive the following error: The SDE workspace ...
-3
votes
1answer
34 views

How does someone write a python function? [closed]

How does someone write a python function that converts a 'date' to the day of the year (e.g. Jan 31st would be the 'date' and 31 would be the day of year, Feb 1st would be the 'date' and 32 would be ...
2
votes
2answers
92 views

Adding xy data and exporting layer in function using ArcPy?

I am trying to add xy data into the attribute tables of 2 point layers, then export the tables into 2 separate excel tables using this code: env.workspace = r"G:\PROJECTS\osfie\gis\lyr" lyr1 = r"G:\...
1
vote
0answers
99 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 ...
2
votes
1answer
262 views

Reusing leaflet map elements in custom functions in Shiny/R

I have an application that reuses several leaflet elements, so I'm trying to build functions to streamline my code. All of my logical attempts failed, so I utilized an example I was familiar with ...
1
vote
1answer
174 views

Calculating albedo values with landsat 7 ImageCollection/FeatureCollection error in Google Earth Engine?

I am facing a technical difficulty with Google Earth Engine I am trying to retrieve the albedo value of the state of Idaho by using Landsat7 TOA reflectance imagery over the span of a year. ('2005-01-...
4
votes
1answer
807 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
1answer
53 views

Save lappy results without overwritting - R

Here is my situation, I have 10 multi-spectral images. For each one I am calculating three different vegetation indices. Those 3 raster objects share resolution, projection, extent and dimension (...
4
votes
2answers
252 views

QGIS stopEditing function in python

I am trying to stop the edits using the python console of the QGIS and the code QgsTrackedVectorLayerTools.stopEditing(layer,False) where layer is the layer in the edit mode. I am receiving the ...
3
votes
1answer
97 views

PostGIS function testing geometries, inside and boundary

Is there a st_????(A geometry, B geometry) in PostGIS that returns true when B is inside A and possibly shares a boundary ? I would say no after reading the doc but something may have escaped me.
1
vote
0answers
87 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 ...
1
vote
1answer
107 views

Counting average of all polygons instead of every polygon in PostGIS?

I'm facing a problem with counting avg of all polygons in pgsql query. Instead of that I receive avg(of an area) of every polygon separately. My syntax is looking like this: CREATE OR REPLACE ...
1
vote
0answers
46 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 ...
4
votes
2answers
236 views

How is the st_length function stored in an Oracle geodatabase?

How is the st_length function stored in an Oracle geodatabase? Is it in a: PL/SQL function Separate .dll library Somewhere else? I've noticed that the sde.st_length function works, even when the ...
-1
votes
1answer
72 views

How add GRASS functions to QGIS 2.6? [duplicate]

In my toolbox doesn't exist any grass function, what act I should do?
0
votes
1answer
70 views

How to install QGIS 2.6 with GRASS functions?

I install QGIS 2.6 but QGIS-OSGeo4w didn't install GRASS functions. I removed other versions from control panel (feature and program) but, in all of times that I install it, I confront with this error ...
0
votes
0answers
169 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 ...
0
votes
1answer
485 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 ...
0
votes
0answers
124 views

Calling a function for two geojson files in Leaflet

I have two geojson files : 1- world_countries.geojson : each feature has properties "name" and "relation" as in the following example: { "type": "FeatureCollection", "features": [ { "...
1
vote
1answer
803 views

Removing n first digits on a field attribute table using QGIS string functions

I'm looking for a QGIS function to remove the first n digits on a field attribute table using QGIS string function. For exemple I have the following string in a QGIS attribute table: 742-004-SRV ...
1
vote
0answers
225 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 ...
1
vote
0answers
125 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 ...
2
votes
0answers
46 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 ...
2
votes
0answers
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) ...
5
votes
1answer
354 views

Writing QGIS field calculator formula?

I have a table with 2 fields, field1 contains site specific data, field2 contains a number which groups the field1: Field1, Field2 180, 1 203, 1 220, 1 205, 1 160, 2 140, 2 135, 2 I want to sort ...
2
votes
0answers
224 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 ...
3
votes
1answer
317 views

Accessing each value from array and feed it to another function in PostGIS?

I have an edge_table containing start_id and start_geom column. I want to make one function which will take integer array as input (starts). In between the function, the array values will be checked ...