Giter Club home page Giter Club logo

redistricter's Introduction

DEPENDENCIES:
	C++ compiler
	Java 2.5+
	Python 2.4+
	png library
	zlib compression library
	google protocol buffers
	http://code.google.com/p/protobuf/ *

BUILDING:	

There's no ./configure because autoconf is hard. :-(

Instead, Makefile includes makeopts/`uname`.pre early on to set variables. See the Darwin and Linux examples.

So, if you're lucky, all you have to do is:
	make

There is no `make install` because this is a tool for an experimenter. The binaries just live here where they're compiled.

If you want to leave makeopts/* alone, create a file localvars.make which gets included after that and before anything else. A good place to put your own settings.

## MAC OS Notes:
makeopts/Darwin.pre
	Defaults to compiling for ppc (32 bit) and x86_64. For development it's probably better to pick just your architecture and enable the -MMD flag which emits good dependency information that gnumake can use.

RUNNING:

Make a directory, which I traditionally call "data", to hold the Census data.
./setupstatedata.py ga

The 'runallstates.py' script can be used to repeatedly run one or more states.
./runallstates.py --port=8080 ga

The --port argument is optional, but runs a handy HTTP server on that port (e.g. http://localhost:8080/ ) which nicely displays status and results.

Lots of other options are available on both ./setupstatedata.py and ./runallstates.py and there is --help available for them.

---
* Setting up protobuf
# Here's the cheat sheet for building this quickly.
# On Mac, one of these (bash syntax):
CXXFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64' ./configure --enable-dependency-tracking=no
CXXFLAGS='-arch i386 -arch x86_64' ./configure --enable-dependency-tracking=no
# Otherwise just:
./configure

# then build, C, Java, and optionally python
make
make check
sudo make install
cd java/src/main
mkdir classes
cd java
protoc --proto_path=../../../../src ../../../../src/google/protobuf/descriptor.proto --java_out=.
find . -name \*.java | xargs javac -d ../classes
cd ../../..
jar cvf protobuf.jar -C src/main/classes com
## or you can use maven
#cd java
#mvn test
#mvn install
#mvn package
cd ../python
python setup.py test
python setup.py install

redistricter's People

Contributors

brianolson avatar

redistricter's Issues

Whole-USA redistricting

Dropping all the state lines, split the USA into 50 or 100 or 435 districts.

The hard part: connecting geographic data of adjoining states. It'll be an 
annoying merge operation to find all the matching tiny edge pieces. Then, write 
out one giant merged geometry file and node adjacency and so on.

Original issue reported on code.google.com by brian.olson on 13 Jun 2014 at 6:22

No rule to make target 'uf1.o' needed by 'uf1data'. Stop.

g++ -g -Wall -Itiger -MMD fileio.o Bitmap.o tiger/mmaped.o Solver.o
District2.o PreThread.o renderDistricts.o LinearInterpolate.o
GrabIntermediateStorage.o AbstractDistrict.o DistrictSet.o
NearestNeighborDistrictSet.o rtaToDsz.o tiger/recordA.o -lpthread -lpng12
-lz -o rta2dsz
make: *** No rule to make target `uf1.o', needed by `uf1data'.  Stop.

Original issue reported on code.google.com by [email protected] on 3 Apr 2008 at 3:45

New Hampshire's 400 districts

Districts only use 1 byte, allowing for 254 or so of them. Use two bytes, allow 
New Hampshire to work.

Original issue reported on code.google.com by brian.olson on 16 Apr 2012 at 3:53

road contiguity

Blocks connected by roads are better than blocks that just happen to be 
adjacent. Maybe most noticable around rivers or coastal islands. 
Water-discontiguity is probably available in the data already processed and 
road-contiguity is probably available in Census map files.

Original issue reported on code.google.com by brian.olson on 10 Feb 2015 at 7:09

Polar Warp

Improvement: warp latitudes and longitudes onto a polar projection centered 
over the center of the state. Regularize dimensions to X,Y integer millimeters 
around some 0,0 center.
This will improve dimensional accuracy in all states, more so the northern 
ones, and should fix Alaska's -180/180 wraparound problem.

Original issue reported on code.google.com by brian.olson on 16 Apr 2012 at 3:49

  • Blocking: #6

Alaska breaks at -180/180 degrees latitude

Alaska is broken. Treating lon/lat as X/Y really doesn't work there. Find a 
center lat-lon and do a polar projection that mostly preserves linear distances.
Then, do that for all the states.

Original issue reported on code.google.com by brian.olson on 4 Jun 2014 at 4:58

  • Blocked on: #2

merge election data to project future results

Find sources of precinct level election results data. Translate precincts to 
their census blocks. Distribute votes per census block. Sum up per-census-block 
votes into new map block assignments.

Original issue reported on code.google.com by brian.olson on 5 Jun 2014 at 11:27

keep-together-regions, do-not-cross lines

Create 'keep together regions' which, if not wholly in one district, the 
population in that district counts as some adjustment further away from the 
center of their districts.
 (auto populate these from census city and metro-area and county regions)
Create 'do not cross lines' which, if they bisect a district, the population on 
the far side of the line counts as some adjustment further away from the center 
of the district.

Original issue reported on code.google.com by brian.olson on 16 Apr 2012 at 3:52

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.