-
Notifications
You must be signed in to change notification settings - Fork 0
Look up congressional districts client-side using only JavaScript and static files.
License
ianh/district-tiler
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Need to turn long/lat points into US congressional districts? Copy the 'tiles' directory into your web site and use the following code: <script src="tiles/lookup.js"></script> <script> lookupDistrict(longitude, latitude, function (found, state, district) { if (found === "found") { // ... } }); </script> Calling lookupDistrict() finds the proper tile in the 'tiles' directory, then tests each polygonal district in the tile until it finds one containing the query point. No requests are made to any service -- the tile data are hosted as as static files. To re-generate the 'tiles' directory, compile and run main.go. It takes as input a shapefile of congressional districts (available from the US Census Bureau at http://www.census.gov/geo/maps-data/data/tiger-line.html) and slices it up into tiles. These tiles are adaptively sized and indexed using a k-d tree -- see the code for details.
About
Look up congressional districts client-side using only JavaScript and static files.
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published