I have the datatype geometry defined. But I can't set it to one of the columns geom. as shown in the figure.
Asked
Active
Viewed 1.1k times
2
1 Answers
9
First you need to create postgis extension to add spatial functions such as distance, area, union, intersection, and specialty geometry data types to the database.
create extension postgis;
Then alter geometry column of your table, in your case geom column using this SQL query.
ALTER TABLE poi
ALTER COLUMN geom
TYPE GEOMETRY(POINT,4326);
You can set your own projection, i assume your projection is Geographic Coordinate System (GCS WGS84)
Update:
If you want to store altitude with xy, you need to use POINTZ instead of POINT.
TYPE GEOMETRY(POINTZ,4326);
Read this for further information.
Shahzad Bacha
- 1,596
- 1
- 14
- 23
-
-
-
when I do the above, I get the following error Column has Z dimension but geometry does not – Andre Ahmed Feb 07 '17 at 11:37
-
it's because your geometry doesn't have altitude information, just latitude and longitude. – Shahzad Bacha Feb 07 '17 at 11:52

ALTER TABLE poi ALTER COLUMN geom TYPE GEOMETRY(POINT,4326)– Shahzad Bacha Feb 07 '17 at 06:03