How can I convert the latitude and the longitude coordinates of a rectangle in Cartesian coordinates, so that I can store them in a geometry field using PostGIS?


Check ST_Transform from the very helpful PostGIS docs:

SELECT ST_AsText(ST_Transform(ST_GeomFromText('POLYGON((-71.1776585052917 42.3902909739571,-71.1776820268866 42.3903701743239, -71.1776063012595 42.3903825660754,-71.1775826583081 42.3903033653531,-71.1776585052917 42.3902909739571))',4326),2249)) As wgs_geom;

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.