[gdal-dev] Geometry construction and factory

Frank Warmerdam warmerdam at pobox.com
Thu Nov 11 09:38:43 EST 2010

Rui L. Pires wrote:
> Hello everyone,
> I had a quick look at the archives and other resources and could not
> find much information regarding the topic I discuss below (apart from
> an important remark in the documentation - ogr architecture).
> I would be interested in using a family of specialised OGRGeometry
> classes, sporting a number of additional properties and functionality
> not at all relevant to OGR (read: application specific). This could be
> easily achieved with a dedicated geometry factory that utilises the
> appropriate constructor of the derived geometry class.


Are you wanting to be able to change the behavior of OGR to produce
these customized geometry classes as opposed to the ordinary ones?
Or is it sufficient for some particular application or driver to
do so?

I believe the MITAB driver currently derives an MITABFeature class
from OGRFeature with some special properties.  They interact fine
with the rest of OGR, but there is no effort to make other parts of
OGR produce these features.

For some needs, I could see a similar pattern being adequate for
geometries.  Perhaps you could expand on your use case.

> However I see that 1) not only the current implementation of
> OGRGeometryFactory does not foresee this approach, 2) the drivers
> implementations use both the factory and explicitly the geometry
> constructors.
> Would this be a design change that could be considered? I do realise
> that it is a considerable amount of refactoring but apart from that I
> do not see immediate obstacles. Would I be missing some important
> issue?

Almost any design change could be considered if you can bring forward
a compelling RFC that broad support from the project steering
committee.  I must confess I'm not keen on forcing all geometry creation
to go through a hookable factory, if only for the code disruption
(particularly for application code).  But perhaps if you can make a
compelling case for the requirement I would feel differently.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list