I am currently designing a database for my PhD-Project. I want to link a PostgreSQL database to QGIS. I just started in PostgreSQL and am using DBeaver 6.2.2.
When creating my first Test-DB I saw, that I have a multitude of datatype to chose from for a new column, including Polygon, Point and Line. Does that mean I can create a column with this datatype and store my GIS-Geometries in there and is that already a fully functional PostGIS datatype, that is to say could I create e. g. polygons in QGIS from this column?
1 Answer 1
polygon
,point
and line
are native Postgres data types that are not used by PostGIS and have very limited supporting functions.
Instead, you will want to use the geometry
type, which can be refined to contain only polygons geometry(polygon)
or even for a specific projection (geometry(polygon,4326)
)
-
Thanks, that clears that up. There appears to be no data type
geometry
in the DBeaver drop down. How do I add a column with this data type?C.-F. Vintar– C.-F. Vintar2019年12月11日 13:33:45 +00:00Commented Dec 11, 2019 at 13:33 -
@C.-F.Vintar make sure you have enabled PostGIS in the DB you are using (
CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
)JGH– JGH2019年12月11日 13:36:13 +00:00Commented Dec 11, 2019 at 13:36 -
I added the extension in DBeaver. In code this is written here as:
CREATE EXTENSION postgis SCHEMA "public" VERSION 2.5.3
with the Condition{"WHERE NOT ( srid BETWEEN 2000 AND 2180 OR srid BETWEEN 2188 AND 2217 [...]
Apparently that did not work. Perhaps this is a question for a different thread?C.-F. Vintar– C.-F. Vintar2019年12月11日 14:25:09 +00:00Commented Dec 11, 2019 at 14:25 -
@C.-F.Vintar Yes, make it a new question with lots of details. You shouldn't have to put conditions and so much specifications to enable PostGIS. Only
CREATE EXTENSION postgis;
is required.JGH– JGH2019年12月11日 14:34:57 +00:00Commented Dec 11, 2019 at 14:34 -
This question is now in the following thread: gis.stackexchange.com/questions/344701/…C.-F. Vintar– C.-F. Vintar2019年12月12日 08:50:38 +00:00Commented Dec 12, 2019 at 8:50