[postgis-users] Topology Postgis 2.0

Sandro Santilli strk at keybit.net
Fri Oct 5 09:50:24 PDT 2012


On Thu, Oct 04, 2012 at 08:36:36AM -0700, ps.tiara wrote:
> >Could you please send a self-contained script showing the problem ?
> >It should include the CreateTopology call and the literal value of
> >the geometry where id = 1.
> 
> Sorry, do you mean the query file(.sql)?
> Here it is..
> 
> 1_geometry.sql
> <http://postgis.17.n6.nabble.com/file/n5000224/1_geometry.sql>  
> 2_create_topology.sql
> <http://postgis.17.n6.nabble.com/file/n5000224/2_create_topology.sql>  
> 3_add_topogeom_column.sql
> <http://postgis.17.n6.nabble.com/file/n5000224/3_add_topogeom_column.sql>  
> 4_totopogeom.sql
> <http://postgis.17.n6.nabble.com/file/n5000224/4_totopogeom.sql>  

So basically it's this:

 insert into phtomulti_srid values ('1', st_geomfromtext('MULTIPOLYGONZ (
  ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),
  ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),
  ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),
  ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)),
  ((1 0 0, 1 1 0, 1 1 1, 1 0 1, 1 0 0)),
  ((1 1 0, 0 1 0, 0 1 1, 1 1 1, 1 1 0)))',4326) );
 select topology.createtopology('phtomulti_topo',4326,0,'TRUE') as topoid;
 select topology.addtopogeometrycolumn('phtomulti_topo','public','phtomulti_srid','topo','MULTIPOLYGON Z');
 update public.phtomulti_srid set topo = topology.toTopoGeom(geom,'phtomulti_topo',1,0.0000001) where id='1';

Ok, I can reproduce. That geometry is surely very very bad (invalid)
but the topology code should't fail.

Simplified:

  select droptopology('t');
  select topology.createtopology('t',0,0,true) as topoid;
  create table t.t (a int); -- just a place holder for the layer
  select topology.addtopogeometrycolumn('t','t','t','g','MULTIPOLYGON Z');
  select topology.toTopoGeom( 'MULTIPOLYGONZ (
    ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),
    ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),
    ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),
    ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)),
    ((1 0 0, 1 1 0, 1 1 1, 1 0 1, 1 0 0)),
    ((1 1 0, 0 1 0, 0 1 1, 1 1 1, 1 1 0)) )'
    , 't',1);

Can you please file a ticket for this case ?
Thanks!

--strk;




More information about the postgis-users mailing list