[postgis-users] Get point certain degree of another point

Mike Toews mwtoews at gmail.com
Sun Feb 28 08:11:48 PST 2010


Apply the same COGO trigonometry as before[1]:

import math

class Point:
    def __init__(self, x, y):
        self.x=x; self.y=y

def TranslateBearingDistance(pt, rad, dist):
    return Point(pt.x + dist*math.cos(rad), pt.y + dist*math.sin(rad))

pt0 = Point(100, 100)

# 12 units away at 30 degrees CCW from x-axis
pt1 = TranslateBearingDistance(pt0, 30*2*math.pi/360, 12)

print pt1.x, pt1.y
# 110.392304845 106.0


[1] http://www.mail-archive.com/postgis-users@postgis.refractions.net/msg09702.html

-Mike

On 27 February 2010 18:43, Maelvon HAWK <maelvon.hawk at laposte.net> wrote:
> Hello,
>
> Do you have a tip to retrieve the same thing as Tommy408 ask, but OT I
> think, in python ?
>
> Maelvon
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list