[postgis-devel] PostGIS-JDBC

Thomas Marti (HSR) tmarti at hsr.ch
Mon Oct 30 23:20:50 PST 2006


Hello everyone

As we are continuing our work on JPOX-Spatial we've stumbled across some issues 
with the PostGIS-JDBC classes.

1) The Javadoc of Geometry.setSrid() defines, that the SRID will be set 
recursively, but that's not reflected in the implementation. I have attached a 
patch that fixes this. Another solution would be to add a new method 
setSridRecursively() or the like, if both behaviours (recursive and non-recursive 
srid setting) are needed...

2) At the moment the only way to get the JDBC driver, is to either download the 
sources and build it yourself or to install PostGIS and then go dig for the 
JAR-file. In our opinion it would be much better to have a separate download for 
that, as for example the PostgreSQL project has (http://jdbc.postgresql.org/). 
Even better would be to put the JARs in a public Maven repository, so Java 
developers would only have to put the dependency in their POM files and the rest 
is then taken care of by Maven.

We understand that this probably needs some time to be thought about, but it would 
be very convenient for us if we had a decision on a naming schema rather quickly. 
So that we won't have to change everything if you eventually do decide to publish 
to a Maven repository. What is needed for the names is a groupId (probably 
'postgis' or 'org.postgis') and an artifactId for every JAR (e.g. 
'postgis'/'postgis_jts', 'postgis-jdbc'/'postgis-jts-jdbc', 
'postgis-driver'/'postgis-jts-driver' or the like...)

3) There's a fair bit of duplication in BinaryWriter/JtsBinaryWriter and 
BinaryParser/JtsBinaryParser. Wouldn't it make sense to refactor out a super 
class? We'd be willing to volunteer for the job, because we want to write a 
separate Writer/Parser combo for Oracle's JGeometry anyway.


Index: ComposedGeom.java
===================================================================
--- ComposedGeom.java	(revision 2520)
+++ ComposedGeom.java	(working copy)
@@ -262,4 +262,12 @@
              return false;
          }
      }
+
+    public void setSrid(int srid) {
+        super.setSrid(srid);
+        for (int i = 0; i < subgeoms.length; i++) {
+            subgeoms[i].setSrid(srid);
+        }
+    }
+
  }





More information about the postgis-devel mailing list