<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Dan,</p>
<span class="gmail-im">
<p>| And only construct an OGRGeometry when it's asked for? Such
as when GetGeometryRef is called?</p>
</span>
<blockquote type="cite"
cite="mid:CA+K_q_pMfACCNf7yqY8xjhb7zJ6+PftxxpGp1NEDK-qkyH0JAA@mail.gmail.com">
<div dir="ltr">
<div>I'm wondering about a more broad application of this. Would
it be helpful to have the ability to lazy-initialize an
OGRGeometry from multiple source types such as WKB and GEOS,
initially storing only a reference to the external data in
WKB/GEOS/etc and actually materializing the geometry when
required? </div>
</div>
</blockquote>
<p>That's definitely something doable. At a minimum, you would have
to inspect the top geometry type to instantiate the appropriate
OGRGeometry subclass, and then its members could be lazy
initialized, but that means that all methods of OGRGeometry and
its subclasses would have to do a check whether the object has
been fully initialized. There might be performance implications
for people doing for example lineString->getX(idx) to iterate
on big geometries, although branch predictors of modern CPUs are
probably very good at repeatedly evaluating stuff like "if
(!materialized) materialize();". The main drawback is that is a
substantial & risky change that requires to revisit *all*
methods of the geometry classes. For setters, you would also have
to make sure to invalidate the potentially initial WKB / GEOS
source.<br>
</p>
<p>PS: I believe I joked some time ago that it was a pity that GDAL,
GEOS, QGIS, PostGIS, ... didn't share the same geometry classes
given that they all implement the same Single Features/ ISO SQL MM
Part 3 model (it is kind of crazy that we have all to implement
WKB, WKT, etc etc), but it really looks like this is completely
what the RFC works around. But I'm afraid this "libgeom" is a pipe
dream<br>
</p>
Even<br>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>