├── __init__.py ├── svg_map ├── __init__.py ├── wisconsin │ ├── wisconsin.shp │ ├── wisconsin.shx │ ├── wisconsin.dbf │ ├── wisconsin.prj │ └── wisconsin.qpj ├── wisconsin_counties │ ├── tl_2010_55_county10.shp │ ├── tl_2010_55_county10.shx │ ├── tl_2010_55_county10.prj │ ├── tl_2010_55_county10.dbf │ └── tl_2010_55_county10.shp.xml ├── wisconsin_interstates │ ├── wisconsin_interstates.dbf │ ├── wisconsin_interstates.shp │ ├── wisconsin_interstates.shx │ ├── wisconsin_interstates.prj │ └── wisconsin_interstates.qpj ├── wisconsin_bigger_cities │ ├── wisconsin_bigger_cities.shp │ ├── wisconsin_bigger_cities.shx │ ├── wisconsin_bigger_cities.prj │ ├── wisconsin_bigger_cities.qpj │ └── wisconsin_bigger_cities.dbf ├── views.py ├── load.py ├── wisconsin_pop_data │ └── all_050_in_55.P1.csv ├── models.py └── svgmap.py ├── templates ├── population.json ├── svg.json ├── basiclayermap.html └── choropleth.html ├── manage.py ├── urls.py ├── README.textile ├── settings.py ├── env_settings.py.example └── static └── js ├── basic-layer-map.js ├── choropleth-map.js ├── modernizr-1.5.min.js └── raphael-2.0.2-min.js /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /svg_map/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /svg_map/wisconsin/wisconsin.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin/wisconsin.shp -------------------------------------------------------------------------------- /svg_map/wisconsin/wisconsin.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin/wisconsin.shx -------------------------------------------------------------------------------- /svg_map/wisconsin/wisconsin.dbf: -------------------------------------------------------------------------------- 1 | _ a W STATE C STATE_FIPS C Wisconsin 55 -------------------------------------------------------------------------------- /svg_map/wisconsin_counties/tl_2010_55_county10.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin_counties/tl_2010_55_county10.shp -------------------------------------------------------------------------------- /svg_map/wisconsin_counties/tl_2010_55_county10.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin_counties/tl_2010_55_county10.shx -------------------------------------------------------------------------------- /svg_map/wisconsin_interstates/wisconsin_interstates.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin_interstates/wisconsin_interstates.dbf -------------------------------------------------------------------------------- /svg_map/wisconsin_interstates/wisconsin_interstates.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin_interstates/wisconsin_interstates.shp -------------------------------------------------------------------------------- /svg_map/wisconsin_interstates/wisconsin_interstates.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin_interstates/wisconsin_interstates.shx -------------------------------------------------------------------------------- /svg_map/wisconsin_bigger_cities/wisconsin_bigger_cities.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin_bigger_cities/wisconsin_bigger_cities.shp -------------------------------------------------------------------------------- /svg_map/wisconsin_bigger_cities/wisconsin_bigger_cities.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cirlabs/svg_mapper/HEAD/svg_map/wisconsin_bigger_cities/wisconsin_bigger_cities.shx -------------------------------------------------------------------------------- /svg_map/wisconsin/wisconsin.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /svg_map/wisconsin_counties/tl_2010_55_county10.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /svg_map/wisconsin_interstates/wisconsin_interstates.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /svg_map/wisconsin_bigger_cities/wisconsin_bigger_cities.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /svg_map/wisconsin/wisconsin.qpj: -------------------------------------------------------------------------------- 1 | GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]] 2 | -------------------------------------------------------------------------------- /svg_map/wisconsin_interstates/wisconsin_interstates.qpj: -------------------------------------------------------------------------------- 1 | GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]] 2 | -------------------------------------------------------------------------------- /svg_map/wisconsin_bigger_cities/wisconsin_bigger_cities.qpj: -------------------------------------------------------------------------------- 1 | GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]] 2 | -------------------------------------------------------------------------------- /templates/population.json: -------------------------------------------------------------------------------- 1 | { 2 | "counties":[ 3 | {% for c in county_list %}{ 4 | "id":"{{ c.countyfps }}", 5 | "name":"{{ c.name }}", 6 | "pop2010":{{ c.pop_2010 }}, 7 | "pop2000":{{ c.pop_2000 }}, 8 | "popchange":{{ c.pop_change }}, 9 | "poppctchange":{{ c.pop_pct_change }} 10 | }{% if not forloop.last %},{% else %}{% endif %}{% endfor %} 11 | ] 12 | } -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from django.core.management import execute_manager 3 | import imp 4 | try: 5 | imp.find_module('settings') # Assumed to be in the same directory. 6 | except ImportError: 7 | import sys 8 | sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) 9 | sys.exit(1) 10 | 11 | import settings 12 | 13 | if __name__ == "__main__": 14 | execute_manager(settings) 15 | -------------------------------------------------------------------------------- /templates/svg.json: -------------------------------------------------------------------------------- 1 | { 2 | "viewbox": [{{ viewbox.x }}, {{ viewbox.y }}, {{ viewbox.width }}, {{ viewbox.height }}], 3 | "layers":[ 4 | {% for l in map_layers %}{ 5 | "layerid":"{{ l.identifier }}", 6 | "type":"{{ l.type }}", 7 | "geometries": [{% for p in l.geometries %} 8 | { 9 | "id": "{{ p.id }}", 10 | {% if l.type != 'point' %}"svgstring": "{{ p.svgstring }}"{% else %}"svgpoint": {{ p.svgpoint }}{% endif %} 11 | }{% if not forloop.last %},{% else %}{% endif %} 12 | {% endfor %}] 13 | }{% if not forloop.last %},{% else %}{% endif %}{% endfor %} 14 | ] 15 | } -------------------------------------------------------------------------------- /templates/basiclayermap.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | ##### # # ##### # #
2 | # # # # # # ## ## ## ##### ##### ###### #####
3 | # # # # # # # # # # # # # # # # #
4 | ##### # # # #### # # # # # # # # # ##### # #
5 | # # # # # # # ###### ##### ##### # #####
6 | # # # # # # # # # # # # # # #
7 | ##### # ##### # # # # # # ###### # #
8 |
9 | Python code for converting GeoDjango features into 0-referenced SVG strings for vector-based mapping. The code is designed to work with Raphael JS (http://raphaeljs.com) -- because Raphael provides fairly robust VML backup code for legacy Internet Explorer browsers -- but can be used without Raphael as well if you want to use other libraries.
10 |
11 | e){if(c&&!l.start){m=cg(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cg(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},ci=ch(1),cj=ch(),ck=ch(0,1);a.getTotalLength=ci,a.getPointAtLength=cj,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return ck(a,b).end;var d=ck(a,c,1);return b?ck(d,b).end:d},b_.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return ci(this.attrs.path)}},b_.getPointAtLength=function(a){if(this.type=="path")return cj(this.attrs.path,a)},b_.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var cl=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};cl.easeIn=cl["ease-in"]=cl["<"],cl.easeOut=cl["ease-out"]=cl[">"],cl.easeInOut=cl["ease-in-out"]=cl["<>"],cl["back-in"]=cl.backIn,cl["back-out"]=cl.backOut;var cm=[],cn=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},co=function(){var b=+(new Date),c=0;for(;c