# [postgis-devel] help with understanding new circularstring geometries

Ken Southerland southerland at samsix.com
Mon Sep 17 16:39:21 PDT 2007

```Hi all,

I need to be able to save and load the new CircularString and related
geometries in my java application.  I have the source code checked out
and have been poking through it.  I would like to try to extend the jdbc
code to be able to handle these new geometries but first I have to be
able to understand them so that I can program it and I can't find any
documentation to help me with the exception of section 4.1.3 of the
on-line documentation found at
http://postgres.enterprisedb.com/82/doc/dbserver/postgis/postgis.html.
But this has no words of explanation for the examples.

Here are my questions for each of the examples given in this
documentation.  Can anyone shed light on this?

1)  CIRCULARSTRING(0 0, 1 1, 1 0)
How is this defined?  I understand the the three point minimum and then
an odd number of points after that.  What I don't know is what the even
points represent.  For instance, in this example, is (1 1) the location
of the center of the circle of which the arc is a segment or is it just
yet another point on the arc?  If the latter, then do we have to
calculate the arc every time we read the object from the database?
Isn't this computationally unattractive?  Again if the latter, is there
some simple way that I can't see yet of creating a java.awt.geom.Arc2D
from these three points?

2)  COMPOUNDCURVE(CIRCULARSTRING(0 0, 1 1, 1 0),(1 0, 0 1))
Is this an arc with a straight line segment at the end?  What if the
start of this straight line segment did not match the end of the arc
segment?  i.e. it didn't start with the coordinate (1 0).  Is that
allowed?  If so, is there then a gap in the geometry?

3)  CURVEPOLYGON(CIRCULARSTRING(0 0, 4 0, 4 4, 0 4, 0 0),(1 1, 3 3, 3 1,
1 1))
My best guess is that this is effectively a circle with a triangle in
the middle of it.  Help.  :)

4)  MULTICURVE((0 0, 5 5),CIRCULARSTRING(4 0, 4 4, 8 4))
How is this different then the COMPOUNDCURVE object above?

5)  MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(0 0, 4 0, 4 4, 0 4, 0 0),(1
1, 3 3, 3 1, 1 1)),((10 10, 14 12, 11 10, 10 10),(11 11, 11.5 11, 11
11.5, 11 11)))
I'm guessing I would understand this one just fine once I understood the
above ones.  Just adding for completeness.  :)

Ken

--
------s----a----m----s----i----x------
--

Ken Southerland
Senior Consultant
Sam Six, Inc.

503-236-4288
http://www.samsix.com

```