[geos-devel] Support for M values

Sandro Santilli strk at keybit.net
Fri Mar 27 09:39:12 PDT 2015

On Fri, Mar 27, 2015 at 02:11:01PM +1300, Mike Toews wrote:
> On 27 March 2015 at 01:35, Sandro Santilli <strk at keybit.net> wrote:
> > The problem of supporting M is that even 2D geometries will
> > grow by 1/4 of each Coordinate, which is a concrete (non-virtual)
> > class. I've no idea how would a virtual Coordinate affect performances,
> > it would need to be tested.
> I've wondered if it is possible to have two kinds of geometry classes:
> 2D and 4D. A 2D class would implement only 2D logic, and would be
> lightweight for the majority of use-cases for GIS work. Then if Z
> and/or M support is required, 4D classes could be used, which have
> four values per coordinate.
> However, I'm not a C++ developer, so I'm not sure if this is possible,
> or if there would be any possibility to maintain compatibility.

It would be possible, but it would take changing the Coordinate class
to be a virtual class, with Coordinate2D and Coordinate4D subclasses
(or more, if we also want the 3DZ and 3DM cases). Using Coordinate2D would
be lighter on RAM, but a virtual class would be heavier on CPU.

Actual effects in real world scenarios should be tested.


More information about the geos-devel mailing list