<html><div style='background-color:'><DIV class=RTE>
<P><BR>Use a StringBuffer to concatenate String, this tips avoid String objects creation (dont forget to set the StringBuffer initial size to the estimatate total size). <BR>Why do you call the constructor :</P>
<P>Polygon tmp = new Polygon( );</P><BR><BR><BR>>From: " - fratzis@olympiacos.net" <fratzis@olympiacos.net><BR>>Reply-To: fratzis@olympiacos.net,PostGIS Users Discussion <postgis-users@postgis.refractions.net><BR>>To: <postgis-users@postgis.refractions.net><BR>>Subject: [postgis-users] postgis performance<BR>>Date: Fri, 15 Jul 2005 22:29:21 +0300<BR>><BR>><BR>><BR>>Hello Everybody!<BR>><BR>>I have a problem and i hope there is somebody can help me.<BR>>I use postgresql 8.0/posgis 1.0.1 in a linux pc.<BR>><BR>>A servlet retrieves data from the database which are in MULTIPOLYGON format.<BR>>Then it creates an xml file.The problem is that this process is very slow.<BR>>I have to manipulate the MULTIPOLYGON object to create the xml which has the coordinates'values and some other info.<BR>>What is going
wrong?How can i make it faster?<BR>>Here is some of the code:<BR>>-----------------------------------------------------------------------------------------------------<BR>>query="select gid,nomos,code_nomos,AsText(the_geom) from nomoi";<BR>>rs = s.executeQuery( query );<BR>><BR>>while(rs.next()){<BR>>shapes += "<shape> \n";<BR>>if( rs.getString(1) != null )<BR>>shapes += "<id>"+rs.getString(1)+"</id> \n";<BR>>shapes += "<type>polygon</type> \n";<BR>><BR>>if( rs.getString(2) != null )<BR>>shapes += "<name>"+rs.getString(2)+"</name> \n";<BR>>shapes += "<status>0</status> \n";<BR>><BR>>MultiPolygon mpol = new MultiPolygon( rs.getString(4) );<BR>><BR>>Polygon tmp = new Polygon( );<BR>>tmp = mpol.getPolygon(0);<BR>><BR>>LinearRing ring = tmp.getRing(0);<BR>>shapes
+= "<npoints>"+ring.numPoints()+"</npoints> \n";<BR>>-------------------------------------------------------------------------------------------------------------------------<BR>><BR>><BR>><BR>><BR>>______________ ______________ ______________ ______________<BR>><BR>>Olympiacos Members email service at olympiacos.net<BR>>Υπηρεσία email Μελών του Ολυμπιακού Σ.Φ.Π.<BR>>______________ ______________ ______________ ______________<BR>><BR>><BR>><BR>><BR>><BR>>_______________________________________________<BR>>postgis-users mailing list<BR>>postgis-users@postgis.refractions.net<BR>>http://postgis.refractions.net/mailman/listinfo/postgis-users<BR></DIV></div></html>