Hi Jukka, I've never used this plugin, but I know this problems with empty schapefiles.
In the first case with no geometries it is impossible to determine the geometry type, which is usualy done from a geometry. The geometry type is mandatory for writing a schapefile. Byte 32 in the header is the type field. A solution for such a problem may be a JComboBox to get a valid type from the user or write the shapefile with type 0 "Null Shape". Later if we have real geometries in the file we can change the type field in the header. Don't know if other systems have problems with "Null Shape" files? The second problem with mixed geometries is a design problem of shape fiiles. At the moment are only one geometry type in one file allowed. It's possible that this will be changed in the future. So I see two solutions. Frist you use Edit->Extract->Extract Layers by Geometry Type and save all the layers manualy. The second possibillity is that we extend the ShapefileWriter for splitting this automatically. You can read this in the specs http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf. See page 4 and 5. Matthias > Hi, > > JUMP DB Query plugin http://jumpdbqplugin.sourceforge.net/ used to > create a little polygon as a fake geometry for all the lines which > the SQL query was returning without a geometry. Now the new versions > of the plugin, starting from version 0.7.2. are creating an empty > geometry as "GEOMETRYCOLLECTION EMPTY". > This works fine as long as I am working with OpenJUMP and also saving > into JUMP jml format goes OK. But saving into shapefiles gives > problems and I have not discovered how I could keep the important > attribute data that I have also for the features without geometry. > > If there are no other geometries on the layer, the OJ message while > doing shapefile save is > > java.lang.Exception: Could not determine shapefile type - data is > either all GeometryCollections or empty > at > com.vividsolutions.jump.io.ShapefileWriter.makeSHAPEGeometryCollection(ShapefileWriter.java:728) > at > com.vividsolutions.jump.io.ShapefileWriter.write(ShapefileWriter.java:295) > at > com.vividsolutions.jump.io.datasource.ReaderWriterFileDataSource$1.executeUpdate(ReaderWriterFileDataSource.java:72) > at > com.vividsolutions.jump.workbench.datasource.AbstractSaveDatasetAsPlugIn.run(AbstractSaveDatasetAsPlugIn.java:33) > at > com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager$TaskWrapper.run(TaskMonitorManager.java:151) > at java.lang.Thread.run(Unknown Source) > If there are also real geometries then the message is > > om.vividsolutions.jump.io.IllegalParametersException: mixed geometry > types found, please separate Polygons from Lines and Points when > saving to *.shp > at > com.vividsolutions.jump.io.ShapefileWriter.checkIfGeomsAreMixed(ShapefileWriter.java:639) > at > com.vividsolutions.jump.io.ShapefileWriter.write(ShapefileWriter.java:253) > at > com.vividsolutions.jump.io.datasource.ReaderWriterFileDataSource$1.executeUpdate(ReaderWriterFileDataSource.java:72) > at > com.vividsolutions.jump.workbench.datasource.AbstractSaveDatasetAsPlugIn.run(AbstractSaveDatasetAsPlugIn.java:33) > at > com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager$TaskWrapper.run(TaskMonitorManager.java:151) > at java.lang.Thread.run(Unknown Source) > Is it possible to save things without geometries into shapefiles at > all? It is easy to generate test data, just create a new layer and > insert a new WKT feature as GEOMETRYCOLLECTION EMPTY and try to save > the layer. Next digitise a point, for example, on the layer, and try > saving again. > > > -Jukka Rahkonen- > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today. > http://p.sf.net/sfu/beautyoftheweb > ------------------------------------------------------------------------ > > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel