Opened 11 years ago

Closed 11 years ago

#2547 closed defect (fixed)

ST_Simplify(TopoGeometry) doesn't simplify hierarchical topogeoms

Reported by: duncandoo Owned by: strk
Priority: blocker Milestone: PostGIS 2.1.2
Component: topology Version: 2.1.x
Keywords: st_simplify topology hierarchy Cc: strk

Description

Running the topogeom version of ST_Simplify() on a topogeomery layer that is a parent layer I get the following error:

ERROR:  function topology.st_simplify(topogeometry) does not exist
LINE 1: SELECT st_multi(st_union(topology.ST_Simplify(topogeom))) as...
                                 ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:  SELECT st_multi(st_union(topology.ST_Simplify(topogeom))) as geom FROM public.alsace, alsace_topo.relation pr WHERE  pr.topogeo_id = 2 AND  pr.layer_id = 2 AND  id(topogeom) = pr.element_id  AND layer_id(topogeom) = pr.element_type 
CONTEXT:  PL/pgSQL function st_simplify(topogeometry,double precision) line 59 at EXECUTE statement

********** Error **********

ERROR: function topology.st_simplify(topogeometry) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Context: PL/pgSQL function st_simplify(topogeometry,double precision) line 59 at EXECUTE statement

And here is the SQL I run to get the error:

CREATE DATABASE france;
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

--Use QGis to import shape file from http://www.actualitix.fr/actgeoshap/regions/alsace.zip

SET search_path to public, topology;
SELECT CreateTopology('alsace_topo', find_srid('public', 'alsace', 'geom'));
SELECT AddTopoGeometryColumn('alsace_topo', 'public', 'alsace', 'topogeom', 'MULTIPOLYGON', (
SELECT layer_id FROM layer WHERE table_name = 'alsace'
));
UPDATE alsace SET topogeom = toTopoGeom(geom, 'alsace_topo', (
SELECT layer_id FROM layer WHERE table_name = 'alsace'
));
SELECT st_simplify(topogeom, 10000) FROM alsace; -- works
CREATE TABLE alsace_depts AS SELECT DISTINCT code_dept FROM alsace;
SELECT topology.AddTopoGeometryColumn('alsace_topo', 'public', 'alsace_depts', 'topogeom', 'MULTIPOLYGON', (
SELECT layer_id FROM layer WHERE table_name = 'alsace'
));
UPDATE alsace_depts SET topogeom = createTopoGeom('alsace_topo', 3, (SELECT layer_id FROM layer WHERE table_name = 'alsace_depts'), a.tgs) FROM
(
SELECT code_dept, topoElementArray_agg(array[id(topogeom),(SELECT layer_id FROM layer WHERE table_name = 'alsace')]) as tgs
FROM alsace
GROUP BY code_dept
) a
WHERE a.code_dept = alsace_depts.code_dept;
ALTER TABLE alsace_depts ADD COLUMN dept_geom geometry(MultiPolygon, 2154);
UPDATE alsace_depts SET dept_geom = topogeom::geometry(MultiPolygon,2154);
SELECT st_simplify(topogeom, 10000) FROM alsace_depts; -- doesn't work: produces error

I think what the error says is that the function is calling another function that doesn't exist (ST_Simplify(topogeom)). Is it supposed to be calling the function ST_Simplify(topogeom, double) instead?

Change History (2)

comment:1 by strk, 11 years ago

Priority: mediumblocker
Status: newassigned

comment:2 by strk, 11 years ago

Resolution: fixed
Status: assignedclosed

r12137 in trunk (2.2.0), r12138 in 2.1. branch (2.1.2)

Note: See TracTickets for help on using tickets.