[postgis-users] ST_Simplify(TopoGeometry) doesn't simplify hierarchical topogeoms

Duncan McPherson duncan at mcpherson.org.uk
Thu Nov 21 02:39:52 PST 2013


When I try to run 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


My version info is:

SELECT version() || ' ' || postgis_full_version();
"PostgreSQL 9.3.1 on x86_64-apple-darwin11.4.2, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00), 64-bit POSTGIS="2.1.1 r12113" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GD (...)"


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? What would be the best way to fix this?

Thank you,

Duncan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20131121/d35f336e/attachment.html>


More information about the postgis-users mailing list