nationalparkservice / places-data

Data from the Places system.
http://www.nps.gov/npmap/tools/places/
13 stars 5 forks source link

Track unit boundary multipolygons with inner boundaries #432

Open chadlawlis opened 8 years ago

chadlawlis commented 8 years ago

We need to track which unit boundaries pulling from Lands require inner boundaries, like DENA:

https://github.com/nationalparkservice/places-data/issues/428#issuecomment-180021320

If we were to automate the Lands update process with each iteration we would lose these inner boundaries, given they are maintained via a manual process right now by geoprocessing through QGIS and manually uploading to the server (not updating directly through PostGIS) (context here https://github.com/nationalparkservice/places-data/issues/428#issuecomment-180021320).

I'd like to create (yet another) table in places_boundaries to track the unit_codes that this applies to, so that we can remove them from an automated update query for future Lands releases. cc @jimmyrocks @nateirwin

chadlawlis commented 8 years ago

The units likely to have inner boundaries are ones with an ampersand "&" in their unit_desig_full. A total list of distinct designations with an ampersand currently looks like this:

A total list of units with these designations currently looks like this:

name unit_code data_source
Aniakchak National Monument & Preserve ania Land Resources Division
Big South Fork National River & Recreation Area biso WSD_Parks
Craters of The Moon National Monument & Preserve crmo WSD_Parks
Denali National Park & Preserve dena Land Resources Division
Gates Of The Arctic National Park & Preserve gaar Land Resources Division
Glacier Bay National Park & Preserve glba Land Resources Division
Great Sand Dunes National Park & Preserve grsa WSD_Parks
Katmai National Park & Preserve katm Land Resources Division
Lake Clark National Park & Preserve lacl Land Resources Division
Mississippi National River & Recreation Area miss WSD_Parks
Obed Wild & Scenic River obri Land Resources Division
Rio Grande Wild & Scenic River rigr Land Resources Division
Timucuan Ecological & Historic Preserve timu WSD_Parks
Upper Delaware Scenic & Recreational River upde Land Resources Division
Wrangell - St Elias National Park & Preserve wrst Land Resources Division

Included in this list are the units that I transitioned to the latest Lands release today via https://github.com/nationalparkservice/places-data/issues/362:

name unit_code data_source
Aniakchak National Monument & Preserve ania Land Resources Division
Gates Of The Arctic National Park & Preserve gaar Land Resources Division
Glacier Bay National Park & Preserve glba Land Resources Division
Katmai National Park & Preserve katm Land Resources Division
Lake Clark National Park & Preserve lacl Land Resources Division
Denali National Park & Preserve dena Land Resources Division
Wrangell - St Elias National Park & Preserve wrst Land Resources Division

Which leaves the following from the original list to look into:

name unit_code data_source
Big South Fork National River & Recreation Area biso WSD_Parks
Craters of The Moon National Monument & Preserve crmo WSD_Parks
Great Sand Dunes National Park & Preserve grsa WSD_Parks
Mississippi National River & Recreation Area miss WSD_Parks
Obed Wild & Scenic River obri Land Resources Division
Rio Grande Wild & Scenic River rigr Land Resources Division
Timucuan Ecological & Historic Preserve timu WSD_Parks
Upper Delaware Scenic & Recreational River upde Land Resources Division
chadlawlis commented 8 years ago

Table created via:

-- create table schema
CREATE TABLE inner_boundary_units
(
  unit_id smallint NOT NULL,
  unit_code text,
  last_updated timestamp with time zone,
  date_created timestamp with time zone,
  CONSTRAINT inner_boundary_units_pkey PRIMARY KEY (unit_id)
)

-- create date_created trigger
CREATE TRIGGER inner_boundary_units_date_created
  BEFORE INSERT
  ON alternate_unit_codes
  FOR EACH ROW
  EXECUTE PROCEDURE date_created();

-- create last_updated trigger
CREATE TRIGGER inner_boundary_units_last_updated
  BEFORE INSERT OR UPDATE
  ON alternate_unit_codes
  FOR EACH ROW
  EXECUTE PROCEDURE last_updated();

-- populate table from `parks`
INSERT INTO inner_boundary_units
SELECT unit_id, unit_code
FROM parks 
WHERE unit_code = 'ania'
  OR unit_code = 'dena'
  OR unit_code = 'gaar'
  OR unit_code = 'glba'
  OR unit_code = 'katm'
  OR unit_code = 'lacl'
  OR unit_code = 'wrst';
chadlawlis commented 8 years ago

GRSA has inner boundaries - for the Park and Preserve via Lands, via #693