-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #584 from datamade/2.5
Upgrade LA Metro to Councilmatic 2.5
- Loading branch information
Showing
74 changed files
with
1,568 additions
and
1,575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
GENERATED_FILES=councilmatic_core_event.csv councilmatic_core_person.csv | ||
|
||
all : $(GENERATED_FILES) | ||
|
||
clean : | ||
rm $(GENERATED_FILES) || : | ||
|
||
councilmatic_core_event.csv : | ||
ssh [email protected] " \ | ||
psql -U postgres -d lametro -c \" \ | ||
COPY ( \ | ||
SELECT name, start_time, slug \ | ||
FROM councilmatic_core_event \ | ||
) TO STDOUT WITH CSV HEADER\"" > $@ | ||
|
||
councilmatic_core_person.csv : | ||
ssh [email protected] " \ | ||
psql -U postgres -d lametro -c \" \ | ||
COPY ( \ | ||
SELECT name, slug \ | ||
FROM councilmatic_core_person \ | ||
) TO STDOUT WITH CSV HEADER\"" > $@ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
all : boundary.geojson | ||
|
||
boundary.geojson : boundary_full_precision.geojson | ||
ogr2ogr -lco COORDINATE_PRECISION=5 $@ $< | ||
|
||
.INTERMEDIATE: boundary_full_precision.geojson | ||
boundary_full_precision.geojson : supervisory_districts.geojson \ | ||
city_of_la.geojson long_beach.geojson \ | ||
southwest_corridor.geojson san_fernando.geojson \ | ||
san_gabriel.geojson | ||
python scripts/combine.py $^ | \ | ||
python scripts/add_districts.py > $@ | ||
|
||
%.geojson : %.json | ||
cat $< | python scripts/ocd2geojson.py $* > $@ | ||
|
||
supervisory_districts.json : | ||
wget -O $@ https://ocd.datamade.us/boundaries/la-metro-supervisory-districts/shape | ||
|
||
city_of_la.json : | ||
wget -O $@ wget -O $@ https://ocd.datamade.us/boundaries/city-of-la/shape | ||
|
||
long_beach.json : | ||
wget -O $@ https://ocd.datamade.us/boundaries/la-metro-committee-districts/la-metro-committee-district-southeast_long_beach/shape | ||
|
||
southwest_corridor.json : | ||
wget -O $@ https://ocd.datamade.us/boundaries/la-metro-committee-districts/la-metro-committee-district-southwest_corridor/shape | ||
|
||
san_fernando.json : | ||
wget -O $@ https://ocd.datamade.us/boundaries/la-metro-committee-districts/la-metro-committee-district-north_county_san_fernando_valley/shape | ||
|
||
san_gabriel.json : | ||
wget -O $@ https://ocd.datamade.us/boundaries/la-metro-committee-districts/la-metro-committee-district-san_gabriel_valley/shape | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
This directory contains a `boundary.geojson` file and the Makefile and associated scripts used to created it. | ||
|
||
You'll use the geojson file to load in shapes of districts with | ||
|
||
`python manage.py import_shapes data/boundary.geojson` | ||
|
||
|
||
You shouldn't need to rerun the Makefile, but keep it for historical | ||
reference. | ||
|
||
This Makefile currently depends on pulling data from DataMade's legacy | ||
OCD API. In the future, if boundary changes, we won't put the data | ||
into the that API at all, but will more create an updated | ||
`boundary.geojson` file much more directly. | ||
|
||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import sys | ||
import json | ||
|
||
DIVISION = {'la-metro-supervisory-district-1': 'ocd-division/country:us/state:ca/county:los_angeles/council_district:1', | ||
'la-metro-supervisory-district-2': 'ocd-division/country:us/state:ca/county:los_angeles/council_district:2', | ||
'la-metro-supervisory-district-3': 'ocd-division/country:us/state:ca/county:los_angeles/council_district:3', | ||
'la-metro-supervisory-district-4': 'ocd-division/country:us/state:ca/county:los_angeles/council_district:4', | ||
'la-metro-supervisory-district-5': 'ocd-division/country:us/state:ca/county:los_angeles/council_district:5', | ||
'Los Angeles': 'ocd-division/country:us/state:ca/place:los_angeles', | ||
'long_beach': 'ocd-division/country:us/state:ca/county:los_angeles/la_metro_sector:southeast_long_beach', | ||
'southwest_corridor': 'ocd-division/country:us/state:ca/county:los_angeles/la_metro_sector:southwest_corridor', | ||
'san_fernando': 'ocd-division/country:us/state:ca/county:los_angeles/la_metro_sector:north_county_san_fernando_valley', | ||
'san_gabriel': 'ocd-division/country:us/state:ca/county:los_angeles/la_metro_sector:san_gabriel_valley', | ||
} | ||
|
||
geojson = json.load(sys.stdin) | ||
|
||
for feature in geojson['features']: | ||
name = feature['properties']['name'] | ||
feature['properties']['division_id'] = DIVISION[name] | ||
|
||
json.dump(geojson, sys.stdout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sys | ||
import json | ||
|
||
geojson = {'type': "FeatureCollection", | ||
'features': []} | ||
|
||
for file_name in sys.argv[1:]: | ||
with open(file_name) as f: | ||
sub_geojson = json.load(f) | ||
geojson['features'].extend(sub_geojson['features']) | ||
|
||
json.dump(geojson, sys.stdout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import sys | ||
import json | ||
|
||
ocd_map = json.load(sys.stdin) | ||
geojson = {'type': "FeatureCollection", | ||
'features': []} | ||
|
||
name = sys.argv[1] | ||
|
||
try: | ||
for obj in ocd_map['objects']: | ||
feature = {'type': "Feature"} | ||
feature['geometry'] = obj['shape'] | ||
feature['properties'] = {'name': obj['name']} | ||
geojson['features'].append(feature) | ||
except KeyError: | ||
feature = {'type': "Feature"} | ||
feature['geometry'] = ocd_map | ||
feature['properties'] = {'name': name} | ||
geojson['features'].append(feature) | ||
|
||
json.dump(geojson, sys.stdout) |
Oops, something went wrong.