3

How to create an ellipse geometry with postgis from known axis coordinates and peak radius ?

From picture below :

enter image description here

Point A and Point B is known lat/lon

R is a known result of fresnelZone calculation (in Meters).

Yes I read this and this (using shapely instead of Postgis), but I don't know how to implement/adopt it to my need.

2

I would go with CIRCULARSTRING. You already know the coordinates of start point and end point, and the coordinates for the peak radius can be easily calculated.

Thus, the half of your desired ellipse could be represented as

CIRCULARSTRING(StartPointX StartPointY, PeakRadiusX PeakRadiusY, EndPointX EndPointY)

The other half being the same with negative values of peak radius

    CIRCULARSTRING(StartPointX StartPointY, -PeakRadiusX -PeakRadiusY, EndPointX EndPointY)

Union those two halfs and you should have your ellipse complete.

  • the united geometry will be a linestring not a (multi-)polygon? – LaughU Jul 20 '17 at 7:47
  • dear @michal-zimmermann, and how to calculate that PeakRadius (positive and negative) ? I can calculate that X point using SELECT ST_AsText(ST_Centroid('LINESTRING(StartY StartX, EndY EndX)')) – Bino Oetomo Jul 20 '17 at 7:58
  • @LaughU I thing the compound will be polygon, using CURVEPOLYGON(CIRCULARSTRING(StartY, StartX, PeakY, PeakX, EndY EndX),(StartY, StartX, -PeakY, -PeakX, EndY EndX)) – Bino Oetomo Jul 20 '17 at 8:07
  • @BinoOetomo if you know the R, just add it to the StartY value. – Michal Zimmermann Jul 20 '17 at 10:52
  • @michal-zimmerann thankyou for your response. I think I got the picture. Your answer inspire me, but not directly solve my question. Should I mark it as solved ? I think pseudo code will be : 1. Get centroid poin of AB--> cp 2. Get Bearing of AB --> b0 3. count b0 + 90 --> b1 4. count b0 - 90 --> b2 5. make point using cp, distance (fz), b1 --> peak1 ( use ST_Project) 6. make point using cp, distance (fz), b2 --> peak2 ( use ST_Project) 7. curve polygon ( circular string (A peak1 B),(A peak2 B) – Bino Oetomo Jul 20 '17 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.