Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How do I create a point 1000 meters away from a reference point?

The ST_Translate only supports geometry type.

I also tried using ST_GeomFromText but that returns a unit and not in meters.

Here is my sample query:

SELECT ST_AsText ( ST_Translate ( ST_GeogFromText('SRID=4326;POINT(-70.01 43.27)'), 1000, 0 ) );

Is there a way that I can convert the output of ST_Translate into meters?

share|improve this question
add comment

3 Answers

You want ST_Project, which takes in a point, direction and distance http://postgis.net/docs/ST_Project.html

share|improve this answer
add comment

To make a meter translation you need a geometry that has a spatial reference system in meter unit. The srid code 31997 for example is metric, so what need to do is feed a metric geometry to st_translate and get back into the desired output spatial reference system.

SELECT st_AsText ( st_transform( st_translate( st_transform( st_GeomFromText('SRID=4326;POINT(-70.01 43.27)'), 31997 ), 1000, 0 ), 4326 ) );
share|improve this answer
    
do you know if mercator (EPSG: 3857) is also in meters units? I do a couple of tests with the ST_Buffer function and they don't return the same area –  opensas Nov 16 '13 at 4:11
    
Using srid 31997 only confuses things. –  martin f Nov 18 '13 at 23:19
    
Mercator 3857 is metric system too. Values could change a little based on projection used. Since some projections change the shape of earth figure is expected some value change due to convertion from spherical to a plane(projected) reference system. As answered the srid used is just an example. You can use any that suits better your case. –  cavila Nov 20 '13 at 19:35
add comment

Use Geometry contructor

ST_GeomFromText()

http://postgis.net/docs/ST_GeomFromText.html

share|improve this answer
    
ST_GeomFromText is returning a unit and not a meter. How do I convert it to meters. –  user181677 Dec 19 '12 at 16:46
    
ST_Transform(the_geom, new_srid) , where new_srid should system that uses metric and is well defiend on your are. More information gaia-gis.it/gaia-sins/spatialite-cookbook/html/srid.html –  simplexio Dec 20 '12 at 7:39
add comment

Your Answer

 
discard

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

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