convert units, drop unneeded columns
This commit is contained in:
parent
409b522f89
commit
88f88fb5ed
@ -15,7 +15,7 @@ CREATE TABLE airports (
|
||||
tz TEXT,
|
||||
type TEXT,
|
||||
source TEXT,
|
||||
CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),
|
||||
CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 3),
|
||||
CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POINT'::text OR geom IS NULL),
|
||||
CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 4326)
|
||||
);
|
||||
@ -23,6 +23,12 @@ CREATE TABLE airports (
|
||||
-- import data from airports.dat
|
||||
\copy airports(gid, name, city, country, iata, icao, latitude, longitude, altitude, timezone, dst, tz, type, source) FROM 'airports.dat' DELIMITERS ',' CSV;
|
||||
|
||||
-- put lat/lon to the real GIS "geom" field
|
||||
-- put lat/lon/altitude to the "real" geom field
|
||||
UPDATE airports
|
||||
SET geom = ST_SetSRID(ST_Point(longitude, latitude),4326);
|
||||
SET geom = ST_SetSRID(ST_MakePoint(longitude, latitude, altitude * 0.3048),4326);
|
||||
|
||||
ALTER TABLE airports DROP COLUMN latitude;
|
||||
ALTER TABLE airports DROP COLUMN longitude;
|
||||
ALTER TABLE airports DROP COLUMN altitude;
|
||||
ALTER TABLE airports DROP COLUMN type;
|
||||
ALTER TABLE airports DROP COLUMN source;
|
||||
|
Loading…
Reference in New Issue
Block a user