Skip to content

Commit

Permalink
Updated for an additional dauco, dau intersceted with counties layer.…
Browse files Browse the repository at this point in the history
… Areas < 50m^2 ignored.
  • Loading branch information
qjhart committed Aug 4, 2016
1 parent 94161c7 commit eed151b
Show file tree
Hide file tree
Showing 8 changed files with 688 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*~
*.tar.gz
california-counties*
configure.mk
36 changes: 32 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ schema:=public

DEFAULT: detailed_analysis_units.geojson shp

# We need the California Counties to make
# the DAUCO layer as well.
caco.shp:=california-counties-1.0.0/shp/california_counties.shp
${caco.shp}:version:=v1.0.0
${caco.shp}:tgz:=v1.0.0.tar.gz
${caco.shp}:git:=https://github.com/CSTARS/california-counties/archive
${caco.shp}:${tgz}
[[ -f ${tgz} ]] || wget ${git}/${tgz};\
tar -xzf ${tgz};

postgis:: ${caco.shp}
${OGR} -overwrite -a_srs 'epsg:3310' -nlt PROMOTE_TO_MULTI ${caco.shp};
${PG} -c 'alter table california_counties rename wkb_geometry to boundary'

# Converting to WGS84 is a more accepted GEOJSON format.
detailed_analysis_units.geojson: src/daus.vrt src/dau_2012.shp
ogr2ogr -f GEOJSON -t_srs WGS84 $@ $<
Expand All @@ -18,8 +32,22 @@ shp: src/daus.vrt
# Additionally, we may want to show alternative import strateigies.
# This rule will create a PostGIS version in ${schema}
.PHONY: postgis
postgis: src/daus.vrt src/dau_2012.shp
${OGR} src/daus.vrt
postgis:: src/daus.vrt src/dau_2012.shp
${OGR} -overwrite -a_srs 'epsg:3310' src/daus.vrt
${PG} -c 'alter table detailed_analysis_units rename wkb_geometry to boundary'


# Create the dauco data.
.PHONY: dauco
dauco: dauco.geojson shp/dauco.shp

dauco.geojson:
${PG} -f src/dauco.sql
ogr2ogr -nlt POLYGON -a_srs epsg:3310 -t_srs epsg:4326 -f GEOJSON -overwrite dauco.geojson PG:"service=${service}" dauco

shp/dauco.shp:dauco.geojson
ogr2ogr -nlt POLYGON -a_srs epsg:3310 -overwrite shp/dauco.shp PG:"service=${service}" dauco


# In order to use our PostGIS import, we include some standard
# configuration file. This is pulled from a specific version, as a
Expand All @@ -30,6 +58,6 @@ configure.mk:
wget ${gist}/raw/e30543c3b8d8ff18a950750a0f340788cc8c1931/configure.mk

# Some convience functions for testing and repreoducing
clean:
rm -rf configure.mk shp geojson
dist-clean:
rm -rf configure.mk shp *.geojson

645 changes: 645 additions & 0 deletions dauco.geojson

Large diffs are not rendered by default.

Binary file added shp/dauco.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions shp/dauco.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["NAD83_California_Albers",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Albers"],PARAMETER["standard_parallel_1",34],PARAMETER["standard_parallel_2",40.5],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-120],PARAMETER["false_easting",0],PARAMETER["false_northing",-4000000],UNIT["Meter",1]]
Binary file added shp/dauco.shp
Binary file not shown.
Binary file added shp/dauco.shx
Binary file not shown.
14 changes: 7 additions & 7 deletions src/daus.vrt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<OGRVRTLayer name="detailed_analysis_units">
<SrcDataSource relativeToVRT="1">dau_2012.shp</SrcDataSource>
<SrcLayer>dau_2012</SrcLayer>
<Field name="dau_code" src="DAU_CODE" type="STRING"/>
<Field name="dau_name" src="DAU_NAME" type="STRING"/>
<Field name="psa_code" src="PSA_CODE" type="STRING"/>
<Field name="psa_name" src="PSA_NAME" type="STRING"/>
<Field name="hr_code" src="HR_CODE" type="STRING"/>
<Field name="hr_name" src="HR_NAME" type="STRING"/>
<Field name="duaid_code" src="DAUID_CODE" type="STRING"/>
<Field name="dau_code" src="DAU_CODE" type="String"/>
<Field name="dau_name" src="DAU_NAME" type="String"/>
<Field name="psa_code" src="PSA_CODE" type="String"/>
<Field name="psa_name" src="PSA_NAME" type="String"/>
<Field name="hr_code" src="HR_CODE" type="String"/>
<Field name="hr_name" src="HR_NAME" type="String"/>
<Field name="duaid_code" src="DAUID_CODE" type="String"/>
<Field name="pa_no" src="PA_NO" type="Integer"/>
</OGRVRTLayer>
<TargetSRS>epsg:3310</TargetSRS>
Expand Down

0 comments on commit eed151b

Please sign in to comment.