Thank you Marc and Mike
Mike Toews wrote: > > On 2010-01-22 19:05, tommy408 wrote: >> How can I get a point at a certain distance and degree from another >> point. >> For example 10 meter distance to another point at 45 degrees. >> > > You could also use some simple trigonometry with ST_Translate(). > > For example, consider 'geom' at (100 100), and a point 12 units away 30 > degrees from the x-axis (math style with CCW direction .. or a > geographic bearing of 60 degrees CW from North). > > SELECT AsEWKT(ST_Translate(geom, cos(rad)*dist, sin(rad)*dist)) > FROM (select ST_MakePoint(100, 100) as geom, 12 as dist, 30*2*pi()/360 > as rad) AS foo; > > POINT(110.392304845413 106) > > Or your example from (0 0) using a math-style angle: > > SELECT AsEWKT(ST_Translate(geom, cos(rad)*dist, sin(rad)*dist)) > FROM (select ST_MakePoint(0, 0) as geom, 10 as dist, 45*2*pi()/360 as > rad) AS foo; > > POINT(7.07106781186548 7.07106781186547) > > This could easily be turned into a PL/pgSQL function if you require it > frequently. Also, be aware of the geographic versus mathematics > definition of angles, since they have opposite rotations and start 90 > degrees from each other. > > -Mike > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > -- View this message in context: http://old.nabble.com/Get-point-certain-degree-of-another-point-tp27282672p27301970.html Sent from the PostGIS - User mailing list archive at Nabble.com. _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users