<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
Hello Kevin, thank you for the response!<br>
<br>
Kevin Neufeld schreef:
<blockquote cite="mid:46A0D632.9040408@refractions.net" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <br>
Milo van der Linden wrote:
  <blockquote cite="mid:46A0B40C.6000704@zeelandnet.nl" type="cite"><br>
The original data is in shape files. With ogr2ogr I do a conversion
from the Dutch coordinate system to WGS84 and import it in a temp_table
in PostGIS.<br>
  </blockquote>
Did you know that PostGIS has a shape loader? You may find loading
shape files easier with the shp2pgsql utility. Also, PostGIS can
perform transformations on geometries ... you may not even need ogr.
Just a thought.<br>
</blockquote>
I knew that, but I am very familiar with ogr and not with shp2pgsql.
Besides that, it is fired from a php script that is currently well
under control. Also, shp2pgsql is from the same development team as
ogr, they probably use the same code base.<br>
<blockquote cite="mid:46A0D632.9040408@refractions.net" type="cite">
  <blockquote cite="mid:46A0B40C.6000704@zeelandnet.nl" type="cite"><br>
When I execute the statement in pgAdmin, I get an error message from
postGIS:<br>
    <br>
    <font color="#ff0000">ERROR:  new row for relation "infra_line2"
violates check constraint "enforce_srid_the_geom"</font><br>
    <br>
I tried to add USING SRID=32767 to the insert statement, but it fails
with another error message<br>
  </blockquote>
It sounds like the geometries in your temp table either doesn't have,
or has a different SRID than your production table. Is the data in your
staging table supposed to be the same projection as your production
table? (ogr possibly didn't add an SRID to your imported geometries and
they may be defaulting to -1). If this is the case, then you simply
need to wrap your geometries with a setsrid function call, ie
"SetSRID(the_geom, 32767)", assuming of course that 32767 is the SRID
of your production table.<br>
</blockquote>
When I check my geometry meta table, the SRID for the staging table is
correct, even though it should be 4326 (wgs84), during the import ogr
decided to create a new srid that is a perfect copy of the standard
wgs84 SRID.<br>
<blockquote cite="mid:46A0D632.9040408@refractions.net" type="cite">
  <blockquote><tt><font color="#006600">INSERT
INTO public.infra_line2 </font></tt><br>
    <tt><font color="#006600">  
(infraline_type, </font></tt><br>
    <tt><font color="#006600">  
infraline_polution, </font></tt><br>
    <tt><font color="#006600">  
infraline_comment, </font></tt><br>
    <tt><font color="#006600">  
infraline_startdate, </font></tt><br>
    <tt><font color="#006600">  
infraline_enddate, </font></tt><br>
    <tt><font color="#006600">  
infraline_top, </font></tt><br>
    <tt><font color="#006600">  
infraline_base, </font></tt><br>
    <tt><font color="#006600">  
the_geom, </font></tt><br>
    <tt><font color="#006600">  
idproject, </font></tt><br>
    <tt><font color="#006600">  
idsh0, </font></tt><br>
    <tt><font color="#006600">  
idshp) </font></tt><br>
    <tt><font color="#006600">SELECT </font></tt><br>
    <tt><font color="#006600">'type' as infraline_type,</font></tt><br>
    <tt><font color="#006600">CASE WHEN ver_inr='0' THEN FALSE WHEN
ver_inr='1' THEN TRUE ELSE FALSE
END as infraline_polution,</font></tt><br>
    <tt><font color="#006600">opmerking as infraline_comment,</font></tt><br>
    <tt><font color="#006600">d_start as infraline_startdate, </font></tt><br>
    <tt><font color="#006600">d_stop as infraline_stopdate, </font></tt><br>
    <tt><font color="#006600">hoogte_top as infraline_top, </font></tt><br>
    <tt><font color="#006600">hoogte_bas as infraline_base, </font></tt><br>
    <tt><font color="#006600">setsrid(wkb_geometry, 32767) as the_geom,
    </font></tt><br>
    <tt><font color="#006600">1 as idproject,</font></tt><br>
    <tt><font color="#006600">6 as indsh0,</font></tt><br>
    <tt><font color="#006600">id as idshp</font></tt><br>
    <tt><font color="#006600">FROM bm_staging;</font></tt><br>
  </blockquote>
