-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrashdata.sql
More file actions
20 lines (12 loc) · 834 Bytes
/
Copy pathcrashdata.sql
File metadata and controls
20 lines (12 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--add geometry column
alter table gcat_luc_woo_2011to2017 add column geom geometry;
--change empty fields to nulls in lat/long columns
update gcat_luc_woo_2011to2017 set odot_longitude_nbr = null where odot_longitude_nbr = '';
update gcat_luc_woo_2011to2017 set odot_latitude_nbr = null where odot_latitude_nbr = '';
--cast lat/long fields as float not text
alter table gcat_luc_woo_2011to2017 alter column odot_latitude_nbr type double precision using odot_latitude_nbr::double precision;
alter table gcat_luc_woo_2011to2017 alter column odot_longitude_nbr type double precision using odot_longitude_nbr::double precision;
--create geometry column from points
update gcat_luc_woo_2011to2017 set geom = ST_MakePoint(odot_longitude_nbr, odot_latitude_nbr);
--update srid?
--create geometry column from linear referencing info?