I loaded a few Shapefiles from different sources into a PostgreSQL database, when I visualize them in QQGIS some of them are not shown.
This how i added the geometry column in my tables:
SELECT AddGeometryColumn ('public','table_geom','geom',4326,'MULTIPOLYGON',2, true);
And this is the SQL script that I used to change the srid of the Shapefiles I uploaded to the table:
SELECT UpdateGeometrySRID('public', 'shapefile_table','geom',4326);
I added the geometry column from the table created from the Shapefile, there it wasn't any trouble with this.
This is how i defined my table:
CREATE TABLE table_geom ( id serial NOT NULL, geom geometry(MultiPolygon,4326), CONSTRAINT pk_table_geom PRIMARY KEY (id_ageb), CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2), CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'MULTIPOLYGON'::text OR geom IS NULL), CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 4326) ) WITH ( OIDS=FALSE ); ALTER TABLE table_geom OWNER TO postgres;
The thing is, i can visualize correctly the source Shapefile in QGIS but not from the database. What am I missing? I already checked the srid is the same in all tables but that seems that is not the problem. Any hints?
Quick edit: i think is a bug(?), probably because the table data is too big, now some of the layers are being shown from one table, but not all.
Edit 1: I see now what is the problem, the geometry from the table is being drawn but not correctly,as i mentioned before if i load the source shapefile in qgis the area is shown where it should be, but if i load from the database this area is drawn elsewhere, but why? i changed the srid in all loaded shapefiles