Hot answers tagged

9 votes
Accepted

Geometry based automatic fill of fields in attribute table

Set a default value in the edit widgets. Check the box for "Apply default value on update." With this setting, the attribute will be updated whenever a feature's attribute or geometry is changed. The ...
csk's user avatar
  • 24.7k
8 votes

Trigger PostGIS QGIS

Don't UPDATE the tables, simply set the value of the NEW record; the NEW (and OLD in UPDATES) record is passed to the function for each row and will hold the full set of values that is adressed by the ...
geozelot's user avatar
  • 29.9k
6 votes

How to trigger calculation on QGIS startup?

I think what you are looking for is a virtual field. It is a field based on an expression that is always evaluated and not stored in memory. To do it you have to open the field calculator check the ...
Corentin Lemaitre's user avatar
6 votes
Accepted

Date management problem in a trigger with PostgreSQL

For each inserted row, you are fetching the complete list of DISTINCT date_part('year', s_date_signal) entries from the public.test table, of which the first record in random (semi-deterministic, or ...
geozelot's user avatar
  • 29.9k
5 votes
Accepted

Automatically add points geometry while GPS logging?

my answer is based on: http://www.postgresqltutorial.com/creating-first-trigger-postgresql/ and https://stackoverflow.com/questions/39607334/postgres-trigger-creation-error-no-language-specified-sql-...
vagvaf's user avatar
  • 1,142
4 votes
Accepted

PostGIS trigger does not work as expected while checking intersections

The trigger is throwing an error because the endpoints of the snapped lines do not intersect the building. A point-to-line snap operation returns the closest point to the line that can be represented ...
dbaston's user avatar
  • 13k
4 votes

Running second FME workspace when first workspace is completed

You can use a workspacerunner transformer, to be triggered at the end of the first workspace; this is typically after a featurewriter. Note the workspacerunner will run once for every incoming ...
JimT's user avatar
  • 2,373
4 votes
Accepted

How to create trigger to check geometry validity?

Referring to the documentation, I suspect that you want to do something like the following CREATE TABLE vec_geometry ( id bigserial, is_valid boolean, invalid_reason character(128), geom ...
MickyT's user avatar
  • 3,430
4 votes

Insert/Update/Delete table from another table changes in PostGIS

For the insert, you don't need to re-select from the source table. As it is, you are computing the centroid of the new row geometry (so 1 row) for EVERY row that has a geometry and the desired ...
JGH's user avatar
  • 41.6k
4 votes

TRIGGER FUNCTION: With UPDATE of geom: Calculate automatically area column

Your trigger set-up is bound to fail for a multitude of reasons, most prominently: a [BEFORE|AFTER] INSERT trigger never resolves to TG_OP = 'UPDATE' an unbounded UPDATE inside the function will ...
geozelot's user avatar
  • 29.9k
3 votes

Trigger in PostGIS that deletes or updates a feature based on location

As mentioned in comments, just add an AFTER DELETE trigger with the intended logic, e.g. CREATE OR REPLACE FUNCTION the_schema.chamber_closure_cascade_trigger_function() RETURNS TRIGGER LANGUAGE '...
t.ry's user avatar
  • 81
3 votes
Accepted

PostgeSQL Trigger St_Intersect Insert, Update

My comment wasn't very thoughtful, albeit true; your function misses a RETURN; (which is precisely what that error states). However, let's think this through: you are setting up a trigger working ON ...
geozelot's user avatar
  • 29.9k
3 votes
Accepted

Perform intersection using a TRIGGER

First of all, the trigger should be on buffer table. Secondly, you should insert the intersection (now you claculate it but then leave it behind). I used the following codes to create 3 tables: ...
milad's user avatar
  • 699
3 votes
Accepted

Running second FME workspace when first workspace is completed

You could do it all in one workspace using FeatureReaders / FeatureWriters instead of classic Readers / Writers. (Using the FeatureWriter summary output to initiate the check proces.) Or use a ...
nielsgerrits's user avatar
  • 3,884
3 votes

Geometry type and create trigger for that in postgresql

In your trigger before function (using plpgsql language), you can try something like: if (st_geometrytype(NEW.geom) like 'ST_Point') then -- your logic here, for example: NEW....
WKT's user avatar
  • 2,183
3 votes
Accepted

Backup table does not replicate geometry, fed by trigger in pgAdmin (postGIS)

Row-level triggers gain access to the transitional state of each respective row via the trigger-level variables OLD & NEW - however, the state of these variables are dependent on the trigger ...
geozelot's user avatar
  • 29.9k
2 votes
Accepted

PostgreSQL 'BEFORE INSERT' TRIGGER Problem with QGIS

There are two issues. First, the one that produce the error, the trigger must specify that you are applying it for each row. Secondly, the function must return New otherwise nothing will be inserted ...
JGH's user avatar
  • 41.6k
2 votes

Setting python code to trigger on any update on feature class?

Use label expression: def FindLabel ( [OID] ): mxd = arcpy.mapping.MapDocument("CURRENT") lr=arcpy.mapping.ListLayers(mxd)[0] with arcpy.da.UpdateCursor(lr, ('Shape@','POINT_X','POINT_Y'),r'"...
FelixIP's user avatar
  • 22.8k
2 votes

ArcSDE 10.1 Insert/Update Trigger on Adds (A) Table (Oracle 11g) and Feature Services on ArcGIS Server

Ok. I replicated the environment: ArcSDE 10.1 Insert / Update Trigger on Adds (A) Table (Oracle 11g) and Feature Services on ArcGIS Server 10.1. If the feature service is published on the default ...
lele3p's user avatar
  • 900
2 votes

Adding per-row creation time and modification time in GeoPackage geometry table?

I've just found that: if I use DATETIME as column type instead of TIMESTAMP I use (strftime('%Y-%m-%dT%H:%M:%fZ','now')) instead of CURRENT_TIMESTAMP I use triggers AFTER UPDATE and AFTER INSERT ...
Jack's user avatar
  • 41
2 votes
Accepted

Update geometries with ST_UnaryUnion at TRIGGER

The documentation says: The return value of a row-level trigger fired AFTER … is always ignored; it might as well be null. To change the new row, you must use a BEFORE trigger.
CL.'s user avatar
  • 1,973
2 votes
Accepted

Trigger - Calculate area of a layer inside feature

Your query is making a cross-product between the two tables. Since you are not using the table public.lotes but only the NEW geometry, you can simply remove , public.lotes from the query.
JGH's user avatar
  • 41.6k
2 votes

Running second FME workspace when first workspace is completed

You shouldn't need a trigger on an FME Server automation; as long as it is connected, the second workspace will start automatically when the first finishes: So here "austinApartments" will run as ...
Mark Ireland's user avatar
  • 13.1k
2 votes

PostGIS trigger : table and materialized view

Creating a materialised view executes a query and writes the result to disk. It will only update the result set when told to do so (REFRESH MATERIALIZED VIEW {view table}). A view will only execute ...
alphabetasoup's user avatar
2 votes

Having changes to SpatiaLite table column to automatically update GIS layer

You can use triggers in SpatiaLite too. In fact, you probably already are, and just didn't notice it. Using the command line client: spatialite> CREATE TABLE lines (id INTEGER NOT NULL PRIMARY KEY ...
BradHards's user avatar
  • 12.8k
2 votes
Accepted

QGIS - Trigger's execution too slow (QGIS freeze)

EDIT: Finaly found it. I regrouped all the triggers and I worked with rowid and pkuid. CREATE TRIGGER A_insert_eunis_gest AFTER INSERT ON HABITATS_POLY BEGIN -- Insérer dans GESTION_CODES les ...
Giene's user avatar
  • 669
1 vote

Having changes to SpatiaLite table column to automatically update GIS layer

Found a solution, not perfect, but doable. The issue is refreshing the labels of a spatialite layer where the labels are from columns joined with a non-geometry table. I have found that in the join, ...
Robotuner's user avatar
  • 394
1 vote
Accepted

Make array_append in trigger with PostGIS intersection

There are several things wrong in the original trigger function: 1) the same table as the target table is used in an update statement (likely creating the loop you are mentioning) 2) the entire table ...
JGH's user avatar
  • 41.6k
1 vote

Under what circumstances would the _DELETE trigger get called? (_EVW)

The delete trigger would get called when deletion of the feature is done from a child version. The deleted row would be stored in the delta D table created upon registering the FC as versioned for the ...
S_K's user avatar
  • 72
1 vote
Accepted

Prevent deletes in a versioned table at the database level

This trigger on the DELETES table seems to work. CREATE OR REPLACE TRIGGER D202574_custom BEFORE INSERT ON D202574 FOR EACH ROW DECLARE v_upd_row NUMBER; BEGIN SELECT COUNT(1) INTO v_upd_row ...
User1974's user avatar
  • 1,122

Only top scored, non community-wiki answers of a minimum length are eligible