[postgis-users] postgis with jdbc

Markus Schaber schabi at logix-tt.com
Thu Feb 2 08:07:23 PST 2006


Hi, Gilbert,

Gilbert, Antoine wrote:

> Suppose you draw a polygon of 150000 nodes in a graphics to render a
> 640x480 image. It should be possible while reading one node at a time to
> "on the fly" build a simplified polygon for the fill (ex: maybe 1000
> node will be at the same pixel). 

Maybe you can use the postgis facilities to reduce your polygon on the
server side, such as intersection(simplify(geom, pixel_width), bbox), so
you only send 1500 nodes to the client instead of 150000.

> I'm using MapXTreme java, which do not support PostgreSQL but it support
> spatial data from Oracle Spatial. MapXTreme Java allows you to
> implements interfaces designed to retrieve ranges of geom objects in
> some kind of "iterator fashion". I implemented the stuff to support the
> read of postgis geometries with the postgis.jar. I charged same tables
> with very large polygon objects (>100000 nodes) in both database. In the
> oracle implementation the memory never go up. On my PostGIS
> implementation I load one geometry at a time but entirely in memory with
> the classes from postgis.jar, the use of memory is was much more than
> with Oracle (like 7-8 times more). All the filling stuff was going ok.

I'm afraid that currently, pgjdbc does not provide interfaces for
streaming access of data values (except blobs, AFAIR). So there's no
easy way of streaming access to the geometries.

> Another thing, why the coordinates of the PostGIS geometry objects are
> always returned in the form of Point objects. I think it's more
> effective to have a native array of 2x100000 (x,y,x,...) than 100000
> point objects. I wonder if it would be less memory consuming in this
> way.

Yes, this would be much better wr/t memory consumption. However, it has
other disadvantages. The main reason why it is this way is because the
first implementation was this way, and it was not changed for
compatibility reasons.

If you don't like this, see the JTS coordinatesequence implementations,
and use the postgis_jts.jar - there I have implemented the arrays of
ordinates way.

> Maybe I could use the WKB4J project (http://wkb4j.sourceforge.net/) to
> read the geometries, but I'm not sure I will be able to do what I want.

Even with them, you'll get one geometry at a time.

HTH,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



More information about the postgis-users mailing list