postgresqlpostgis

PostGIS Error: type "geography" does not exist


I just upgraded my development machine to Windows 7 and am therefore reinstalling PostgreSQL and PostGIS. I used the Postgres Plus installer, as recommended on the Postgres website, and followed this tutorial for installation. I created a database using the template_postgis and the application that I am currently developing was able to connect to the database with no problems.

However, my old code is not able to create tables using the PostGIS Geography like it used to. For example, when I try to create the following table:

CREATE TABLE test_area (
    id SERIAL PRIMARY KEY,
    name VARCHAR(1000),
    area GEOGRAPHY(POLYGON, 4326),
    start_time DATE,
    end_time DATE
)

I get the following error:

ERROR:  type "geography" does not exist
LINE 4:         area GEOGRAPHY(POLYGON, 4326),
                     ^

If I look under the database in the Object brower of pgAdmin III, I see a bunch of Geometry functions, so the installation seems to have run correctly. I'm not sure what my problem might be. Is it possible for the installer to only install PostGIS Geometry, but not Geography?


Solution

  • I got my question answered over on the GIS site. I had PostGIS 1.4 installed, but Geography was not added until PostGIS 1.5. So I had to uninstall what I had and re-install Postgres. I had great difficulty finding a version that included PostGIS 1.5, though. I was given the advice to not use the "Postgres Plus" proprietary software, though, since it takes EnterpriseDB time to port the most up-to-date add-ons and such. Instead I was redirected to the regular PostgreSQL download on the EnterpriseDB website, which is surprisingly tricky to find. Here it is. The 64-bit version did not come with PostGIS, so I had to use the 32-bit version instead, which worked. Finally!