Answering "why not an exception" is the easy part... In JTS the general
philosophy is to prefer returning a representative geometry rather than
throwing an exception. This avoids disrupting chains of geometric
operations as much as possible.
However, there is another design goal, which is to return valid geometry
whenever possible. Obviously the MinimumDiameter is violating this
principle in the zero-width case. The original reason for making this
choice is that it was felt it was better to always return two points, even
if they were identical. That way handling code could know what to expect.
It's fairly easy to check for the zero-width condition, and take
appropriate action to make the output valid.
The alternative is to return a POINT when the output is zero-width.
What is the context in which you came across this issue? Would having a
POINT return work better?
On Wed, Jun 11, 2014 at 4:48 AM, Mireille Lecoeuvre <
[email protected]> wrote:
> Hello,
> I use MinimumDiameter class with getDiameter method.
> When I use this method with POINT in input Geometry the result is a
> LINESTRING. But I find is strange to return a `LINESTRING` because the
> result is a invalid Geometry.
> Why the result is not an exception?
>
> For example:
> SELECT ST_MinimumDiameter('POINT(395 278)');
> -- Answer: LINESTRING(395 278, 395 278)
>
> Thanks for your help.
> Mireille
>
>
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
> _______________________________________________
> Jts-topo-suite-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
>
>
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user