2

I want to have a query that will insert a new edge into an existing topology, and create new nodes accordingly. I would rather not rebuild the entire topology because I want all the existing node and edge ids to stay just as they are (unless they must be split). It seems to me that I should follow this workflow:

--SELECT topology.CreateTopology('network_topo', 31467);
--SELECT topology.AddTopoGeometryColumn('network_topo', 'public', 'existing_network', 'topo_geom', 'LINESTRING');
--UPDATE existing_network SET topo_geom = topology.toTopoGeom(geom, 'network_topo', 1, 1.0);
SELECT topology.AddEdge('network_topo', ST_LineMerge(public.new_lines.geom))
FROM public.new_lines;

(The commented out parts are things I have already done)

However the topology.AddEdge command is returning this error:

ERROR:  AddEdge can only be used against topologies with no faces defined

I don't really care about faces, I am only interested in the linear features and nodes. But I don't know how I can create a topology with undefined faces.

Or maybe I am just on the wrong track entirely. Is this even possible? Or is it necessary to rebuild the entire topology with a new table of polylines with the new lines added?

1

You want to use TopoGeo_AddLineString():

SELECT topology.TopoGeo_AddLineString('network_topo', ST_LineMerge(public.new_lines.geom))
FROM public.new_lines;

Currently undocumented in PostGIS official documentation: Like in my example code, the 3rd parameter for tolerance can be omitted. In this case, it will be 0, which means "same tolerance as the topology's global tolerance", which you defined when creating the topology.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.