<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>adding multipolygons</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">Hi, list</FONT></SPAN>
</P>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">I'm trying to add some polygons in a post_Gis database as multipolygons.</FONT></SPAN>
</P>
<BR>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">The polygons shall be stored via a java application.This is the code:</FONT></SPAN>
</P>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">PreparedStatement stmt = con.prepareStatement(&quot;insert into &quot; + &quot;\&quot;public\&quot;.\&quot;&quot; + sentence[0] + &quot;\&quot; (the_geom) &quot; + &quot;values(geometryFromText(?, -1))&quot;);</FONT></SPAN></P>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">stmt.setString(1, &quot;MULTIPOLYGON(&quot; + lon1 + &quot; &quot; + lat1 + &quot;, &quot; + lon2 + &quot; &quot; + lat2 + &quot;, &quot; + lon3 + &quot; &quot; + lat3 + &quot;, &quot; + lon1 + &quot; &quot; + lat1&nbsp; + &quot;)&quot;);</FONT></SPAN></P>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">stmt.executeUpdate();</FONT></SPAN>
</P>
<BR>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">But I'm getting the following error code:</FONT></SPAN>

<BR><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">org.postgresql.util.PSQLException: ERROR: parse error - invalid geometry</FONT></SPAN>
</P>
<BR>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">In the debugger I can see the prepared statement:</FONT></SPAN>

<BR><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">insert into &quot;public&quot;.&quot;depareTriang&quot; (the_geom) values(geometryFromText(MULTIPOLYGON(16.9992367 58.1512597, 16.9969661 58.1513289, 16.9994428 58.1512597, 16.9992367 58.1512597), -1))</FONT></SPAN></P>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">By the way</FONT></SPAN>

<BR><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">do I have to close the polygon by ending with the start point?</FONT></SPAN>
</P>

<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">Thanks,</FONT></SPAN>

<BR><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">Paul</FONT></SPAN><SPAN LANG="en-us"></SPAN>
</P>

</BODY>
</HTML>