<!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("insert into " + "\"public\".\"" + sentence[0] + "\" (the_geom) " + "values(geometryFromText(?, -1))");</FONT></SPAN></P>
<P><SPAN LANG="sv"><FONT SIZE=2 FACE="Arial">stmt.setString(1, "MULTIPOLYGON(" + lon1 + " " + lat1 + ", " + lon2 + " " + lat2 + ", " + lon3 + " " + lat3 + ", " + lon1 + " " + lat1 + ")");</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 "public"."depareTriang" (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>