Java 将几何图形转换为长/宽

Java 将几何图形转换为长/宽,java,eclipse,postgresql,postgis,Java,Eclipse,Postgresql,Postgis,因此,在PostgreSQL中,我有一组long/lat的几何体值,其格式如下: 0101000020E610000095B9F94674CF37C09CBF0985083B5040 因此,在Postgres中,我可以进行一个select查询来格式化所有内容 SELECT ST_AsText(position_geom)FROM reports; 因此,我在eclipse中安装了postgreSQL和PostGIS JDBC驱动程序,并认为我可以做类似的事情 rs = stmt.execu

因此,在PostgreSQL中,我有一组long/lat的几何体值,其格式如下:

0101000020E610000095B9F94674CF37C09CBF0985083B5040 
因此,在Postgres中,我可以进行一个select查询来格式化所有内容

SELECT ST_AsText(position_geom)FROM reports;
因此,我在eclipse中安装了postgreSQL和PostGIS JDBC驱动程序,并认为我可以做类似的事情

rs = stmt.executeQuery("SELECT ST_AsText(*)FROM reports");
while(rs.next()){
String geomVal = rs.getString("position_geom"); 
System.out.println(geomVal);} 
但我有一个错误:

function st_astext() does not exist.

我已经导入了所有postGIS扩展,只是想知道是否有人有想法。

格式是扩展的众所周知的二进制EWKB,这是postGIS在PostgreSQL中存储几何数据时使用的格式。ST_AsText函数将其转换为众所周知的文本WKT格式

ST_AsText函数需要具有几何数据类型的单个列。因此,请按如下方式更改代码:

rs = stmt.executeQuery("SELECT ST_AsText(position_geom) AS position_txt FROM reports");
while(rs.next()){ 
String geomVal = rs.getString("position_txt"); 
System.out.println(geomVal);}