<div dir="ltr"><div><div><div>Sorry, I had used addtopogeometrycolumn but I forgot to paste in the email. <br><br></div><div>This is the complete code. I'm still getting error messages, either I don't get the arguments or there is a bug. <br></div><div><br></div>--1) creating the underlying topology elements, (sectors)<br><pre>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) ;</pre><br></div>--2) Creating the more aggregated cities table and adding a topogeometry<br><br>CREATE TABLE cities AS<br>SELECT substring(cod_set,1,7) AS cod_mun<br>FROM temp_geom_ac<br>GROUP BY substring(cod_set,1,7) <br>SELECT topology.addtopogeometrycolumn('topo_AC', 'public','cities','tg_cities','POLYGON');<br><br><br>-- at this pooint these are the contents of topology.layer table<br><br>-- topology_id;layer_id;shcema_name;table_name;feature_column;feature_type;child_id<br>-- 15;1;"public";"temp_geom_ac";"tg_geom_dump_utm";3;0;NULL<br>-- 15;2;"public";"cities";"tg_cities";3;NULL<br><br></div><div>-- thus, tg_cities is associated with layer_id 2. Isn't this what I shuold use as layer_id in the CreateTopogeom function (bellow)?<br></div><br><div>-- 3) adding content to "tg_cities"<br><br>UPDATE cities <br>SET tg_cities = CreateTopogeom( 'topo_AC',3,2,foo.city_faces)<br>FROM( SELECT substring(cod_set,1,7) AS cod_mun, <br> TopoElementArray_Agg(ARRAY[(tg_geom_dump_utm).id,(tg_geom_dump_utm).layer_id]) AS city_faces<br> FROM temp_geom_ac<br> GROUP BY substring(cod_set,1,7) <br> ) as foo<br>WHERE cities.cod_mun=foo.cod_mun<br><br>-- ERROR: A TopoGeometry of type 3 cannot contain topology elements of type 1<br><br></div><div>The error above is weird. I tell the function tg_type =3 (areal), but somehow it is considering it to be 1 (point). <br></div><div><div><br></div><div>regards<br></div><div>Lucas<br></div><div><br><br><br></div></div></div>