[geos-devel] WKT / WKB Writer Output Dimension

Martin Davis mbdavis at refractions.net
Tue May 25 17:08:34 EDT 2010


FWIW, the semantics of JTS were intended to be that setting the output 
dimension determines the *maximum* number of dimensions written.  If the 
input geometry does not provide that many dimensions, the extra ones are 
not written.  So this is somewhat equivalent to "letting the input 
geometry determine the number of dimensions to output".

The WKTWriter accepts this value in the constructor.  WKTWriter was 
intended to be a lightweight immutable class, so this makes sense for 
Java.  In the C world perhaps it's better to have an explicit setter.

If you want to force always outputting a given number of dimensions, 
would you want to support supplying a default value for missing 
dimensions? Or just default to 0?

Seems like a good idea to support outputting the new syntax, via a flag.

Frank Warmerdam wrote:
> Folks,
>
> Currently the WKBWriter supports writing 2D (default) or 3D (by calling
> setOutputDimension(3)).  I would like to extend this to support setting
> the output dimension to a special value (-1 or 0 perhaps) indicating that
> the output dimension of the WKB should be determined from the input 
> geometry.
>
> More importantly, I'd like to extend the WKTWriter to support writing 3D
> geometries, adding a setOutputDimension() method like on the WKBWriter.
>
> For the WKT writer I will support at least the new style WKT "POINT Z 
> (1 2 3)"
> and possibly support the old approach "POINT (1 2 3)" as an option.  Some
> discussion of this will be at:
>
>   http://trac.osgeo.org/geos/ticket/292
>
> I hope by leaving the defaults as the current behavior the changes should
> be non-disruptive but with substantial capability.
>
> Any suggestions or objections?
>
> Best regards,

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022



More information about the geos-devel mailing list