On Dec 19, 2006, at 11:05 AM, Kirk Wythers wrote:

I am trying to use qgis to view a PostGIS database of climate data. However, I'm getting an error upon trying to load my first postgis layer. The layer shows up in the "Add PostGIS Table(s)" thingy. But then halts with an error message about invalid layer. Any ideas?

The first thing that strikes me is you have two geometry columns. I'm not sure if thats the problem or not. I haven't tested QGIS with a PostGIS table containing 2 geometry columns.

The column "id" is a unique site id value that is shared in all tables. I would like to start by viewing the site locations, but then move on to displaying the climate data that is related to each site location. Is this possible in qgis? If so, does it require a view that contains both climate data and site geometry? Any advice would be much appreciated.

Yes, you will need a view to do the relates.

Thanks.

The basic database looks like this:

met_data=# \d
              List of relations
Schema |       Name       | Type  |  Owner
--------+------------------+-------+----------
public | climate          | view  | kwythers
public | geometry_columns | table | kwythers
public | radiationtype    | table | kwythers
public | sites            | table | kwythers
public | solar            | table | kwythers
public | spatial_ref_sys  | table | kwythers
public | weather          | table | kwythers
(7 rows)

Where the table "weather" contains max and min temps, and precipitation. The table solar contains solar radiation values. The view "climate" combines weather and solar. And finally the table "sites" holds the geometry information for each site location.

Below are the gory details of each table

met_data=# \d weather
    Table "public.weather"
Column |   Type   | Modifiers
--------+----------+-----------
id     | integer  |
year   | smallint |
month  | smallint |
day    | smallint |
doy    | smallint |
date   | date     |
precip | real     |
tmin   | real     |
tmax   | real     |
Foreign-key constraints:
    "idfk" FOREIGN KEY (id) REFERENCES sites(id)

met_data=# \d solar
     Table "public.solar"
Column |   Type   | Modifiers
--------+----------+-----------
id     | integer  |
year   | smallint |
month  | smallint |
day    | smallint |
doy    | smallint |
date   | date     |
rad    | real     |
Foreign-key constraints:
    "idfk" FOREIGN KEY (id) REFERENCES sites(id)

met_data=# \d climate
     View "public.climate"
Column |   Type   | Modifiers
--------+----------+-----------
id     | integer  |
year   | smallint |
doy    | smallint |
tmax   | real     |
tmin   | real     |
rad    | real     |
precip | real     |
View definition:
SELECT weather.id, weather."year", weather.doy, weather.tmax, weather.tmin, solar.rad, weather.precip
   FROM weather, solar
  WHERE weather.id = solar.id AND weather.date = solar.date;

met_data=# \d sites
              Table "public.sites"
     Column      |       Type        | Modifiers
-----------------+-------------------+-----------
id              | integer           | not null
name            | character varying |
longname        | character varying |
state           | character varying |
lat             | double precision  |
lon             | double precision  |
the_geom_lonlat | geometry          |
the_geom_meters | geometry          | not null
Indexes:
    "sites_pkey" PRIMARY KEY, btree (id)
    "sites_id_key" UNIQUE, btree (id)
    "idx_sites_the_geom_lonlat" gist (the_geom_lonlat)
    "idx_sites_the_geom_meters" gist (the_geom_meters) CLUSTER
Check constraints:
    "enforce_dims_the_geom_meters" CHECK (ndims(the_geom_meters) = 2)
    "enforce_dims_the_goem_lonlat" CHECK (ndims(the_geom_lonlat) = 2)
"enforce_geotype_the_geom_meters" CHECK (geometrytype (the_geom_meters) = 'POINT'::text OR the_geom_meters IS NULL) "enforce_geotype_the_goem_lonlat" CHECK (geometrytype (the_geom_lonlat) = 'POINT'::text OR the_geom_lonlat IS NULL) "enforce_srid_the_geom_meters" CHECK (srid(the_geom_meters) = 32661) "enforce_srid_the_goem_lonlat" CHECK (srid(the_geom_lonlat) = 4269)


_______________________________________________
Qgis-user mailing list
Qgis-user@lists.qgis.org
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Gary Sherman
Micro Resources: http://mrcc.com
  *Geospatial Hosting
  *Web Site Hosting
"We work virtually everywhere"
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-



_______________________________________________
Qgis-user mailing list
Qgis-user@lists.qgis.org
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user

Reply via email to