Index: JtsBinaryWriter.java
===================================================================
--- JtsBinaryWriter.java	(revision 2531)
+++ JtsBinaryWriter.java	(working copy)
@@ -362,12 +362,10 @@
     }
 
     public static final int getCoordDim(Geometry geom) {
-        // TODO: Fix geometries with more dimensions
-        // geom.getFactory().getCoordinateSequenceFactory()
         if (geom == null) {
             return 0;
         } else {
-            return 2;
+            return geom.getFactory().getCoordinateSequenceFactory().create( 0, 0 ).getDimension();
         }
     }
 }