Hope this helps,<br>
</blockquote>
Thank you for giving it a try, but no, it doesn't. I need to know why
the error is generated. Perhaps some one from postGIS development can
tell me?<br>
<blockquote cite="mid:46A0D632.9040408@refractions.net" type="cite">--
Kevin<br>
  <br>
  <br>
--------<br>
Kevin Neufeld<br>
Refractions Research Inc.<br>
  <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:kneufeld@refractions.net">kneufeld@refractions.net</a><br>
(250) 383-3022<br>
  <br>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<title>3DSite</title>
<meta http-equiv="Content-Type" content="text/html; ">
<style type="text/css">
<!--
body {
        background-color: #FFFFFF;
        margin-left: 5px;
        margin-top: 5px;
        margin-right: 5px;
        margin-bottom: 5px;
}
body,td,th {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
        color: #333333;
}
.style4 {font-size: 9px; }
.style5 {font-size: 9px; color: #CCCCCC; }
-->
</style>
<meta content="MSHTML 6.00.2900.2912" name="GENERATOR">
<br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
  <tbody>
    <tr>
      <td rowspan="3" align="left" height="0" valign="bottom" width="15"><br>
      </td>
      <td colspan="2" align="left" height="78" valign="top" width="0">
      <p class="style4">Milo van der Linden <br>
      <a moz-do-not-send="true" href="mailto:mlinden@zeelandnet.nl">mlinden@zeelandnet.nl</a><br>
      <a moz-do-not-send="true" href="mailto:milovanderlinden@gmail.com">milovanderlinden@gmail.com</a><br>
      <a moz-do-not-send="true" href="mailto:milo@3dsite.nl">milo@3dsite.nl</a><br>
      <a moz-do-not-send="true" href="http://www.3dsite.nl">http://www.3dsite.nl</a><br>
      </p>
      </td>
      <td rowspan="3" align="left" height="0" valign="top" width="15"> </td>
      <td valign="top" width="300">
      <p class="style5"><span lang="NL">De informatie in dit bericht
reflecteerd mijn persoonlijke mening en niet die van een bedrijf of
instantie. Aan de informatie kunnen geen rechten worden ontleend.
Indien dit bericht onderdeel is van een forum, mailing-list of
community dan gelden automatisch de bijbehorende voorwaarden.</span></p>
      </td>
    </tr>
  </tbody>
</table>
</div>
<br>
<div class="moz-signature">-- <br>
<title>3DSite</title>
<meta http-equiv="Content-Type" content="text/html; ">
<style type="text/css">
<!--
body {
        background-color: #FFFFFF;
        margin-left: 5px;
        margin-top: 5px;
        margin-right: 5px;
        margin-bottom: 5px;
}
body,td,th {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
        color: #333333;
}
.style4 {font-size: 9px; }
.style5 {font-size: 9px; color: #CCCCCC; }
-->
</style>
<meta content="MSHTML 6.00.2900.2912" name="GENERATOR">
<br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
  <tbody>
    <tr>
      <td rowspan="3" align="left" height="0" valign="bottom" width="15"><br>
      </td>
      <td colspan="2" align="left" height="78" valign="top" width="0">
      <p class="style4">Milo van der Linden
      <br>
      <a href="mailto:mlinden@zeelandnet.nl">mlinden@zeelandnet.nl</a><br>
      <a href="mailto:milovanderlinden@gmail.com">milovanderlinden@gmail.com</a><br>
      <a href="mailto:milo@3dsite.nl">milo@3dsite.nl</a><br>
      <a href="http://www.3dsite.nl">http://www.3dsite.nl</a><br>
      </p>
      </td>
      <td rowspan="3" align="left" height="0" valign="top" width="15"> </td>
      <td valign="top" width="300">
      <p class="style5"><span lang="NL">De informatie in dit bericht
reflecteerd mijn persoonlijke mening en niet die van een bedrijf of
instantie. Aan de informatie kunnen geen rechten worden ontleend.
Indien dit bericht onderdeel is van een forum, mailing-list of
community dan gelden automatisch de bijbehorende voorwaarden.</span></p>
      </td>
    </tr>
  </tbody>
</table>
</div>
</body>
</html>