[postgis-users] Topology: error creating aggregated topogeom (at city level) from a neighborhoods topogeom

Lucas Ferreira Mation lucasmation at gmail.com
Fri Jan 29 19:39:49 PST 2016


Sorry, I had used addtopogeometrycolumn but I forgot to paste in the email.

This is the complete code. I'm still getting error messages, either I don't
get the arguments or there is a bug.

--1) creating the underlying topology elements, (sectors)

SELECT topology.CreateTopology('topo_AC',32719);
SELECT topology.addtopogeometrycolumn('topo_AC',
'public','temp_geom_ac','tg_geom_dump_utm','POLYGON');
UPDATE temp_geom_ac SET tg_geom_dump_utm =
toTopoGeom(geom_dump_utm,'topo_AC', 1, 1) ;


--2) Creating the more aggregated cities table and adding a topogeometry

CREATE TABLE cities AS
SELECT     substring(cod_set,1,7) AS cod_mun
FROM temp_geom_ac
GROUP BY substring(cod_set,1,7)
SELECT topology.addtopogeometrycolumn('topo_AC',
'public','cities','tg_cities','POLYGON');


-- at this pooint these are the contents of topology.layer table

-- 
topology_id;layer_id;shcema_name;table_name;feature_column;feature_type;child_id
-- 15;1;"public";"temp_geom_ac";"tg_geom_dump_utm";3;0;NULL
-- 15;2;"public";"cities";"tg_cities";3;NULL

-- thus, tg_cities is associated with layer_id 2. Isn't this what I shuold
use as layer_id in the CreateTopogeom  function (bellow)?

-- 3) adding content to "tg_cities"

UPDATE cities
SET tg_cities = CreateTopogeom( 'topo_AC',3,2,foo.city_faces)
FROM(    SELECT     substring(cod_set,1,7) AS cod_mun,

TopoElementArray_Agg(ARRAY[(tg_geom_dump_utm).id,(tg_geom_dump_utm).layer_id])
AS city_faces
    FROM temp_geom_ac
    GROUP BY substring(cod_set,1,7)
     ) as foo
WHERE  cities.cod_mun=foo.cod_mun

-- ERROR:  A TopoGeometry of type 3 cannot contain topology elements of
type 1

The error above is weird. I tell the function tg_type =3 (areal), but
somehow it is considering it to be 1 (point).

regards
Lucas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160130/b3c468c8/attachment.html>


More information about the postgis-users mailing list