If there any difference for snap to for lines and surfaces in Postgis Topology ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

If there any difference for snap to for lines and surfaces in Postgis Topology ?

Lars Aksel Opsahl-2

Hi


First I tested with lines and that worked find, the lines added the second time snapped to first lines. The data I tested with are found at.

https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/import/data3/edge_1219.shp .


At https://trac.osgeo.org/postgis/wiki/UsersWikiPostgisTopology I have added section

called “Convert shape file and simple feature data to Postgis Topology” that has some more info the function topo_help_sf_to_topology_case_1.


Here is the sql I tested with for lines that worked ok. 


# create test schema if not exist

psql sl -c'CREATE SCHEMA IF NOT EXISTS test2;'


# copy file muni_buffer_out that contains not ok buffered out municipalitie border "where komid not in (125)" into table test2.sf_in (drop and create if exits)

shp2pgsql -W ISO-8859-1 -d -D -s 4258 data3/edge_1219 test2.sf_in | psql sl; psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_3.muni_surface');"

# copy data from test2.sf_in into table topo_3.muni_surface (append data to topo_3.muni_edge)

psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_3.muni_edge',0.00001);"


# copy file muni_buffer_in that contains not ok buffered in municipalitie border "where komid not in (214)" into table test2.sf_in (drop and create if exits)

shp2pgsql -W ISO-8859-1 -d -D -s 4258 data3/edge_1521 test2.sf_in | psql sl; psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_3.muni_surface');"

# copy data from test2.sf_in into table topo_3.muni_surface (append data to topo_3.muni_edge)

psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_3.muni_edge',0.00001);"


Then I tried the same with surface data and they did not snap to as I expected.


The file https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/import/data2/muni_ok.shp contains the ok surfaces, but not the 4 surfaces where I have moved the border data around. But all edges needed are present in this file since the surface not added are inclosed by other surfaces.


The I added the files “muni_buffer_in.shp muni_buffer_in_2.shp muni_buffer_out.shp muni_projected.shp”, my hope was that the edges for this surfaces should snap to the exiting edges, but that did not seem to happen.


Her is the code I tested with 


# create test schema if not exist

psql sl -c'CREATE SCHEMA IF NOT EXISTS test2;'


# copy file muni_ok that contains ok municipalities border "where komid not in (125,214,233,301)" into table test2.sf_in (drop and create if exits)

shp2pgsql -W UTF-8 -d -D -s 4258 data2/muni_ok.shp test2.sf_in | psql sl;

# copy data from test2.sf_in into table topo_2.muni_surface (topo table topo_2.muni_surface will craeted on the fly if it does not exist)

psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface',0.00001,false,'new_gid_id',true,true);"


# copy file muni_buffer_out that contains not ok buffered out municipalitie border "where komid not in (125)" into table test2.sf_in (drop and create if exits)

shp2pgsql -W ISO-8859-1 -d -D -s 4258 data2/muni_buffer_out test2.sf_in | psql sl; psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface');"

# copy data from test2.sf_in into table topo_2.muni_surface (append data to topo_2.muni_surface)

psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface',0.00001);"


# copy file muni_buffer_in that contains not ok buffered in municipalitie border "where komid not in (214)" into table test2.sf_in (drop and create if exits)

shp2pgsql -W ISO-8859-1 -d -D -s 4258 data2/muni_buffer_in test2.sf_in | psql sl; psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface');"

# copy data from test2.sf_in into table topo_2.muni_surface (append data to topo_2.muni_surface)

psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface',0.00001);"


# copy file muni_projected that contains not ok projectes municipalitie border "where komid not in (233)" into table test2.sf_in (drop and create if exits)

shp2pgsql -W ISO-8859-1 -d -D -s 4258 data2/muni_projected test2.sf_in | psql sl; psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface');"

# copy data from test2.sf_in into table topo_2.muni_surface (append data to topo_2.muni_surface)

psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface',0.00001);"


# copy file muni_buffer_in_2 that contains not ok buffered in municipalitie border "where komid not in (301)" into table test2.sf_in (drop and create if exits)

shp2pgsql -W ISO-8859-1 -d -D -s 4258 data2/muni_buffer_in_2 test2.sf_in | psql sl; psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface');"

# copy data from test2.sf_in into table topo_2.muni_surface (append data to topo_2.muni_surface)

psql sl -c "SELECT topo_help_sf_to_topology_case_1('test2.sf_in','topo_2.muni_surface',0.00001);"


Lars





_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/postgis-users