Michael, I think most of our PostGIs/PostgreSQL code has been "abandoned" in some sense. I don't know that you will be able to find an active developer that is very familiar with this code. I think any improvements you could make to this code would be welcome.
The Sunburned Surveyor On 5/27/07, Stefan Steiniger <[EMAIL PROTECTED]> wrote: > go ahead and commit! :o) > > stefan > > Michaël Michaud schrieb: > > Hi, > > > > Sorry to come back with these database access suggestions. > > I'd like to commit the changes proposed here after as I need it to > > access my postgis database and I'd rather keep my local version of > > OpenJUMP synchronized with the CVS, but this code is quite important for > > database access, and I'd rather get at least one feed back before > > committing. > > > > Thanks a lot > > > > Michaël Michaud > > > > Michaël Michaud a écrit : > > > >> Hi, > >> > >> This one is for datastore api authors (Martin, Jon ?) > >> I have a few suggestions/questions about this api implementation, but > >> I'd rather have author's advice before any change : > >> > >> 1/ PostgisValueConverterFactory > >> I think that for geometry column, getConverter should return > >> WKB_GEOMETRY_MAPPER instead of WKT_GEOMETRY_MAPPER (geometries seem to > >> have been stored in wkb instead of wkt since postgis 1.0) > > > > if (dbTypeName.equalsIgnoreCase("geometry")) > > // WKB is now the normal way to store geometry in PostGIS > > [mmichaud 2007-05-13] > > return WKB_GEOMETRY_MAPPER; > > > >> 2/ PostgisResultSetConverter > >> In init(), if the resultsetmetadata contains more than one geometry, > >> we could keep the first one as AttributeType.GEOMETRY and read others > >> as AttributeType.STRING instead of throwing an exception. > > > > // Convert the first geometry into AttributeType.GEOMETRY and the > > following ones > > // into AttributeType.STRINGs [mmichaud 2007-05-13] > > if (mapper[i].getType() == AttributeType.GEOMETRY) { > > if (featureSchema.getGeometryIndex() == -1) { > > colName = "GEOMETRY"; > > featureSchema.addAttribute(colName, mapper[i].getType()); > > } > > else { > > mapper[i] = ValueConverterFactory.STRING_MAPPER; > > featureSchema.addAttribute(colName, AttributeType.STRING); > > } > > } > > else { > > featureSchema.addAttribute(colName, mapper[i].getType()); > > } > > > > > >> 3/ PostgisSQLBuilder > >> It seems that adding double quotes around field names make it possible > >> to query field name either in lower case or in upper case. I don't > >> know if there are drawbacks. I saw somewhere in the code > >> (PostgisDSMetadata) that you explicitly lower field names. > > > > private String getColumnListSpecifier( > > String[] colName, String geomColName) > > { > > // Added double quotes around each table name in order to read mixed > > case table names > > // correctly [mmichaud 2007-05-13] > > StringBuffer buf = new StringBuffer(); > > buf.append("AsBinary(\"" + geomColName + "\") as " + geomColName + > > "_wkb"); > > for (int i = 0; i < colName.length; i++) { > > if (! geomColName.equalsIgnoreCase(colName[i])) { > > buf.append(",\""); > > buf.append(colName[i]).append("\""); > > } > > } > > return buf.toString(); > > } > > > >> The last one is a question : > >> In the code, the geometry field is changed to binary with > >> AsBinary(geometry) before it is read by WKBReader, even if the > >> geometry is stored as wkb. > >> I tried to read the field as is to avoid the asBinary() overhead but I > >> did not succeed. > >> I think this is a format pb (wkb vs ewkb ?), but the WKBReader from > >> JTS claims to read ewkb. > >> May be it is important to keep asBinary function to be able to read > >> geometry without regarding its format, but on the other hand, it > >> should be nice to be able to write query as > >> select geometry, name from country > >> instead of > >> select asBinary(geometry), name from country, which is a lot less > >> intuitive > >> > >> Cheers, and thanks again for the great lib > >> > >> Michael > >> > >> > >> > >> Michaël Michaud a écrit : > >> > >>> Hi everybody, > >>> > >>> I tried to understand differences between the 4 versions of > >>> postgresql/postgis drivers I found at different places. > >>> Here are the results of my investigations > >>> Comments are welcome. > >>> > >>> *Different versions I found > >>> *1 - a plugin (postgis_1_0_0.jar) from 2005 written by Markus Schaber > >>> and bundled with OpenJUMP distribution. As far as I could see, the > >>> plugin is bundled but unused in the distribution (nothing happened, > >>> even after I have had the jar file to the classpath) > >>> 2 - a plugin from uwe dalluege distributed as the "PostGIS PlugIn" on > >>> OpenJUMP sourceforge site (2006-11-19). May be based on the previous > >>> one. > >>> 3 - datastore api from vividsolutions added to the code on december > >>> of 2005, but not activated in the original jump version > >>> 4 - paolo rizzi's SIS plugin for postgresql/postgis and oracle > >>> database access, based on the framework developped in 3 > >>> > >>> *Disimilarities between versions* > >>> *1 - postgis plugin* 1.0.0 > >>> - Don't know how to make this postgis_1_0_0.jar work. If it has no > >>> use, it should be removed from the distribution > >>> *2 - Uwe's postgis plugin* > >>> - the plugin is the only one able to create/update the database. > >>> Other ones are read only > >>> - it works well with postgresql 8.2 and postgis 1.1+ > >>> - the plugin load data from the load dataset menu and does not use > >>> the nice interface from vividsolution in the layer menu (see 3) > >>> - the plugin load data (in-memory) and does not offer a select option > >>> or a feature-on-demand option > >>> *3 - Vividsolutions's framework* > >>> - Vividsolutions's datastore api has a nice design and a nice user > >>> interface, but at the moment, it is read-only. > >>> - the interface make it possible to cache features (in-memory ?) or > >>> not (feature on demand ?) > >>> - I could not read a posgis table with Vividsolution's api and > >>> OpenJUMP until I made two changes in the code : > >>> a) in PostgisValueConverterFactory, if dbTypeName is geometry, I > >>> return WKB mapper instead of WKT (since postgis 1.0, default storage > >>> format in postgis is binary) > >>> b) If there are more than one geometry type in the resultset, the > >>> second is read as AttributeType.STRING instead of throwing an > >>> exception (in a select * statement, I can get more than one geometry > >>> from my database). > >>> *4 - SIS PlugIn from Paolo Rizzi > >>> *- The plugin is based on Vividsolutions's api > >>> - It is a read-only driver for postgis and oracle tables > >>> - The plugin includes many dependencies (3 Mo). I don't know why it > >>> needs all this stuff because there is not much more features in this > >>> plugin than in vivid's api (maybe hidden classes for futur work). > >>> - I found postgis_1_1_0 in dependencies but I don't know if it is > >>> related to 1- and if it is used > >>> - I get geometry, int, double and date values, but I cannot get > >>> string values when loading a table or a selection ! > >>> > >>> PS : I know there is also a hard work done by projet-SIGLE team to > >>> write a generic data/database driver called GDBMS... > >>> > >>> Hope that helps, > >>> > >>> Michaël > >>> > >>> ------------------------------------------------------------------------- > >>> > >>> This SF.net email is sponsored by DB2 Express > >>> Download DB2 Express C - the FREE version of DB2 express and take > >>> control of your XML. No limits. Just data. Click to get it now. > >>> http://sourceforge.net/powerbar/db2/ > >>> _______________________________________________ > >>> Jump-pilot-devel mailing list > >>> Jump-pilot-devel@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > >>> > >>> > >>> > >>> > >> > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Jump-pilot-devel mailing list > > Jump-pilot-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel