[postgis] String to MultiPolygon
Ismail Bouabdallah (CS)
bouabdi9 at cs.man.ac.uk
Wed Mar 13 13:55:10 PST 2002
Hi,
can anyone help me with the following problem:
I am trying to convert the string representaion of a MultiPolygon into
its geometric PostGIS respresentaion in Java.
public Vector getSiteBoundaries() {
int numberOfRows = resultsTable.getRowCount();
Class columnClass;
Vector siteBoundaries = new Vector(); // to hold the
site_boundaries from the current Jtable
for (int i = 0; i <numberOfRows; i++) {
siteBoundaries.add(resultsTable.getValueAt(i,1));
System.out.println("Site_Boundary at " +i+ " is "
+siteBoundaries.elementAt(i));
columnClass = resultsTable.getColumnClass(2);
System.out.println("Site_Boundary Column Class is:" + columnClass);
String siteBoundaryString = (String)siteBoundaries.elementAt(i);
//MultiPolygon siteBoundary =
(MultiPolygon)siteBoundaries.elementAt(i);
//MultiPolygon siteBoundary = MultiPolygon(siteBoundaryString);
}
return siteBoundaries;
}
this is the code that I have written:
it grabs the MultiPolygons from a JTable (resultsTable) and then
stores them in a vector, at which point they are stored as strings,
Exception occurred during event dispatching
when I try to grab them from the vector I get a ClassCastException
at runtime, from the line of code : MultiPolygon siteBoundary =
(MultiPolygon)siteBoundaries.elementAt(i);
java.lang.ClassCastException: java.lang.String at
canned_classes.QueryToolInterface.getSiteBoundaries(QueryToolInterface.java:261)
if I use the line of code: MultiPolygon siteBoundary =
MultiPolygon(siteBoundaryString); I get the following runtime error:
QueryToolInterface.java:262: cannot resolve symbol
symbol : method MultiPolygon (java.lang.String)
location: class canned_classes.QueryToolInterface
basically the question I am asking is how do I turn a MultiPolygon as a
string:
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)))
into its geometrical representaion, so I can call the methods of the
class MultiPolygon in org.postgis on the value:
does anyone have any advice on this matter...
Best Regards Ismail
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Outsource Your Software & Application Development with Elance
Saves Time & Money
Post Your Project for FREE
http://us.click.yahoo.com/G6QJGA/_A0DAA/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