Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to store a GML ArcByCenterPoint in PostGIS. I can work out the start, middle and end points required by the CIRCULARSTRING type and all seems to be OK, except that when I visualise the arc it does not fit the circle that it's supposed to be part of.

Data (in lon/lat format):

Circle centre point: 29.59444 40.26333
Radius:              18 NM (27780 M)
Arc start point:     29.89250 40.36667
Arc end point:       29.27528 40.31667
Arc middle points:   29.560000 40.511667 (counter-clockwise)
                     29.628611 40.015000 (clockwise)

SQL statements to insert the geometries. Note that I'm using ST_CurveToLine here, because I don't know of anything that can visualise a CIRCULARSTRING directly.

-- The arcs going both ways between the same start and end points
INSERT INTO test (test) VALUES (ST_SetSRID(ST_CurveToLine('CIRCULARSTRING(29.8925 40.36667,29.560000 40.511667,29.27528 40.31667)'), 4326));
INSERT INTO test (test) VALUES (ST_SetSRID(ST_CurveToLine('CIRCULARSTRING(29.8925 40.36667,29.628611 40.015000,29.27528 40.31667)'), 4326));

-- The full circle
INSERT INTO test (test) VALUES (ST_Buffer(ST_GeogFromText('POINT(29.59444 40.26333)'), 15 * 1852)::geometry);

Here is what the result looks like in Google Earth:

The resulting shapes

The arcs are in red and the lines from the center point to the start and end points are in blue. The arcs do touch the circle at 3 points, so it would appear that the coordinates were calculated correctly (or at least close). But the shape of both arcs is wrong - as you can see, they don't quite follow the circle.

Can anyone suggest what's going wrong here? Is either the CIRCULARSTRING type or the ST_CurveToLine function not doing what I expect? I'd love to take ST_CurveToLine out of the equation and visualise the CIRCULARSTRING directly, but I don't know of any way to do that.

Edit: I finally gave up on this approach and approximated the arc in a different way: Storing GML surface in PostGIS

share|improve this question
you are viewing lat/lon. A circle is not a circle shown on lat lon. It will always be stretched tall. because the longitudes get more narrow the further north you go. either you have a circle measured strangley on the ground or you have the ground stretched to map flat. – Brad Nesom Nov 15 '11 at 5:48
Hmm, when I visualise it with GeoServer the circle is stretched wide. Does that mean I'm generating the circle incorrect? I'm using ST_Buffer, as shown above. – EM0 Nov 15 '11 at 6:03
It depends on what your circle is representing. if it represents a radius measured on the ground you should coerce the data into an equal area coordinate system. take a look at the difference between geographic coordinate systmes and projected coordinate systems (google). – Brad Nesom Nov 15 '11 at 8:03
@Brad Equal area will almost always distort circles, too. For checking shapes of smallish features (i.e., having extents less than a few degrees), use conformal projections. – whuber Nov 15 '11 at 14:20
Thanks whuber - I knew I was off to some degree. When I wrote that. It was late/early - but I should have realized my stateplane systems are all in lambert conformal. @RealityExists the point whuber makes is that using a local crs will get you the most accuracy "on-the-ground". – Brad Nesom Nov 15 '11 at 15:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.