[postgis-users] adding multipolygons

Malm Paul paul.malm at saabgroup.com
Thu May 24 23:37:55 PDT 2007


Hi, list

I'm trying to add some polygons in a post_Gis database as multipolygons.


The polygons shall be stored via a java application.This is the code:

PreparedStatement stmt = con.prepareStatement("insert into " +
"\"public\".\"" + sentence[0] + "\" (the_geom) " +
"values(geometryFromText(?, -1))");
stmt.setString(1, "MULTIPOLYGON(" + lon1 + " " + lat1 + ", " + lon2 + "
" + lat2 + ", " + lon3 + " " + lat3 + ", " + lon1 + " " + lat1  + ")");
stmt.executeUpdate();


But I'm getting the following error code:
org.postgresql.util.PSQLException: ERROR: parse error - invalid geometry


In the debugger I can see the prepared statement:
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))

By the way
do I have to close the polygon by ending with the start point?

Thanks,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070525/28dd7e47/attachment.html>


More information about the postgis-users mailing list