<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hello list,<br>
<br>
I am relatively new to PostGIS but I love it already, I am a GIS
specialist with 10 years experience on closed source and 5 on Open
Source. Currently I am busy to import operation data for use with a
webbased GIS.<br>
<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>
<br>
The next step I want to take is insert the records from the temp_table
into the production table. For this I am setting up an INSERT statement
in SQL<br>
<br>
My statement is as follows:<br>
<br>
<font color="#006600" face="Courier New, Courier, monospace">INSERT
INTO public.infra_line2 <br>
(infraline_type, <br>
infraline_polution, <br>
infraline_comment, <br>
infraline_startdate, <br>
infraline_enddate, <br>
infraline_top, <br>
infraline_base, <br>
the_geom, <br>
idproject, <br>
idsh0, <br>
idshp) <br>
SELECT <br>
'type' as infraline_type,<br>
CASE WHEN ver_inr='0' THEN FALSE WHEN ver_inr='1' THEN TRUE ELSE FALSE
END as infraline_polution,<br>
opmerking as infraline_comment,<br>
d_start as infraline_startdate, <br>
d_stop as infraline_stopdate, <br>
hoogte_top as infraline_top, <br>
hoogte_bas as infraline_base, <br>
wkb_geometry as the_geom, <br>
1 as idproject,<br>
6 as indsh0,<br>
id as idshp<br>
from bm_staging;</font><br>
<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>
<br>
DELETE FROM public.infra_line2;<br>
<br>
<font color="#006600" face="Courier New, Courier, monospace">INSERT
INTO public.infra_line2 <br>
(infraline_type, <br>
infraline_polution, <br>
infraline_comment, <br>
infraline_startdate, <br>
infraline_enddate, <br>
infraline_top, <br>
infraline_base, <br>
the_geom, <br>
idproject, <br>
idsh0, <br>
idshp) <br>
SELECT <br>
'type' as infraline_type,<br>
CASE WHEN ver_inr='0' THEN FALSE WHEN ver_inr='1' THEN TRUE ELSE FALSE
END as infraline_polution,<br>
opmerking as infraline_comment,<br>
d_start as infraline_startdate, <br>
d_stop as infraline_stopdate, <br>
hoogte_top as infraline_top, <br>
hoogte_bas as infraline_base, <br>
wkb_geometry as the_geom, <br>
1 as idproject,<br>
6 as indsh0,<br>
id as idshp<br>
from bm_staging USING SRID=32767;</font><br>
<br>
When I execute the statement from pgAdmin, it returns:<br>
<br>
<font color="#ff0000">ERROR: syntax error at or near "USING" at
character 638<br>
<br>
<font color="#000000">What am I doing wrong?<br>
<br>
Any help highly appreciated!<br>
<br>
Kind regards,<br>
<br>
</font></font></font>
<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>