[postgis-users] Finding that third point on an arc.

Blake Crosby me at blakecrosby.com
Sun Sep 6 10:00:49 PDT 2009


Hello,

I have:

- Starting Point (lat/long, srid=4326)
Ps = POINT(-75.7016666666667 45.1127777777778)
- Ending Point (lat/long, srid=4326)
Pe = POINT(-75.5627777777778 45.0972222222222)
- Centre of arc (lat/long, srid=4326)
Pc= POINT(-75.6333333333333 45.1)
- Radius (meters: 5556)

I thought I could construct a circular line string, however you need an 
odd number of points. To get that third point, I was going to use the 
rotate function found here:

http://trac.osgeo.org/postgis/wiki/UsersWikiplpgsqlfunctions

To rotate the starting point (Ps) 90 degrees and use that result as the 
third part of arc.

The resulting arc looks more like an ellipse when being projected in my 
final projection.

Does anyone know where I'm going wrong? Essentially I'm doing this:

Rotate Ps:
select astext(rotateatpoint(st_geomfromtext('POINT(-75.7016666666667 
45.1127777777778)',4326),-75.7016666666667,45.1127777777778,pi()/2));
                   astext
-------------------------------------------
  POINT(-75.7016666666667 45.1127777777778)

generate arc, and convert to a linestring:

select 
astext(st_curvetoline(st_geomfromtext('CIRCULARSTRING(-75.7016666666667 
45.1127777777778,-75.5627777777778 45.0972222222222,-75.7016666666667 
45.1127777777778)',4326)));

Take a look at the screen shot here. The outer arc is the one generated 
here, the inner one is what I need to get.

http://www.blakecrosby.com/arc.png



More information about the postgis-users mailing list