Skip to contents

Get lat lon, Registry ID, and NAICS, for given FRS Program System ID

Usage

latlon_from_programid(programname, programid)

Arguments

programname

name of EPA program that the programid is from: "RCRAINFO" is the programname and "XJW000000174" is the programid if the full record was RCRAINFO:XJW000000174

programid

like "XJW000000174" "RCRAINFO" is the programname and "XJW000000174" is the programid if the full record was RCRAINFO:XJW000000174

Value

data.table with lat lon REGISTRY_ID program pgm_sys_id

Details

The ID is the identification number, such as the permit number, assigned by an information management system that represents a facility site, waste site, operable unit, or other feature tracked by that Environmental Information System.

see epa_programs for a list of programs and their acronyms and a count of FRS facilities under each. Also see a simple lilst of names like this: as.vector(epa_programs) or sort(unique(frs_by_programid$program))

There are roughly 3.5 million records in frs_by_programid but only about 2.7 million unique pgm_sys_id values because the same number may be used under different program types, like RCRAINFO AND EGRID.

These are two distinct facilities both using the number 1:

latlon_from_programid('EGRID', 1) latlon_from_programid('ICIS', 1)

Also note the FRS API: https://www.epa.gov/frs/facility-registry-service-frs-api https://www.epa.gov/frs/frs-rest-services

Examples

 ids = c("00603DSCFPRD459", "00603MCRNTRD11K", "00605VNMRBMONTA" )
 latlon_from_programid("TRIS", ids) 
#> Key: <pgm_sys_id, program, REGISTRY_ID>
#>         lat       lon  REGISTRY_ID       PGM_SYS_ACRNMS program      pgm_sys_id
#>       <num>     <num>       <char>               <char>  <char>          <char>
#> 1: 18.44239 -67.14231 110007442428 TRIS:00603DSCFPRD459    TRIS 00603DSCFPRD459
#> 2: 18.47203 -67.10334 110020514807 TRIS:00603MCRNTRD11K    TRIS 00603MCRNTRD11K
#> 3: 18.45306 -67.14084 110008472125 TRIS:00605VNMRBMONTA    TRIS 00605VNMRBMONTA
 
 latlon_from_programid('EGRID', 1) 
#> Key: <pgm_sys_id, program, REGISTRY_ID>
#>         lat       lon  REGISTRY_ID PGM_SYS_ACRNMS program pgm_sys_id
#>       <num>     <num>       <char>         <char>  <char>     <char>
#> 1: 55.33972 -160.4972 110070934497        EGRID:1   EGRID          1
 latlon_from_programid('ICIS', 1)
#> Key: <pgm_sys_id, program, REGISTRY_ID>
#>         lat      lon  REGISTRY_ID PGM_SYS_ACRNMS program pgm_sys_id
#>       <num>    <num>       <char>         <char>  <char>     <char>
#> 1: 30.42381 -90.1373 110010746452         ICIS:1    ICIS          1
 
 # ambiguous to only use the number! 354362 is used by two programs here:
 frs_by_programid[match(testids_program_sys_id, frs_by_programid$pgm_sys_id), ]
#> Key: <pgm_sys_id, program, REGISTRY_ID>
#>      lat   lon REGISTRY_ID PGM_SYS_ACRNMS program pgm_sys_id
#>    <num> <num>      <char>         <char>  <char>     <char>
#> 1:    NA    NA        <NA>           <NA>    <NA>       <NA>
#> 2:    NA    NA        <NA>           <NA>    <NA>       <NA>
 frs_by_programid[frs_by_programid$pgm_sys_id %in% testids_program_sys_id, ]
#> Key: <pgm_sys_id, program, REGISTRY_ID>
#> Empty data.table (0 rows and 6 cols): lat,lon,REGISTRY_ID,PGM_SYS_ACRNMS,program,pgm_sys_id