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.

Using PostGIS I have a lat/lon point and want to add an east/west and north/south offset in metres to get a new point. Is that possible?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You can use ST_Translate:

The ST_Translate function takes any geometry (linestring, multiline etc) returns a new geometry that is the original geometry moved by a vector defined by X,Y,Z. Note the units of measurement are always in the units of the spatial reference system of the geometry argument. There are two forms of it ST_Translate. ST_Translate(geometry, X, Y, Z) and ST_Translate(geometry, X,Y).

Source: http://www.bostongis.com/postgis_translate.snippet

You'll have to transform lat/lon to meters first. You can use ST_Transform to achieve this:

ST_Transform — Returns a new geometry with its coordinates transformed to the SRID referenced by the integer parameter.

Source: http://postgis.net/docs/ST_Transform.html

share|improve this answer
    
It's the lat/lon to meters part that I'm having trouble with. Any suggestions on that? –  Dave Jennings Oct 20 '10 at 21:20
    
I added the corresponding function to the answer. If you don't know which target SRID to choose, you'll have to tell use the geographic extent of your data. –  underdark Oct 20 '10 at 21:36
    
Thanks. My other research eventually told me the same thing. I naively thought it might be simpler and there'd be a single SRID I could use, but it appears that you have to choose one based on your location. –  Dave Jennings Oct 21 '10 at 8:21

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.