Skip to content

Multiple SMP locations per SMP #45

Description

@jonbry

There's really two issues here:

1. admin.tbl_smp_loc doesn't have a unique constraint on smp_id

This causes issues where we have multiple locations for the same SMP

Image

2. Revise script

Each feature class has its own essentially duplicated script that isn't easily readable. We also want to make sure we're not adding duplicates because it only checks for the smp_id to be existing in the smp_loc table. We should probably remove the non-standard magrittr code:

basin <- suppressWarnings((st_read(dsn_infra_pub, "gisad.GSWIBASIN", quiet = TRUE))) %>%
st_set_crs(2272) %>% st_transform(4326) %>% #Convert from PA State Plane to WGS 1984
st_centroid %>% filter(!is.na(SMP_ID)) %>% transmute(smp_id = gsub("\\s", "", SMP_ID)) %>%
filter(!(grepl("[A-z]", smp_id))) %>% #No A-Z characters permitted. Upper and lower case.
filter(!(smp_id %in% smp_loc$smp_id)) %>%
{data.frame(st_coordinates(.), .$smp_id)} %>%
select(smp_id = 3, lon_wgs84 = 1, lat_wgs84 = 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions