From: Chris H. <ch...@op...> - 2003-08-12 01:16:53
|
> Quick, newbie, question about the following code in PostgisDataSource: > > if (attTypes[col].isGeometry()) { > String wkt = result.getString(col + 2); > if (wkt == null) { > attributes[col] = null; > } else { > attributes[col] = geometryReader.read(wkt); > } > } > > Where geometryReader is JTS WKTReader... > > This implies to me that we are asking the driver to turn geometry > information into a string and then using JTS to parse it back? > > Reading through the driver docs I have found: > - Geometry object support in the org.postgresql.geometric package > <http://candle.pha.pa.us/main/writings/pgsql/sgml/jdbc-ext.html#AEN23761> > > - and data type support used to map datatypes to java objects. > <http://candle.pha.pa.us/main/writings/pgsql/sgml/jdbc-ext.html#AEN23515> > > Using the first we should be able to save some parsing, using the second > we should be able to provide our own mappings to something that supports > the Feature interface. I could be wrong, but for the first, I was under the impression that the postgis geometric objects are different from the native postgresql objects. Though perhaps the postgis ones are based on them, and there for useful? Or perhaps I am completely wrong? As for the second, it sounds interesting, and worth checking out, but I'd imagine that they wrote it more with a sort of get/set field thing on each of the columns in the database, whereas our Features store the objects in an array. But it's worth checking out. The real way to speed things up is to do away with strings and use wkb. I actually have it coded up on a branch called wkb-branch. I've been meaning to add it, but I want to give users the option to use wkb or wkt, as the wkb4j jar that I'm using hasn't been tested that much. The jar also needs an upgrade to 0.8. The wkb stuff is also a bit annoying because I needed to use two different result sets, one for the geometry, and one for the rest of the columns. So I think I need to do a bit more research to ensure that the orders are always the same, possibly change the sql statement around a bit. Getting that in will likely give us the biggest increases in speed, as we'll no longer deal with strings at all. If you, or anyone on the list, wants to take a crack at it, be my guest. It just always gets pushed down the todo list for me. Chris |