[GIS] Converting coordinates (latitude,longitude) to X,Y using PostGIS

coordinateslatitude longitudepolygonpostgis

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?

Best Answer

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;