Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Created September 18, 2012 05:24
Show Gist options
  • Select an option

  • Save wboykinm/3741418 to your computer and use it in GitHub Desktop.

Select an option

Save wboykinm/3741418 to your computer and use it in GitHub Desktop.
Config file for BTV DB
<!-- The application element that contains all other elements. -->
<DistrictBuilder>
<!-- Define legislative bodies referenced in the system. -->
<LegislativeBodies>
<!-- A Legislative body has an ID (for referencing in GeoLevel
definitions later), a name, and a label for plan items
("District" for Council, etc) -->
<LegislativeBody id="council" name="Burlington City Council" member="Ward %s" maxdistricts="7"/>
</LegislativeBodies>
<!-- A list of subjects referenced in the system. -->
<Subjects>
<!-- A Subject is a measurement type, such as "Total Population".
The subject is mapped to an attribute during the import phase,
and contains a long and short display name. Subjects have IDs
for referencing in GeoLevel definitions later. -->
<Subject id="poptot" field="totalpop" name="Total Population"
short_name="Total Pop." displayed="true" sortkey="1" />
<!-- You can alias a subject by overriding the field, if the
import shapefiles have different field names at different
geographic levels. -->
<!-- <Subject id="pophisp1" field="POPHISP" aliasfor="pophisp"/> -->
</Subjects>
<Targets>
<Target id="council_target" subjectref="poptot" value="6060" range1="0.05" range2="0.1" />
</Targets>
<Scoring>
<ScoreFunctions>
<!-- A district score that returns a literal value -->
<ScoreFunction id="district_poptot" type="district"
calculator="publicmapping.redistricting.calculators.Sum"
label="Total Pop" user_selectable="true">
<SubjectArgument name="value1" ref="poptot" />
</ScoreFunction>
<!-- A district score that generates classes based on a couple
ranges around a mean value. -->
<ScoreFunction id="district_poptot_uitarget_council" type="district"
calculator="publicmapping.redistricting.calculators.Target">
<SubjectArgument name="value" ref="poptot" />
<Argument name="target" value="6060" />
<Argument name="range1" value="0.05"/>
<Argument name="range2" value="0.10"/>
</ScoreFunction>
<!-- A district score that returns 1(T) if the subject value
is between the ranges, otherwise returns 0(F). -->
<ScoreFunction id="district_poptot_range" type="district"
calculator="publicmapping.redistricting.calculators.Range"
label="Tot Pop Range">
<SubjectArgument name="value" ref="poptot" />
<Argument name="min" value="5757" />
<Argument name="max" value="6363" />
</ScoreFunction>
<!-- A custom calculator to calculate compactness, and return
the raw compactness score. -->
<ScoreFunction id="district_schwartzberg" type="district"
calculator="publicmapping.redistricting.calculators.Schwartzberg"
label="Compactness" user_selectable="true">
</ScoreFunction>
<!-- A custom calculator to do contiguity, and is boolean. -->
<ScoreFunction id="district_contiguous" type="district"
calculator="publicmapping.redistricting.calculators.Contiguity"
label="Contiguous" user_selectable="true">
</ScoreFunction>
<!-- A plan score that aggregates all literal values -->
<ScoreFunction id="plan_sum_equipop" type="plan"
calculator="publicmapping.redistricting.calculators.Sum"
label="Equal Population">
<ScoreArgument name="value1" ref="district_poptot_range" />
</ScoreFunction>
<ScoreFunction id="plan_all_equipop" type="plan"
calculator="publicmapping.redistricting.calculators.Threshold" >
<ScoreArgument name="value" ref="plan_sum_equipop" />
<Argument name="threshold" value="0" />
</ScoreFunction>
<!-- A plan score that evaluates a threshold, and returns T/F.
This plan score checks that all districts are within the
population limits. -->
<ScoreFunction id="plan_poptot_inrange" type="plan"
calculator="publicmapping.redistricting.calculators.Threshold">
<ScoreArgument name="value" ref="district_poptot_range" />
<Argument name="threshold" value="0" />
</ScoreFunction>
<!-- A plan score that evaluates all districts, and returns
1(T) if there is more than 0 districts that have a minority
majority. -->
<ScoreFunction id="plan_contiguous" type="plan"
calculator="publicmapping.redistricting.calculators.Sum"
label="Contiguous">
<ScoreArgument name="value1" ref="district_contiguous"/>
</ScoreFunction>
<ScoreFunction id="b_plan_council_noncontiguous" type="plan"
calculator="publicmapping.redistricting.calculators.Contiguity"
label="Contiguous">
<Argument name="target" value="11" />
</ScoreFunction>
<!-- interval score function for population -->
<ScoreFunction id="a_council_population" type="district"
label="Tot Pop" user_selectable="true"
description="Population interval calculator for council."
calculator="publicmapping.redistricting.calculators.Interval">
<SubjectArgument name="subject" ref="poptot" />
<Argument name="target" value="6060" />
<Argument name="bound1" value=".05" />
<Argument name="bound2" value=".1" />
</ScoreFunction>
<!-- leaderboard functions -->
<ScoreFunction id="a_council_plan_count_districts" type="plan"
calculator="publicmapping.redistricting.calculators.CountDistricts"
label="Count Districts"
description="The number of districts in a Council redistricting plan must be 7.">
<Argument name="target" value="7" />
</ScoreFunction>
<ScoreFunction id="a_council_plan_equipopulation_validation" type="plan"
calculator="publicmapping.redistricting.calculators.Equipopulation"
label="Target Pop. (6,060)"
description="The population of each ward must be 6,060 +/- 0.5%.">
<Argument name="min" value="5757"/>
<Argument name="max" value="6363"/>
<SubjectArgument name="value" ref="poptot"/>
<Argument name="validation" value="1"/>
</ScoreFunction>
<ScoreFunction id="a_council_plan_equipopulation_summary" type="plan"
calculator="publicmapping.redistricting.calculators.Equipopulation"
label="Target Pop. (6,060)"
description="The population of each ward must be 6,060 +/- 0.5%.">
<Argument name="min" value="5757"/>
<Argument name="max" value="6363"/>
<SubjectArgument name="value" ref="poptot"/>
<Argument name="target" value="11"/>
</ScoreFunction>
<ScoreFunction id="plan_all_contiguous" type="plan"
calculator="publicmapping.redistricting.calculators.AllContiguous"
label="All Contiguous"
description="Contiguity means that every part of a district must be reachable from every other part without crossing the district&apos;s borders. All districts within a plan must be contiguous. Water contiguity is permitted given Burlington&apos;s extensive waterfront. &apos;Point contiguity&apos; or &apos;touch-point contiguity&apos; where two sections of a district are connected at a single point is not permitted.">
</ScoreFunction>
<ScoreFunction id="plan_equivalence" type="plan"
calculator="publicmapping.redistricting.calculators.Equivalence"
label="Equal Population"
description="The Equipopulation score is the difference between the district with the highest population and the district with the lowest population.">
<SubjectArgument name="value" ref="poptot" />
</ScoreFunction>
<ScoreFunction id="plan_schwartzberg" type="plan"
calculator="publicmapping.redistricting.calculators.Schwartzberg"
label="Average Compactness"
description="The competition is using the &apos;Schwartzberg&apos; compactness measure. This measure is a ratio of the perimeter of the district to the circumference of the circle whose area is equal to the area of the district." >
</ScoreFunction>
</ScoreFunctions>
<ScorePanels>
<ScorePanel id="panel_equipop_all" type="plan" position="1"
title="Equipopulation" template="leaderboard_panel_all.html">
<Score ref="plan_equivalence" />
</ScorePanel>
<ScorePanel id="panel_equipop_mine" type="plan" position="1"
title="Equipopulation" template="leaderboard_panel_mine.html">
<Score ref="plan_equivalence" />
</ScorePanel>
<ScorePanel id="panel_compact_all" type="plan" position="2"
title="Schwartzberg" template="leaderboard_panel_all.html">
<Score ref="plan_schwartzberg" />
</ScorePanel>
<ScorePanel id="panel_compact_mine" type="plan" position="2"
title="Schwartzberg" template="leaderboard_panel_mine.html">
<Score ref="plan_schwartzberg" />
</ScorePanel>
<!-- Summary above all sidebar panels -->
<ScorePanel id="council_panel_summary" type="plan_summary" position="1"
title="Plan Summary" cssclass="plan_summary council" template="plan_summary.html">
<Score ref="a_council_plan_equipopulation_summary"/>
<Score ref="b_plan_council_noncontiguous"/>
</ScorePanel>
<!-- Basic Information -->
<ScorePanel id="council_panel_info" type="district" position="2"
title="Basic Information" cssclass="district_basic_info council"
template="basic_information.html">
<Score ref="a_council_population" />
<Score ref="district_contiguous" />
<Score ref="district_schwartzberg" />
</ScorePanel>
</ScorePanels>
<ScoreDisplays>
<ScoreDisplay legislativebodyref="council" type="leaderboard"
title="Council Leaderboard - All" cssclass="leaderboard council">
<ScorePanel ref="panel_equipop_all" />
<ScorePanel ref="panel_compact_all" />
</ScoreDisplay>
<ScoreDisplay legislativebodyref="council" type="leaderboard"
title="Council Leaderboard - Mine" cssclass="leaderboard council">
<ScorePanel ref="panel_equipop_mine" />
<ScorePanel ref="panel_compact_mine" />
</ScoreDisplay>
<!-- Sidebar configuration -->
<ScoreDisplay legislativebodyref="council" type="sidebar" title="Basic Information" cssclass="basic_information">
<ScorePanel ref="council_panel_summary" />
<ScorePanel ref="council_panel_info" />
</ScoreDisplay>
<ScoreDisplay legislativebodyref="council" type="sidebar" title="Demographics" cssclass="demographics">
<ScorePanel ref="council_panel_summary" />
<ScorePanel ref="council_panel_demo" />
</ScoreDisplay>
</ScoreDisplays>
</Scoring>
<Validation>
<Criteria legislativebodyref="council">
<Criterion name="Equipopulation - Council"
description="&lt;p&gt;Your plan does not meet the competition criteria for Equipopulation:&lt;/p&gt;&lt;p&gt;The population of each Council district must be 6,060 +/- 0.5%.&lt;/p&gt;">
<Score ref="a_council_plan_equipopulation_validation" />
</Criterion>
<Criterion name="AllContiguous - Council"
description="&lt;p&gt;Your plan does not meet the competition criteria for Contiguity&lt;/p&gt;&lt;p&gt;Every part of a district must be reachable from every other part without crossing the district's borders. All districts within a plan must be contiguous. Water contiguity is permitted given Virginia's extensive coastal region. 'Point contiguity' or 'touch-point contiguity' where two sections of a district are connected at a single point is not permitted.&lt;/p&gt;">
<Score ref="plan_all_contiguous" />
</Criterion>
<Criterion name="CountDistricts - Council" description="">
<Score ref="a_council_plan_count_districts" />
</Criterion>
<Criterion name="AllBlocksAssigned - Council" description="">
<Score ref="plan_all_blocks_assigned" />
</Criterion>
</Criteria>
</Validation>
<GeoLevels>
<GeoLevel id="block" name="block" min_zoom="8" sort_key="3" tolerance="2.5">
<!--
You may use EITHER the "Shapefile" or "Files" element as a child
of geolevel to define the geography and attributes. The
"Shapefile" element must contain both the geography and
attributes, whereas the "Files" element contains an item for the
geography, and multiple items for the attributes.
This is in anticipation of loading data that has been downloaded
directly from the American Fact Finder web application hosted by
the US Census Beureau.
-->
<Shapefile path="/projects/publicmapping/data/btv_blocks.shp">
<Fields>
<!--
Each Field item defines a field in the shapefile that
describes a different part of the geographic unit.
A "name" type field is used to display the name of the
geographic unit.
A "portable" type field is used to store the FIPS/GEOID
of the geographic unit, which is shared with other GIS
systems.
A "tree" type field is used to store information about
the geography, and where it resides in the tree. This type
of field requires a "pos" attribute, which declares which
position in the tree the field belongs (starting at 0);
a "width" attribute is also required to declare how wide
this portion of the tree code is. This is helpful when
the treecode may not be zero padded.
-->
<Field name="NAME10" type="name"/>
<Field name="GEOID10" type="portable"/>
<Field name="STATEFP10" type="tree" pos="0" width="2"/>
<Field name="COUNTYFP10" type="tree" pos="1" width="3"/>
<Field name="GEOID10" type="tree" pos="3" width="14"/>
</Fields>
</Shapefile>
<!--
A reference to the subjects for which attribute data is
available at this geolevel.
-->
<GeoLevelCharacteristics>
<GeoLevelCharacteristic ref="totalpop" />
</GeoLevelCharacteristics>
<!--
A reference to a legislative body. A geolevel may be used by
many legislative bodies.
-->
<LegislativeBodies>
<LegislativeBody ref="council">
<LegislativeTargets>
<LegislativeTarget ref="council_target" default="true" />
</LegislativeTargets>
</LegislativeBody>
</LegislativeBodies>
</GeoLevel>
<!--
A child geolevel. The geography of the parent geolevel must
be coincident in its child.
-->
</GeoLevels>
<!--
This element facilitates the creation of system templates. A
system template is a plan owned by the admin user, that all other
users can create derivative plans from.
-->
<Templates>
<Template name="Council">
<!-- A reference to a legislative body. -->
<LegislativeBody ref="council"/>
<!--
The path to the district index file. The index file must be
a two column CSV file, with each row corresponding to 1) a
unit of geography, and 2) the district it belongs to.
-->
<Blockfile path="/projects/publicmapping/data/btv_index.csv" />
</Template>
</Templates>
<!--
Configuration settings for the components of the application. The
"root" attribute defines the location in the file system, under
which the rest of the application components can be found.
-->
<Project root="/projects/publicmapping/trunk" sessionquota="5"
sessiontimeout="15">
<!--
Database connection information.
If you change the user to something different than
'publicmapping', you will have to define a schema in
postgresql by the same name as the user.
The 'host' attribute is optional.
-->
<Database name="" user="publicmapping" password="" host=""/>
<!--
Administrative user information. This will create an administrative
superuser in django with these credentials.
-->
<Admin user="jethro" email="vtcraghead@gmail.com" password="queencity"/>
<!-- Configuration items specific to the redistricting app. -->
<Redistricting>
<!--
Information about the mapserver and geoserver settings.
The "basemaps" attribute is optional, and can be any set to
any combination (CSV) of the following:
osm-road
google-road
google-aerial
google-hybrid
bing-road
bing-aerial
bing-hybrid
The options are displayed in the order in which they are set,
with the first one being set to the default base layer. If
this is not set, it will default to osm-road. If the desire
is to have no base layer, set it to the empty string.
-->
<MapServer hostname="" ns="gmu" nshref="http://gmu.azavea.com/"
adminuser="" adminpass="" maxfeatures="100"
styles="/projects/publicmapping/trunk/sld" />
<!--
Use a GoogleAnalytics account to tract the usage of the
application. This requires an account and domain.
<GoogleAnalytics account="" domain=""/>
-->
<!-- Upload file size restrictions. This is in KB -->
<Upload maxsize="5300"/>
</Redistricting>
<!--
Configure the engine used for reporting. Currently, BARD is the
only supported reporting engine.
-->
<Reporting>
<!-- BARD specific configuration settings. -->
<BardConfigs>
<!--
The BARD configuration.
The "shape" attribute defines where the precomputed BARD
map is located.
The "temp" attribute is the location where temporary reports
should be stored.
The "transform" attribute is the location of the XSLT
transform that generates the HTML content in the reporting
tab.
The "server" attribute is the optional URL of another
server that runs BARD reports for this web site.
E.G., 'http://reporting.server.com'. Leave off the trailing
slash.
NOTE: it is important that all subjectref attributes of the
"...Var" elements below match attributes of the original
block shapefile from which the BARD map is derived.
-->
<BardConfig
id="blocks"
shape="/projects/publicmapping/data/vablock_bard_save.Rdata"
temp="/projects/publicmapping/local/reports"
transform="/projects/publicmapping/trunk/docs/bard_template.xslt">
<PopVars>
<PopVar subjectref="poptot" threshold=".05" default="true" />
</PopVars>
<SplitVars>
<!--
See whether a given district splits a geography.
This can be any higher level geography: a county,
VTd, or tract.
-->
<SplitVar field="COUNTYST10" label="County" />
<SplitVar field="TRACTCE10" label="Tract" />
</SplitVars>
</BardConfig>
</BardConfigs>
<BardBodyConfigs>
<!--
For each legislative body, map the configuration to the
geography used to generate reports.
-->
<BardBodyConfig
id="council_blocks"
legislativebodyref="council"
bardconfigref="blocks" />
</BardBodyConfigs>
</Reporting>
<!-- Information about the mailer configuration. -->
<Mailer server="localhost" port="25" username="" password=""/>
</Project>
</DistrictBuilder>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment