[postgis-users] RE: Very slow with geometries having thousands of points

Tuan Pham Anh tuanpa at vngeobiz.com
Fri Jul 30 19:14:04 PDT 2004


I used the AsBinary(geom) function in my query, this improve much
performance. But geometry type always is 'wkb'.

How to get the geometry type like POINT, POLYGON...


      String _strDriver = "org.postgresql.Driver";
      String _strDatabaseURL = "jdbc:postgresql://localhost:5432/mydb";
      String _strUserName = "tuanpa";
      String _strPassword = "";
      String _strSQL = "select AsBinary(geom, 'XDR') from tbl_regions";
      
      Class.forName(_strDriver);
      Connection conn = DriverManager.getConnection(_strDatabaseURL,
_strUserName, _strPassword);
      Statement s = conn.createStatement();
      ResultSet r = s.executeQuery(_strSQL);
      
      while (r.next()) {
        PGobject myPGobject = (PGobject) r.getObject(1);
        System.out.println("Type : " + myPGobject.getType());        
      }
      
      r.close();
      s.close();
      conn.close();


Thanks,

Pham Anh Tuan
R&D Officer
Geobiz - GIS Technology Solutions.
Email: tuanpa at vngeobiz.com






More information about the postgis-users mailing list