[postgis] Inserting MultiPolygons
bouabdaddy
bouabdi9 at cs.man.ac.uk
Tue Feb 26 16:53:43 PST 2002
Hi,
thanks for your help so far dave...
do you know anyting about the following error:
java.sql.SQLException: Unknown type: SRID=-1;MULTIPOLYGON(((414699.55
130160.43,414701.83 130149.9,414729.2 130155.7,414729.2
130155.7,414733.25 130149.8,414735.1 130140.9,414743.75
130142.7,414740.6 130158.15,414742.15 130158.5,414739.65
130169.25,414728.05 130166.65,414727.77 130167.93,414724.52
130167.19,414717.65 130165.63,414717.85 130164.45,414699.55
130160.43)))
it arrises when I compile and run the following code:
public void executeGISQuery(String query) {
if (connection == null || statement == null) {
System.err.println("There is no database to execute the
query.");
return;
}
try {
//
resultSet = statement.executeQuery(query);
metaData = resultSet.getMetaData();
int numberOfColumns = metaData.getColumnCount();
System.out.println("Number of coulumns
is:"+numberOfColumns);
columnNames = new String[numberOfColumns];
columnTypes = new int[numberOfColumns];
for(int column = 0; column < numberOfColumns; column++) {
columnTypes[column] = metaData.getColumnType
(column+1);
columnNames[column] = metaData.getColumnLabel
(column+1);
System.out.println("Column Name is:" + columnNames
[column]);
System.out.println("Column Type is:" + columnTypes
[column]);
}
rows = new Vector();
while (resultSet.next()) {
//retrieve the geometry as an object then cast it to
the geometry type.
//int id = resultSet.getInt(1);
//System.out.println("Got boundary_id:");
//System.out.println(id.toString());
//PGgeometry point = (PGgeometry)resultSet.getObject
(3);
//System.out.println("Got site_centroid:");
//System.out.println(point.toString());
PGgeometry polygon = (PGgeometry)resultSet.getObject
(2);
System.out.println("Got site_boundary:");
System.out.println(polygon.toString());
}
}
catch (SQLException ex) {
System.err.println(ex);
}
}
I have also made sure that I added the appropriate code to include
the data types of org.postgis to the postgresql connection
((org.postgresql.Connection)connection).addDataType
("geometry","org.postgis.PGgeometry");
((org.postgresql.Connection)connection).addDataType
("multipolygon","org.postgis.MultiPolygon");
((org.postgresql.Connection)connection).addDataType
("polygon","org.postgis.Polygon");
((org.postgresql.Connection)connection).addDataType
("polygon","org.postgis.Point");
normal JDBC query work fine....but querying and geometrical columns
Regards and thanks again
Ismail
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Tiny Wireless Camera under $80!
Order Now! FREE VCR Commander!
Click Here - Only 1 Day Left!
http://us.click.yahoo.com/nuyOHD/7.PDAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the postgis-users
mailing list