Skip to main content
100%

Polygon insert Named Function

✓ Published0🌍 Public
Aandrewxhill
Last edited May 23, 2013
Created on May 23, 2013

This example shows a SQL function that inserts new polygon features into a Minneapolis dataset, limited to geometries with fewer than 100 points. The function, `AXH_NewMinneapolis`, takes an integer parent ID and a geometry, then performs an `INSERT` into the `minneapolis` table using the `RETURNING cartodb_id` clause. It is defined with `SECURITY DEFINER` to elevate privileges during execution, and `EXECUTE` permission is granted to the public user. The code uses PostgreSQL/PostGIS spatial functions like `ST_NPoints` and the CartoDB API to manage the data insertion.

AI-generated description

Similar vizzes