-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Import
drush scr modules/dh/src/import_features.php ~/www/files/vahydro/jamesgrid_efdc.txt
Set mapping properties to WQ output points
sftp dbase1
put james_efdc.txt /tmp/
bye
psql -h dbase1 drupal.dh03
create temp table tmp_efdc_sta (
"St" integer,
"EFDC_ID" integer,
x integer,
y integer
);
copy tmp_efdc_sta from '/tmp/james_efdc.txt' WITH HEADER CSV DELIMITER E'\t';
-- efdc id
copy (select hydroid as featureid, 'dh_feature' as entity_type, 'om_class_AlphanumericConstant' as varkey, "EFDC_ID" as propcode, 'efdc_id' as propname from tmp_efdc_sta left outer join dh_feature on dh_feature.hydrocode = 'james_chla_p6_' || "EFDC_ID") to '/tmp/efdc_props.txt' WITH header csv delimiter E'\t';
-- "Station" id in EFDC
copy (select hydroid as featureid, 'dh_feature' as entity_type, 'om_class_AlphanumericConstant' as varkey, "St" as propcode, 'efdc_station' as propname from tmp_efdc_sta left outer join dh_feature on dh_feature.hydrocode = 'james_chla_p6_' || "EFDC_ID") to '/tmp/efdc_sta_props.txt' WITH header csv delimiter E'\t';
# import
drush scr modules/om/src/om_setprop.php file ../files/vahydro/efdc_props.txt
drush scr modules/om/src/om_setprop.php file ../files/vahydro/efdc_sta_props.txt
Translate
shp2pgsql -s 26918 JamesEFDC > james_efdc.sql
cat james_efdc.sql | psql -h dbase1 va_hydro
Export
copy (
select 'Cell ' || id || '-' || x || '-' || y as name, 'james_chla_p6_' || id as hydrocode, 'efdc_grid' as ftype, st_astext(st_transform(geom,4326)) as wkt, (st_area2d(geom) * 1e-6) as area_sqkm, 'hydromodel_cell' as bundle
from jamesefdc
) to '/tmp/jamesgrid_efdc.txt' WITH HEADER CSV DELIMITER AS E'\t';
Table Def
\d jamesefdc
Table "public.jamesefdc"
Column | Type | Collation | Nullable | Default
--------+------------------------------+-----------+----------+----------------------------------------
gid | integer | | not null | nextval('jamesefdc_gid_seq'::regclass)
id | integer | | |
type | integer | | |
dep | double precision | | |
tag | integer | | |
x | double precision | | |
y | double precision | | |
geom | geometry(MultiPolygon,26918) | | |
Indexes:
"jamesefdc_pkey" PRIMARY KEY, btree (gid)
Metadata
Metadata
Assignees
Labels
No labels