<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hello,<br>
      <br>
      Is st_geometryN(r.geomp,1)  a valid geometry ?<br>
      <br>
      <br>
      <br>
      Ludovic Granjon a écrit :<br>
    </div>
    <blockquote cite="mid:52D655D5.4010503@u-bourgogne.fr" type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">Hello (Bonjour Christophe)<br>
        <br>
        I don't use french cadastre, only specific archaelogical data.<br>
        <br>
        Thanks for this, I try but, I don't realy understand how worked
        topogeo_addpolygon.<br>
        If I do :<br>
        <br>
        <meta http-equiv="CONTENT-TYPE" content="text/html;
          charset=UTF-8">
        <title></title>
        <meta name="GENERATOR" content="LibreOffice 4.0.4.2 (Linux)">
        <style type="text/css">
        <!--
                @page { margin: 2cm }
                PRE.ctl { font-family: "Lohit Hindi", monospace }
                P { margin-bottom: 0.21cm }
                A:link { so-language: zxx }
        -->
        </style>CREATE EXTENSION postgis;<br>
        CREATE EXTENSION postgis_topology;<br>
        SET search_path = topology,public;<br>
        <br>
        I import my layer with QGIS<br>
        <br>
        SELECT topology.CreateTopology('ec_topo', 27572);<br>
        SELECT
topology.AddTopoGeometryColumn('ec_topo','public','ec','topo_geom','POLYGON');<br>
        <br>
        DO $$DECLARE r record;<br>
        BEGIN<br>
          FOR r IN SELECT * FROM ec LOOP<br>
            BEGIN<br>
            SELECT
        topology.TopoGeo_AddPolygon('ec_topo',st_geometryn(r.geom,1),1);<br>
            EXCEPTION<br>
              WHEN OTHERS THEN<br>
                RAISE WARNING 'Loading of record % failed: %', r.id,
        SQLERRM;<br>
            END;<br>
          END LOOP;<br>
        END$$;<br>
        <br>
        I have :<br>
        ATTENTION:  Loading of record 1 failed: la requête n'a pas de
        destination pour les données résultantes<br>
        <br>
        I don't know where I'm wrong<br>
        <br>
        If you have an idea<br>
        <br>
        Thanks<br>
        <br>
        Regards<br>
        <br>
        Ludovic<br>
        <br>
        PS : (si j'avais sur que c'était toi qui répondrait, j'aurai
        écrit sur nos forums francophone ;-) )<br>
        <br>
        Le 15/01/2014 08:25, Christophe Vergon a écrit :<br>
      </div>
      <blockquote cite="mid:52D63801.8090006@orange.fr" type="cite">Hello,

        (bonjour) <br>
        <br>
        When you udpdate a topology by using a SET statement if a
        polygon intersect an other you will have this error. <br>
        If you want to create a topology from polygons try to use the
        topogeo_addpolygon function, the intersection between two
        polygons will be a new face. <br>
        <br>
        If, as I mean, you use a french survey "cadastre" data set, it's
        the best way to do that. <br>
        <br>
        <br>
        <br>
        Ludovic Granjon a écrit : <br>
        <blockquote type="cite">Hi all <br>
          <br>
          I try to import a polygon layer to postgis and build topology
          with tolerance. <br>
          I try something like that <br>
          <br>
          SELECT CreateTopology('ec_topo2', 27572); <br>
          SELECT AddTopoGeometryColumn('ec_topo2', 'public', 'ec',
          'topogeom2', 'MULTIPOLYGON'); <br>
          UPDATE ec SET topogeom2 = toTopoGeom(geom, 'ec_topo', 1, 1.0);
          <br>
          <br>
          But when I do that, I have <br>
          <br>
          ********** Erreur ********** <br>
          <br>
          ERREUR: Spatial exception - geometry intersects edge 262 <br>
          État SQL :P0001 <br>
          Contexte : fonction PL/pgsql « topogeo_addlinestring », ligne
          124 à affectation <br>
          SQL statement "SELECT array_cat(edges, array_agg(x)) FROM (
          select topology.TopoGeo_addLinestring(atopology, rec.geom,
          tol) as x ) as foo" <br>
          fonction PL/pgsql « topogeo_addpolygon », ligne 24 à
          affectation <br>
          fonction PL/pgsql « totopogeom », ligne 112 à FOR sur des
          lignes de SELECT <br>
          fonction PL/pgsql « totopogeom », ligne 94 à affectation <br>
          <br>
          I try to modify the tolerance parameter but it still doesn't
          work <br>
          <br>
          Have  you a solution for that ? <br>
          <br>
          Thanks a lot <br>
          <br>
          Regards <br>
          <br>
          Ludovic <br>
          <br>
          <br>
          <br>
          _______________________________________________ <br>
          postgis-users mailing list <br>
          <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
            href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
          <br>
          <a moz-do-not-send="true" class="moz-txt-link-freetext"
            href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a>
          <br>
        </blockquote>
        <br>
        <br>
        _______________________________________________ <br>
        postgis-users mailing list <br>
        <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
          href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>
        <br>
        <a moz-do-not-send="true" class="moz-txt-link-freetext"
          href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a>
        <br>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>