0
votes

New to Postgres, have google and also checked other posts but this does not solve the problem

I am running Postgres 9.4 x86.

I am trying to run the Query below but it fails with error

CREATE TABLE Locations (
    id SERIAL PRIMARY KEY,
    name VARCHAR(1000),
    location GEOGRAPHY(POINT, 4326)   )

The error that I get is

ERROR: type "geography" does not exist LINE 4: location GEOGRAPHY(POINT, 4326) ^ ********** Error **********

ERROR: type "geography" does not exist SQL state: 42704 Character: 90

After doing some search I tried to ensure that postGIS extension is installed

so I tried below

CREATE EXTENSION Postgis;

But now this fails with error

ERROR: could not open extension control file "C:/Program Files (x86)/PostgreSQL/9.4/share/extension/postgis.control": No such file or directory

Any help would be appreciated. Thank you

2
Did you download PostGIS and installed the files into the correct directories?a_horse_with_no_name
No, I just installed postgres setup/installer. Is postGIS not an extension already available or to be installed from within postGres ?Ahmed
No, Postgres does not contain PostGIS by default.a_horse_with_no_name

2 Answers

1
votes

If you install the Postgres from the official windows installer. Then follow my instructions.

  1. Click on the start menu and search for "Stack Builder". It will list a Program called "Application Stack Builder"
  2. Click on that and select the server from the dropdown, and click next.
  3. After that In the List. Click on the "Spatial Extensions"
  4. Click on PostGIS and click next and follow the instructions.(Ui of the software may be stuck for a little bit while)
0
votes

On Windows you have to install some prerequisites using Stack Builder. Under the Spatial Extensions section you will find PostGis options. Take a look at theese:

[1] Using Stack Builder
[2] How to install PostGIS on Windows?