Skip to content

Commit 346d9c3

Browse files
authored
use GeometryType function (#73)
1 parent c41190c commit 346d9c3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

data/import-theme/osm-feature-info/topics/geography_tables.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ themepark:add_table{
2323
},
2424
{ column = 'geom_type',
2525
create_only = true,
26-
sql_type = 'text GENERATED ALWAYS AS (ST_GeometryType(geog::geometry)) STORED NOT NULL'
26+
sql_type = 'text GENERATED ALWAYS AS (GeometryType(geog::geometry)) STORED NOT NULL'
2727
}
2828
},
2929
indexes = {{

data/initial_subdivide.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ FROM
2424
geometries
2525
WHERE
2626
ST_NPoints(geog::geometry) > max_vertices()
27-
AND ST_GeometryType(geog::geometry) IN ('ST_Polygon', 'ST_MultiPolygon');
27+
AND GeometryType(geog::geometry) IN ('POLYGON', 'MULTIPOLYGON');

data/trigger.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ OR REPLACE FUNCTION perform_polygon_subdivide () RETURNS TRIGGER AS $$
33
BEGIN
44

55
IF ST_NPoints(NEW.geog::geometry) > max_vertices()
6-
AND ST_GeometryType(NEW.geog::geometry) IN ('ST_Polygon', 'ST_MultiPolygon')
6+
AND GeometryType(NEW.geog::geometry) IN ('POLYGON', 'MULTIPOLYGON')
77
THEN
88
INSERT INTO polygons_subdivided (osm_id, osm_type, geom)
99
VALUES (
@@ -25,7 +25,7 @@ CREATE
2525
OR REPLACE FUNCTION delete_subdivided_polygon () RETURNS TRIGGER AS $$
2626
BEGIN
2727
-- we do not check the vertices count like in the other statements, because it does not matter in this case
28-
IF ST_GeometryType(OLD.geog::geometry) IN ('ST_Polygon', 'ST_MultiPolygon')
28+
IF GeometryType(OLD.geog::geometry) IN ('POLYGON', 'MULTIPOLYGON')
2929
THEN
3030
DELETE FROM polygons_subdivided WHERE osm_id = OLD.osm_id;
3131
END IF;
@@ -43,7 +43,7 @@ OR REPLACE FUNCTION update_subdivided_polygon () RETURNS TRIGGER AS $$
4343
BEGIN
4444
IF ST_NPoints(NEW.geog::geometry) > max_vertices()
4545
THEN
46-
IF ST_GeometryType(NEW.geog::geometry) IN ('ST_Polygon', 'ST_MultiPolygon') THEN
46+
IF GeometryType(NEW.geog::geometry) IN ('POLYGON', 'MULTIPOLYGON') THEN
4747
DELETE FROM polygons_subdivided WHERE osm_id = OLD.osm_id;
4848
INSERT INTO polygons_subdivided (osm_id, osm_type, geom)
4949
VALUES (

0 commit comments

Comments
 (0)