wiki:CookBook Postgis

Version 16 (modified by cedric, 15 years ago) (diff)

--

Help on Posgis

back to Recipes for EDA CookBook Eda

Postgis book http://www.postgis.fr/book/print/156#413413413

I would like to create a postgis table from a postgres table with x y

The data are in lambert II étendu

select * from bdmap.spatial_ref_sys where srtext like '%Lambert%' and srtext like '%II%' 

seems to be 27572

SELECT AddGeometryColumn('bdmap', 'station','the_geom', 27572,'POINT',2) 

from Laurent

UPDATE bdmap
   SET the_geom=PointFromText('POINT(' || st_abcisse || ' ' || st_ordonnee || ')',27572);

I've got a message from Qgis saying that I'm not allowed to use a table without int4 primary key or OID

ALTER TABLE bdmap.station SET WITH OIDS;

Here we add a validity constraint

ALTER TABLE bdmap.station ADD CONSTRAINT geometry_valid_check CHECK (isvalid(the_geom)); 

SELECT ST_Transform(the_geom,4269) FROM geotable;