Skip to content

Commit

Permalink
GFT: update wpaa source and logic (#762)
Browse files Browse the repository at this point in the history
* Update `wpaa` template with correct source

* Modify `wpaa` logic in GFT data product

* Update `wpaa` geom for export
  • Loading branch information
sf-dcp authored Apr 12, 2024
1 parent d399b68 commit 8c1b602
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
6 changes: 3 additions & 3 deletions dcpy/library/templates/dcp_waterfront_access_map_wpaa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ dataset:
source:
arcgis_feature_server:
server: dcp
name: nywpaa_accesspoints
name: nywpaa
layer: 0
options:
- "AUTODETECT_TYPE=NO"
- "EMPTY_STRING_AS_NULL=YES"
geometry:
SRS: EPSG:2263
type: POINT
type: POLYGON

destination:
geometry:
SRS: EPSG:2263
type: POINT
type: POLYGON
options:
- "PRECISION=NO"
- "OVERWRITE=YES"
Expand Down
2 changes: 1 addition & 1 deletion products/green_fast_track/bash/export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mkdir -p output && (
fgdb_export_partial ${fgdb_filename} MULTIPOLYGON sources__waterfront_access_pow sources__waterfront_access_pow ${default_srs} -update
fgdb_export_partial ${fgdb_filename} MULTIPOLYGON sources__waterfront_access_pow_buffers sources__waterfront_access_pow_buffers ${default_srs} -update

fgdb_export_partial ${fgdb_filename} MULTIPOINT sources__waterfront_access_wpaa sources__waterfront_access_wpaa ${default_srs} -update
fgdb_export_partial ${fgdb_filename} MULTIPOLYGON sources__waterfront_access_wpaa sources__waterfront_access_wpaa ${default_srs} -update
fgdb_export_partial ${fgdb_filename} MULTIPOLYGON sources__waterfront_access_wpaa_buffers sources__waterfront_access_wpaa_buffers ${default_srs} -update

fgdb_export_partial ${fgdb_filename} NONE variables variables ${default_srs} -update
Expand Down
16 changes: 5 additions & 11 deletions products/green_fast_track/models/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,16 @@ sources:
- name: wpaa_id
tests:
- not_null
- name: wpaa_name
- unique
- name: name
tests:
- not_null
- name: wkb_geometry
tests:
- not_null
tests:
- dbt_utils.unique_combination_of_columns:
name: dcp_waterfront_access_map_wpaa_compound_key
combination_of_columns:
- wpaa_id
- wpaa_name
- wkb_geometry
config:
severity: warn
- name: status
tests:
- not_null

- name: dcp_waterfront_access_map_pow
columns:
Expand Down Expand Up @@ -253,7 +248,6 @@ sources:
- wkt
config:
severity: warn


- name: dcp_beaches
columns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ WITH wpaa AS (
SELECT * FROM {{ ref("stg__waterfront_access_wpaa") }}
),

modified_id AS (
filtered_status AS (
SELECT
variable_type,
raw_geom,
wpaa_id || '-' || wpaa_name AS variable_id
wpaa_id,
name,
raw_geom
FROM wpaa
WHERE UPPER(status) != 'CLOSED'
),

-- some areas are listed multiple times due to different geometries. Group them
grouped_by_variable_id AS (
modified_id AS (
SELECT
variable_type,
variable_id,
ST_UNION(raw_geom) AS raw_geom
FROM modified_id
GROUP BY variable_type, variable_id
raw_geom,
wpaa_id || '-' || name AS variable_id
FROM filtered_status
)

SELECT
variable_type,
variable_id,
raw_geom,
ST_BUFFER(raw_geom, 200) AS buffer
FROM grouped_by_variable_id
FROM modified_id
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ final AS (
SELECT
'waterfront_access_wpaa' AS variable_type,
wpaa_id,
wpaa_name,
name,
status,
st_transform(wkb_geometry, 2263) AS raw_geom
FROM source

Expand Down

0 comments on commit 8c1b602

Please sign in to comment.