[PostGIS] #5691: Revive tiger_topology function

PostGIS trac at osgeo.org
Wed Mar 27 17:19:13 PDT 2024


#5691: Revive tiger_topology function
-----------------------------+---------------------------
  Reporter:  robe            |      Owner:  robe
      Type:  enhancement     |     Status:  new
  Priority:  medium          |  Milestone:  PostGIS 3.5.0
 Component:  tiger geocoder  |    Version:  master
Resolution:                  |   Keywords:
-----------------------------+---------------------------
Comment (by robe):

 I did a baseline, yeh it still at least works.
 Doing my baseline on demo.postgis.net on tiger_2023 database

 My baseline was this:


 {{{
 SELECT topology.CreateTopology('topo_dc', 4269);
 SELECT cntyidfp FROM tiger.county where statefp = '11';

 -- took 1 min 13 secs.
 SELECT tiger.topology_load_tiger('topo_dc', 'county', '11001');
 }}}



 {{{
 SELECT topology.TopologySummary('topo_dc');
 }}}

 outputs:


 {{{
 Topology topo_dc (id 1, SRID 4269, precision 0)
 13152 nodes, 21663 edges, 8673 faces, 0 topogeoms in 0 layers

 }}}

 --comparing against the edges and nodes for DC


 {{{
 SELECT (SELECT count(*) FROM tiger.edges WHERE statefp = '11') AS
 cnt_orig_edges
 , (SELECT count(*) FROM tiger.faces WHERE statefp = '11') AS
 cnt_orig_faces;
 }}}



 {{{
 cnt_orig_edges | cnt_orig_faces
 ----------------+----------------
           21663 |           8673
 (1 row)
 }}}

 Yeh so that matches

 Now for bad news,


 {{{
 SELECT error, count(*)
 FROM  topology.ValidateTopology('topo_dc')
 GROUP BY error;
 }}}


 Returns:


 {{{
          error          | count
 -------------------------+-------
  invalid next_left_edge  | 21073
  invalid next_right_edge | 21409
 (2 rows)
 }}}


 But I suspect this is my accounting logic shoving the tiger edges and
 faces into PostGIS topology.

 Since I am using the existing tiger edge ids, I also need to reset the
 sequence id of the topology, which it appears I am not doing, so future
 possible adds don't conflict with that's been added.

 Although it looks like I'm literally taking what tiger is giving me cause
 in the tiger.edges structure I am mapping to postgis topology edge_data
 structure as follows


 {{{
  , t.tnidf As start_node, t.tnidt As end_node, t.tfidl As left_face
                         , t.tfidr As right_face, tl.tlid AS
 next_left_edge,  tr.tlid As next_right_edge
 }}}


 I am doing some extra math though with negating things and closing stuff
 up if it doesn't match, so the issue might be there.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5691#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list