├── __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 | _aWSTATECSTATE_FIPSC 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 | Basic layer map 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Basic layer map

14 |

Choropleth map example

15 |
16 |
17 |
18 | 19 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls.defaults import patterns, include, url 2 | from env_settings import STATIC_SERVE_PATH 3 | 4 | urlpatterns = patterns('', 5 | 6 | url(r'^json/layer-map/$', 'svg_map.views.layer_map_json', name='layer_map_json'), 7 | 8 | url(r'^json/choropleth/$', 'svg_map.views.choropleth_map_json', name='choropleth_map_json'), 9 | 10 | url(r'^choropleth/$', 'svg_map.views.choropleth_html', name='choropleth_html'), 11 | 12 | url(r'^json/county/population/$', 'svg_map.views.related_data_json', name='related_data_json'), 13 | 14 | #url(r'^json/locatormap/(?P[\w-]+)/$', 'svg_map.views.locator_map', name='locator_map'), 15 | 16 | url(r'^$', 'svg_map.views.index', name='index'), 17 | 18 | ) 19 | -------------------------------------------------------------------------------- /templates/choropleth.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | choropleth map 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

choropleth map: WI population change, 2000-2010

14 |

Basic layer map example

15 |
16 |
17 |
18 | 19 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 |
  #####  #     #  #####     #     #                                    
 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 |

Why not tiles?

12 | 13 | TileMill is awesome, but there's plenty of times you don't need tiles -- they're extra overhead, programming, storage and cost if all you want is a simple thematic map. 14 | 15 |

Why SVG?

16 | 17 | <canvas/> can do a most or all of the same visual work, but SVG is DOM, which means you can style it with CSS, access its elements with Javascript, and it's just more real to me than <canvas/>. And if you use Raphael JS (http://raphaeljs.com), you've got pretty darn good legacy Internet Explorer backup without writing additional code. (There's always exceptions, especially when you start adding fonts, but Raphael has good methods for dealing with this intelligently.) 18 | 19 | The repository includes a Django project with sample code for two examples: a basic layer map with polygon, linestring and point layers; and a choropleth map that connects with related data in a separate JSON file. 20 | 21 | A few working examples of slightly older versions of the svg_map.py code: 22 | 23 | (A U.S. map including insets for Alaska and Hawaii) 24 | http://projects.cironline.org/police-grants 25 | 26 | (A statewide California map and smaller locator maps on inside pages) 27 | http://projects.californiawatch.org/broken-shield 28 | 29 | This sample project requires: 30 | 31 | yolk 32 | psycopg2==2.4.2 33 | django==1.3.1 34 | 35 | And GeoDjango, of course. 36 | 37 |

Loading sample project cheatsheet

38 | There's load scripts in the svg_map app to load up all the data you'll need. 39 | 40 | createdb -T template_postgis -O yourusernamehere svg_mapper 41 | python manage.py syncdb 42 | python manage.py shell 43 | 44 | In shell: 45 | from svg_map.load import * 46 | load_all_sample_data() 47 | 48 | That should load up several shapefiles and a related CSV for the examples. 49 | 50 | Then you can run your test server: 51 | 52 | python manage.py runserver 53 | 54 | And find the examples here: 55 | 56 | Basic layer map example: 57 | http://127.0.0.1:8000 58 | 59 | Choropleth map example: 60 | http://127.0.0.1:8000/choropleth -------------------------------------------------------------------------------- /settings.py: -------------------------------------------------------------------------------- 1 | from env_settings import * 2 | 3 | DEBUG = True 4 | TEMPLATE_DEBUG = DEBUG 5 | 6 | ADMINS = ( 7 | # ('Your Name', 'your_email@example.com'), 8 | ) 9 | 10 | MANAGERS = ADMINS 11 | 12 | # Language code for this installation. All choices can be found here: 13 | # http://www.i18nguy.com/unicode/language-identifiers.html 14 | LANGUAGE_CODE = 'en-us' 15 | 16 | # If you set this to False, Django will make some optimizations so as not 17 | # to load the internationalization machinery. 18 | USE_I18N = True 19 | 20 | # If you set this to False, Django will not format dates, numbers and 21 | # calendars according to the current locale 22 | USE_L10N = True 23 | 24 | # List of finder classes that know how to find static files in 25 | # various locations. 26 | STATICFILES_FINDERS = ( 27 | 'django.contrib.staticfiles.finders.FileSystemFinder', 28 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 29 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', 30 | ) 31 | 32 | # Make this unique, and don't share it with anybody. 33 | SECRET_KEY = 'z+n8-mmfgcdjoupp(_w7$$#u0@(l07)n%g0w1w_r75nn7-u4*m' 34 | 35 | # List of callables that know how to import templates from various sources. 36 | TEMPLATE_LOADERS = ( 37 | 'django.template.loaders.filesystem.Loader', 38 | 'django.template.loaders.app_directories.Loader', 39 | # 'django.template.loaders.eggs.Loader', 40 | ) 41 | 42 | MIDDLEWARE_CLASSES = ( 43 | 'django.middleware.common.CommonMiddleware', 44 | 'django.contrib.sessions.middleware.SessionMiddleware', 45 | 'django.middleware.csrf.CsrfViewMiddleware', 46 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 47 | 'django.contrib.messages.middleware.MessageMiddleware', 48 | ) 49 | 50 | ROOT_URLCONF = 'svg_mapper.urls' 51 | 52 | INSTALLED_APPS = ( 53 | 'django.contrib.auth', 54 | 'django.contrib.contenttypes', 55 | 'django.contrib.sessions', 56 | 'django.contrib.sites', 57 | 'django.contrib.messages', 58 | 'django.contrib.staticfiles', 59 | 'django.contrib.gis', 60 | 'svg_map', 61 | # Uncomment the next line to enable the admin: 62 | # 'django.contrib.admin', 63 | # Uncomment the next line to enable admin documentation: 64 | # 'django.contrib.admindocs', 65 | ) 66 | 67 | # A sample logging configuration. The only tangible logging 68 | # performed by this configuration is to send an email to 69 | # the site admins on every HTTP 500 error. 70 | # See http://docs.djangoproject.com/en/dev/topics/logging for 71 | # more details on how to customize your logging configuration. 72 | LOGGING = { 73 | 'version': 1, 74 | 'disable_existing_loggers': False, 75 | 'handlers': { 76 | 'mail_admins': { 77 | 'level': 'ERROR', 78 | 'class': 'django.utils.log.AdminEmailHandler' 79 | } 80 | }, 81 | 'loggers': { 82 | 'django.request': { 83 | 'handlers': ['mail_admins'], 84 | 'level': 'ERROR', 85 | 'propagate': True, 86 | }, 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /env_settings.py.example: -------------------------------------------------------------------------------- 1 | STATIC_SERVE_PATH = '/Path/To/Your/Project/svg_mapper/static' 2 | 3 | ADMIN_MEDIA_STATIC_PATH = '/Path/To/Your/Django/Project/svg_mapper/admin-media' 4 | 5 | DEBUG = True 6 | TEMPLATE_DEBUG = DEBUG 7 | 8 | DATABASES = { 9 | 'default': { 10 | 'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 11 | 'NAME': 'svg_mapper', # Or path to database file if using sqlite3. 12 | 'USER': 'yourdbuser', # Not used with sqlite3. 13 | 'PASSWORD': 'yourdbpassword', # Not used with sqlite3. 14 | 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 15 | 'PORT': '', # Set to empty string for default. Not used with sqlite3. 16 | } 17 | } 18 | 19 | # Local time zone for this installation. Choices can be found here: 20 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 21 | # although not all choices may be available on all operating systems. 22 | # On Unix systems, a value of None will cause Django to use the same 23 | # timezone as the operating system. 24 | # If running in a Windows environment this must be set to the same as your 25 | # system time zone. 26 | TIME_ZONE = 'America/Los_Angeles' 27 | 28 | 29 | # Absolute filesystem path to the directory that will hold user-uploaded files. 30 | # Example: "/home/media/media.lawrence.com/media/" 31 | MEDIA_ROOT = '/Path/To/Your/Django/Project/svg_mapper/media' 32 | 33 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a 34 | # trailing slash. 35 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" 36 | MEDIA_URL = '/media' 37 | 38 | # Absolute path to the directory static files should be collected to. 39 | # Don't put anything in this directory yourself; store your static files 40 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. 41 | # Example: "/home/media/media.lawrence.com/static/" 42 | STATIC_ROOT = '/Path/To/Your/Django/Project/svg_mapper/static-collected' 43 | 44 | # URL prefix for static files. 45 | # Example: "http://media.lawrence.com/static/" 46 | STATIC_URL = '/static' 47 | 48 | # URL prefix for admin static files -- CSS, JavaScript and images. 49 | # Make sure to use a trailing slash. 50 | # Examples: "http://foo.com/static/admin/", "/static/admin/". 51 | ADMIN_MEDIA_PREFIX = '/admin-media/' 52 | 53 | # Additional locations of static files 54 | STATICFILES_DIRS = ( 55 | '/Path/To/Your/Django/Project/svg_mapper/static', 56 | # Put strings here, like "/home/html/static" or "C:/www/django/static". 57 | # Always use forward slashes, even on Windows. 58 | # Don't forget to use absolute paths, not relative paths. 59 | ) 60 | 61 | TEMPLATE_DIRS = ( 62 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". 63 | # Always use forward slashes, even on Windows. 64 | # Don't forget to use absolute paths, not relative paths. 65 | '/Path/To/Your/Django/Project/svg_mapper/templates', 66 | ) 67 | 68 | ROOT_URLCONF = 'svg_mapper.urls' 69 | 70 | SITE_ID = 1 -------------------------------------------------------------------------------- /svg_map/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import get_object_or_404, Http404, render_to_response 2 | from svg_map.models import Wisconsin, WisconsinCity, WisconsinInterstate, WisconsinCounty, WisconsinCountyData 3 | from svg_map.svgmap import * 4 | from django.template import RequestContext 5 | 6 | def index(request): 7 | 8 | return render_to_response('basiclayermap.html', { 9 | }, 10 | context_instance=RequestContext(request)) 11 | 12 | #### view for layer map example #### 13 | def layer_map_json(request): 14 | #Collect your GeoDjango objects 15 | statelist = Wisconsin.objects.all() 16 | city_list = WisconsinCity.objects.all() 17 | road_list = WisconsinInterstate.objects.all() 18 | 19 | themap = SVGMap() 20 | #The width is somewhat arbitrary since this is all vector. If you're using Raphael, you can set whatever width you want at the JS level, so I rarely change this value here. 21 | themap.mapPixelWidth = 1000 22 | themap.paddingPct = 0.01 23 | #How many digits to round your final points to. This will vary slightly with projection. If you round too low, you'll lose detail. If you don't round at all you're just doing extra math for no reason. 24 | themap.sigdigs = 4 25 | 26 | #build layers in the order you'd like to display them. You could override this at the JS level if you wanted to. 27 | #polygon layer 28 | themap.buildSVGPolygonLayer('wi_border', statelist, 'simple_mpoly_utm15n', 'state_fips') 29 | 30 | #polyline layer 31 | themap.buildSVGLinestringLayer('wi_roads', road_list, 'simple_mpoly_utm15n', 'feature') 32 | 33 | #point layer 34 | themap.buildSVGPointLayer('wi_cities', city_list, 'geom_utm15n', 'slug') 35 | 36 | #Get the maximum extent of all layers 37 | viewbox = themap.buildSVGMapViewBox() 38 | #Use the map's extent info to translate all the points to fit inside your pixel width specified above. 39 | map_layers = themap.translateLayers() 40 | 41 | return render_to_response('svg.json', { 42 | 'viewbox': viewbox, 43 | 'map_layers': map_layers, 44 | }, 45 | context_instance=RequestContext(request)) 46 | 47 | #### Views for choropleth example #### 48 | 49 | def choropleth_map_json(request): 50 | statelist = WisconsinCounty.objects.all() 51 | 52 | themap = SVGMap() 53 | themap.mapPixelWidth = 1000 54 | themap.paddingPct = 0.01 55 | themap.sigdigs = 4 56 | 57 | themap.buildSVGPolygonLayer('wi_counties', statelist, 'simple_mpoly_utm15n', 'countyfp10') 58 | 59 | viewbox = themap.buildSVGMapViewBox() 60 | map_layers = themap.translateLayers() 61 | 62 | return render_to_response('svg.json', { 63 | 'viewbox': viewbox, 64 | 'map_layers': map_layers, 65 | }, 66 | context_instance=RequestContext(request)) 67 | 68 | def related_data_json(request): 69 | county_list = WisconsinCountyData.objects.all() 70 | 71 | return render_to_response('population.json', { 72 | 'county_list': county_list, 73 | }, 74 | context_instance=RequestContext(request)) 75 | 76 | def choropleth_html(request): 77 | 78 | return render_to_response('choropleth.html', { 79 | }, 80 | context_instance=RequestContext(request)) 81 | -------------------------------------------------------------------------------- /static/js/basic-layer-map.js: -------------------------------------------------------------------------------- 1 | var strServerRoot = '/'; 2 | 3 | //Set your actual desired final width here. The height will be adjusted based on your map layers. 4 | var numMainMapWidth = 570; 5 | var numMainMapHeight; 6 | var numMapHorizPadding = 75; 7 | var numMapVerticalPadding = 0; 8 | 9 | //Used to translate the SVG dimensions to your desired final width/height, and to scale type or other sizes 10 | var numMainMapScale; 11 | 12 | //Used for holding Raphael stuff 13 | var objMainMap; 14 | var objMainMapSet = {}; 15 | var arrMapSets = []; 16 | 17 | var objLoadElements = {}; 18 | objLoadElements.mainmap = false; 19 | 20 | var objMainMapData = null; 21 | var arrMainMapViewBox = null; 22 | 23 | function getScaleFactor(numPaperWidth,numViewboxWidth) { 24 | var numScaleFactor = numViewboxWidth/numPaperWidth; 25 | return numScaleFactor; 26 | } 27 | 28 | function buildMap(strTargetCanvas) { 29 | var boolAllLoaded = true; 30 | $.each(objLoadElements, function(numK, objV) { 31 | if (objV == false) { 32 | boolAllLoaded = false; 33 | } 34 | }); 35 | 36 | if (boolAllLoaded) { 37 | 38 | //figure proportional size based on viewbox 39 | numMainMapHeight = (numMainMapWidth*arrMainMapViewBox[3])/arrMainMapViewBox[2]; 40 | 41 | objMainMap = Raphael(strTargetCanvas, numMainMapWidth, numMainMapHeight); 42 | 43 | //set scale factors 44 | numMainMapScale = getScaleFactor(numMainMapWidth,arrMainMapViewBox[2] + (numMapHorizPadding*2)); 45 | 46 | objMainMapSet = {}; 47 | 48 | $.each(objMainMapData, function(numLayerKey, objLayer) { 49 | //Multipolygon layers 50 | if (objLayer.type == 'multipolygon') { 51 | 52 | //Multipolygon layer style 53 | var objAttr = { 54 | fill: "#D1D3D4", 55 | stroke: "none", 56 | "stroke-linejoin": "round" 57 | }; 58 | 59 | //loop through geometries 60 | $.each(objLayer.geometries, function(numGeomKey, objGeom) { 61 | 62 | objMainMapSet[objGeom.id] = objMainMap.path(objGeom.svgstring).attr(objAttr) 63 | .data('slug',objGeom.id); 64 | 65 | }); 66 | } 67 | 68 | if (objLayer.type == 'multilinestring') { 69 | 70 | //Multilinestring layer style 71 | var objLineAttr = { 72 | "stroke": "#999", 73 | "stroke-width": 3 74 | }; 75 | 76 | $.each(objLayer.geometries, function(numGeomKey, objGeom) { 77 | 78 | objMainMapSet[objGeom.id] = objMainMap.path(objGeom.svgstring).attr(objLineAttr) 79 | .data('slug',objGeom.id); 80 | 81 | }); 82 | } 83 | 84 | if (objLayer.type == 'point') { 85 | 86 | //Point layer style 87 | var objCircleAttr = { 88 | "fill": "#0D8140", 89 | "stroke": "#FFFFFF", 90 | "stroke-width": 1.5, 91 | "stroke-linejoin": "round", 92 | "cursor": "pointer" 93 | }; 94 | 95 | var numPixelTypeSize = 12*numMainMapScale; 96 | 97 | $.each(objLayer.geometries, function(numGeomKey, objGeom) { 98 | 99 | objMainMapSet[objGeom.id] = objMainMap.circle(objGeom.svgpoint[0], objGeom.svgpoint[1], 15).attr(objCircleAttr) 100 | .data('slug',objGeom.id) 101 | .click(function () { 102 | showDetails(objGeom.id); 103 | }); 104 | }); 105 | } 106 | }); 107 | 108 | arrMapSets = [objMainMapSet]; 109 | objMainMap.setViewBox(arrMainMapViewBox[0], arrMainMapViewBox[1], arrMainMapViewBox[2] + numMapHorizPadding*numMainMapScale, arrMainMapViewBox[3], false); 110 | 111 | } 112 | } 113 | 114 | function showDetails(strSlug) { 115 | alert(strSlug); 116 | } 117 | 118 | 119 | function loadMap(strTargetCanvas) { 120 | 121 | $.getJSON(strServerRoot + 'json/layer-map/', function(data) { 122 | arrMainMapViewBox = data.viewbox; 123 | objMainMapData = data.layers; 124 | 125 | objLoadElements.mainmap = true; 126 | buildMap(strTargetCanvas); 127 | 128 | }); 129 | } -------------------------------------------------------------------------------- /static/js/choropleth-map.js: -------------------------------------------------------------------------------- 1 | var strServerRoot = '/'; 2 | 3 | //Set your actual desired final width here. The height will be adjusted based on your map layers. 4 | var numMainMapWidth = 570; 5 | var numMainMapHeight; 6 | var numMapHorizPadding = 75; 7 | var numMapVerticalPadding = 0; 8 | 9 | //Used to translate the SVG dimensions to your desired final width/height, and to scale type or other sizes 10 | var numMainMapScale; 11 | 12 | var objMainMap; 13 | var objMainMapSet = {}; 14 | var arrMapSets = []; 15 | 16 | var objLoadElements = {}; 17 | objLoadElements.data = false; 18 | objLoadElements.mainmap = false; 19 | 20 | var objMainMapData = null; 21 | var arrMainMapViewBox = null; 22 | var objRelatedData = null; 23 | 24 | var strSelectedGeom = null; 25 | 26 | function getScaleFactor(numPaperWidth,numViewboxWidth) { 27 | var numScaleFactor = numViewboxWidth/numPaperWidth; 28 | return numScaleFactor; 29 | } 30 | 31 | function buildMap(strTargetCanvas) { 32 | var boolAllLoaded = true; 33 | $.each(objLoadElements, function(numK, objV) { 34 | if (objV == false) { 35 | boolAllLoaded = false; 36 | } 37 | }); 38 | 39 | if (boolAllLoaded) { 40 | 41 | //figure proportional size based on viewbox 42 | numMainMapHeight = (numMainMapWidth*arrMainMapViewBox[3])/arrMainMapViewBox[2]; 43 | 44 | objMainMap = Raphael(strTargetCanvas, numMainMapWidth, numMainMapHeight); 45 | 46 | //set scale factors 47 | numMainMapScale = getScaleFactor(numMainMapWidth,arrMainMapViewBox[2] + (numMapHorizPadding*2)); 48 | 49 | objMainMapSet = {}; 50 | 51 | //categorize related data into color information by getting range of related data 52 | var numDataMin = null; 53 | var numDataMax = null; 54 | var numQuantiles = 8; 55 | var strDataField = 'poppctchange'; 56 | $.each(objRelatedData, function(numKey, objData) { 57 | if (numDataMin === null || objData[strDataField] < numDataMin) { 58 | numDataMin = objData[strDataField]; 59 | } 60 | if (numDataMax === null || objData[strDataField] > numDataMax) { 61 | numDataMax = objData[strDataField]; 62 | } 63 | }); 64 | var numQuantileInterval = (numDataMax-numDataMin)/numQuantiles; 65 | var arrQuantileMins = []; 66 | for (numQ=0; numQ= numQMax) { 87 | strGeomFill = arrFills[numQKey]; 88 | } 89 | }); 90 | 91 | //Multipolygon layer style 92 | var objAttr = { 93 | "fill": strGeomFill, 94 | "stroke": "#FFF", 95 | "stroke-width": 1*numMainMapScale, 96 | "stroke-linejoin": "round", 97 | "cursor":"pointer" 98 | }; 99 | 100 | objMainMapSet[objGeom.id] = objMainMap.path(objGeom.svgstring).attr(objAttr) 101 | .data('slug',objGeom.id) 102 | .data('main-color',strGeomFill) 103 | .mouseover(function() { 104 | this.attr("fill","#EEE"); 105 | }) 106 | .mouseout(function() { 107 | this.attr("fill",this.data('main-color')); 108 | }) 109 | .click(function () { 110 | showDetails(objGeom,objMatch); 111 | }); 112 | 113 | }); 114 | }); 115 | 116 | arrMapSets = [objMainMapSet]; 117 | objMainMap.setViewBox(arrMainMapViewBox[0], arrMainMapViewBox[1], arrMainMapViewBox[2] + numMapHorizPadding*numMainMapScale, arrMainMapViewBox[3], false); 118 | 119 | } 120 | } 121 | 122 | function showDetails(objGeom,objMatch) { 123 | alert(objMatch.name + ' County: ' + objMatch.poppctchange + '% change'); 124 | } 125 | 126 | 127 | function loadMap(strTargetCanvas) { 128 | 129 | $.getJSON(strServerRoot + 'json/county/population/', function(data) { 130 | 131 | objRelatedData = data.counties; 132 | objLoadElements.data = true; 133 | buildMap(strTargetCanvas); 134 | 135 | }); 136 | 137 | 138 | $.getJSON(strServerRoot + 'json/choropleth/', function(data) { 139 | arrMainMapViewBox = data.viewbox; 140 | objMainMapData = data.layers; 141 | 142 | objLoadElements.mainmap = true; 143 | buildMap(strTargetCanvas); 144 | 145 | }); 146 | 147 | } -------------------------------------------------------------------------------- /svg_map/load.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import os, sys 3 | from django.contrib.gis.utils import LayerMapping 4 | from models import Wisconsin, WisconsinCity, WisconsinInterstate, WisconsinCounty, WisconsinCountyData 5 | 6 | #### Data for layer map example #### 7 | # Auto-generated `LayerMapping` dictionary for Wisconsin model 8 | wisconsin_mapping = { 9 | 'state' : 'STATE', 10 | 'state_fips' : 'STATE_FIPS', 11 | 'geom' : 'MULTIPOLYGON', 12 | } 13 | 14 | border_shp = os.path.join('.', 'svg_map/wisconsin/wisconsin.shp') 15 | 16 | def run_wisconsin(verbose=True): 17 | lm = LayerMapping(Wisconsin, border_shp, wisconsin_mapping, 18 | transform=False, encoding='utf-8') 19 | 20 | lm.save(strict=True, verbose=verbose) 21 | 22 | # Auto-generated `LayerMapping` dictionary for WisconsinCity model 23 | wisconsincity_mapping = { 24 | 'statefp10' : 'STATEFP10', 25 | 'placefp10' : 'PLACEFP10', 26 | 'placens10' : 'PLACENS10', 27 | 'geoid10' : 'GEOID10', 28 | 'name10' : 'NAME10', 29 | 'namelsad10' : 'NAMELSAD10', 30 | 'lsad10' : 'LSAD10', 31 | 'classfp10' : 'CLASSFP10', 32 | 'pcicbsa10' : 'PCICBSA10', 33 | 'pcinecta10' : 'PCINECTA10', 34 | 'mtfcc10' : 'MTFCC10', 35 | 'funcstat10' : 'FUNCSTAT10', 36 | 'aland10' : 'ALAND10', 37 | 'awater10' : 'AWATER10', 38 | 'intptlat10' : 'INTPTLAT10', 39 | 'intptlon10' : 'INTPTLON10', 40 | 'geom' : 'POINT', 41 | } 42 | 43 | point_shp = os.path.join('.', 'svg_map/wisconsin_bigger_cities/wisconsin_bigger_cities.shp') 44 | 45 | def run_cities(verbose=True): 46 | lm = LayerMapping(WisconsinCity, point_shp, wisconsincity_mapping, 47 | transform=False, encoding='utf-8') 48 | 49 | lm.save(strict=True, verbose=verbose) 50 | 51 | # Auto-generated `LayerMapping` dictionary for WisconsinInterstate model 52 | wisconsininterstate_mapping = { 53 | 'feature' : 'FEATURE', 54 | 'route' : 'ROUTE', 55 | 'state_fips' : 'STATE_FIPS', 56 | 'state' : 'STATE', 57 | 'geom' : 'LINESTRING', 58 | } 59 | 60 | line_shp = os.path.join('.', 'svg_map/wisconsin_interstates/wisconsin_interstates.shp') 61 | 62 | def run_roads(verbose=True): 63 | lm = LayerMapping(WisconsinInterstate, line_shp, wisconsininterstate_mapping, 64 | transform=False, encoding='utf-8') 65 | 66 | lm.save(strict=True, verbose=verbose) 67 | 68 | #0.03 tolerance about right for U.S. map in 4326, 3000 about right for lambert, 300 about right for smaller UTM countries 69 | def update_simple_roads(): 70 | for b in WisconsinInterstate.objects.all(): 71 | b.set_simple_polylines('simple_mpoly_utm15n', 300, 26915) 72 | print '%s simplified' % (b) 73 | 74 | #0.03 tolerance about right for U.S. map in 4326, 3000 about right for lambert, 300 about right for smaller UTM countries 75 | def update_simple_polys(): 76 | for b in Wisconsin.objects.all(): 77 | b.set_simple_polygons('simple_mpoly_utm15n', 300, 26915) 78 | print '%s simplified' % (b) 79 | 80 | 81 | 82 | #### Data for choropleth map example #### 83 | 84 | # Auto-generated `LayerMapping` dictionary for WisconsinCounty model 85 | wisconsincounty_mapping = { 86 | 'statefp10' : 'STATEFP10', 87 | 'countyfp10' : 'COUNTYFP10', 88 | 'countyns10' : 'COUNTYNS10', 89 | 'geoid10' : 'GEOID10', 90 | 'name10' : 'NAME10', 91 | 'namelsad10' : 'NAMELSAD10', 92 | 'lsad10' : 'LSAD10', 93 | 'classfp10' : 'CLASSFP10', 94 | 'mtfcc10' : 'MTFCC10', 95 | 'csafp10' : 'CSAFP10', 96 | 'cbsafp10' : 'CBSAFP10', 97 | 'metdivfp10' : 'METDIVFP10', 98 | 'funcstat10' : 'FUNCSTAT10', 99 | 'aland10' : 'ALAND10', 100 | 'awater10' : 'AWATER10', 101 | 'intptlat10' : 'INTPTLAT10', 102 | 'intptlon10' : 'INTPTLON10', 103 | 'geom' : 'MULTIPOLYGON', 104 | } 105 | 106 | county_shp = os.path.join('.', 'svg_map/wisconsin_counties/tl_2010_55_county10.shp') 107 | 108 | def run_wisconsin_counties(verbose=True): 109 | lm = LayerMapping(WisconsinCounty, county_shp, wisconsincounty_mapping, 110 | transform=False, encoding='utf-8') 111 | 112 | lm.save(strict=True, verbose=verbose) 113 | 114 | #0.03 tolerance about right for U.S. map in 4326, 3000 about right for lambert, 300 about right for smaller UTM countries 115 | def update_simple_county_polys(): 116 | for b in WisconsinCounty.objects.all(): 117 | b.set_simple_polygons('simple_mpoly_utm15n', 300, 26915) 118 | print '%s simplified' % (b) 119 | 120 | 121 | def load_wisconsin_related_data(): 122 | working_dir = '.' 123 | data_dir = os.path.join(working_dir, 'svg_map/wisconsin_pop_data') 124 | file_path = os.path.join(data_dir, 'all_050_in_55.P1.csv') 125 | handle = csv.reader(open(file_path, 'rU'), delimiter=',', quotechar='"') 126 | header = handle.next() 127 | for h in handle: 128 | try: 129 | insert = WisconsinCountyData() 130 | insert.geoid = h[0].strip() 131 | insert.statefps = h[2].strip() 132 | insert.countyfps = h[3].strip() 133 | insert.name = h[8].strip().replace(' County','') 134 | insert.pop_2010 = h[9].strip() 135 | insert.pop_2000 = h[11].strip() 136 | insert.save() 137 | print h[8].strip() 138 | except: 139 | raise 140 | 141 | def load_all_sample_data(): 142 | run_wisconsin() 143 | update_simple_polys() 144 | run_roads() 145 | update_simple_roads() 146 | run_cities() 147 | run_wisconsin_counties() 148 | update_simple_county_polys() 149 | load_wisconsin_related_data() -------------------------------------------------------------------------------- /svg_map/wisconsin_pop_data/all_050_in_55.P1.csv: -------------------------------------------------------------------------------- 1 | GEOID,SUMLEV,STATE,COUNTY,CBSA,CSA,NECTA,CNECTA,NAME,POP100,HU100,POP100.2000,HU100.2000,P001001,P001001.2000 2 | 55003,050,55,003,99999,999,,,Ashland County,16157,9656,16866,8883,16157,16866 3 | 55005,050,55,005,99999,999,,,Barron County,45870,23614,44963,20969,45870,44963 4 | 55007,050,55,007,99999,999,,,Bayfield County,15014,12999,15013,11640,15014,15013 5 | 55009,050,55,009,24580,999,,,Brown County,248007,104371,226778,90199,248007,226778 6 | 55011,050,55,011,99999,999,,,Buffalo County,13587,6664,13804,6098,13587,13804 7 | 55013,050,55,013,99999,999,,,Burnett County,15457,15278,15674,12582,15457,15674 8 | 55015,050,55,015,11540,118,,,Calumet County,48971,19695,40631,15758,48971,40631 9 | 55017,050,55,017,20740,232,,,Chippewa County,62415,27185,55195,22821,62415,55195 10 | 55019,050,55,019,99999,999,,,Clark County,34690,15076,33557,13531,34690,33557 11 | 55023,050,55,023,99999,999,,,Crawford County,16644,8802,17243,8480,16644,17243 12 | 55031,050,55,031,20260,999,,,Douglas County,44159,22825,43287,20356,44159,43287 13 | 55035,050,55,035,20740,232,,,Eau Claire County,98736,42151,93142,37474,98736,93142 14 | 55037,050,55,037,27020,999,,,Florence County,4423,4780,5088,4239,4423,5088 15 | 55039,050,55,039,22540,252,,,Fond du Lac County,101633,43910,97296,39271,101633,97296 16 | 55043,050,55,043,38420,999,,,Grant County,51208,21581,49597,19940,51208,49597 17 | 55045,050,55,045,33820,999,,,Green County,36842,15856,33647,13878,36842,33647 18 | 55047,050,55,047,99999,999,,,Green Lake County,19051,10616,19105,9831,19051,19105 19 | 55049,050,55,049,31540,358,,,Iowa County,23687,10719,22780,9579,23687,22780 20 | 55053,050,55,053,99999,999,,,Jackson County,20449,9727,19100,8029,20449,19100 21 | 55055,050,55,055,48020,999,,,Jefferson County,83686,35147,74021,30092,83686,74021 22 | 55063,050,55,063,29100,999,,,La Crosse County,114638,48402,107120,43479,114638,107120 23 | 55065,050,55,065,99999,999,,,Lafayette County,16836,7230,16137,6674,16836,16137 24 | 55069,050,55,069,32980,554,,,Lincoln County,28743,16784,29641,14681,28743,29641 25 | 55071,050,55,071,31820,999,,,Manitowoc County,81442,37189,82887,34651,81442,82887 26 | 55073,050,55,073,48140,554,,,Marathon County,134063,57734,125834,50360,134063,125834 27 | 55079,050,55,079,33340,376,,,Milwaukee County,947735,418053,940164,400093,947735,940164 28 | 55081,050,55,081,99999,999,,,Monroe County,44673,19204,40899,16672,44673,40899 29 | 55083,050,55,083,24580,999,,,Oconto County,37660,23537,35634,19812,37660,35634 30 | 55087,050,55,087,11540,118,,,Outagamie County,176695,73149,160971,62614,176695,160971 31 | 55091,050,55,091,99999,999,,,Pepin County,7469,3579,7213,3036,7469,7213 32 | 55095,050,55,095,99999,999,,,Polk County,44205,24248,41319,21129,44205,41319 33 | 55097,050,55,097,44620,999,,,Portage County,70019,30054,67182,26589,70019,67182 34 | 55099,050,55,099,99999,999,,,Price County,14159,11120,15822,9574,14159,15822 35 | 55105,050,55,105,27500,999,,,Rock County,160331,68422,152307,62187,160331,152307 36 | 55107,050,55,107,99999,999,,,Rusk County,14755,8883,15347,7609,14755,15347 37 | 55109,050,55,109,33460,378,,,St. Croix County,84345,33983,63155,24265,84345,63155 38 | 55111,050,55,111,12660,358,,,Sauk County,61976,29708,55225,24297,61976,55225 39 | 55115,050,55,115,99999,999,,,Shawano County,41949,20720,40664,18317,41949,40664 40 | 55119,050,55,119,99999,999,,,Taylor County,20689,10582,19680,8595,20689,19680 41 | 55121,050,55,121,99999,999,,,Trempealeau County,28816,12619,27010,11482,28816,27010 42 | 55123,050,55,123,99999,999,,,Vernon County,29773,13720,28056,12416,29773,28056 43 | 55127,050,55,127,48580,999,,,Walworth County,102228,51531,93759,43783,102228,93759 44 | 55129,050,55,129,99999,999,,,Washburn County,15911,12979,16036,10814,15911,16036 45 | 55131,050,55,131,33340,376,,,Washington County,131887,54695,117493,45808,131887,117493 46 | 55133,050,55,133,33340,376,,,Waukesha County,389891,160864,360767,140309,389891,360767 47 | 55137,050,55,137,99999,999,,,Waushara County,24496,14843,23154,13667,24496,23154 48 | 55139,050,55,139,36780,118,,,Winnebago County,166994,73329,156763,64721,166994,156763 49 | 55141,050,55,141,32270,999,,,Wood County,74749,34088,75555,31691,74749,75555 50 | 55025,050,55,025,31540,358,,,Dane County,488073,216022,426526,180398,488073,426526 51 | 55041,050,55,041,99999,999,,,Forest County,9304,8970,10024,8322,9304,10024 52 | 55059,050,55,059,16980,176,,,Kenosha County,166426,69288,149577,59989,166426,149577 53 | 55061,050,55,061,24580,999,,,Kewaunee County,20574,9304,20187,8221,20574,20187 54 | 55078,050,55,078,99999,999,,,Menominee County,4232,2253,4562,2098,4232,4562 55 | 55089,050,55,089,33340,376,,,Ozaukee County,86395,36267,82317,32034,86395,82317 56 | 55101,050,55,101,39540,376,,,Racine County,195408,82164,188831,74718,195408,188831 57 | 55001,050,55,001,99999,999,,,Adams County,20875,17436,18643,14123,20875,18643 58 | 55021,050,55,021,31540,358,,,Columbia County,56833,26137,52468,22685,56833,52468 59 | 55027,050,55,027,13180,252,,,Dodge County,88759,37005,85897,33672,88759,85897 60 | 55029,050,55,029,99999,999,,,Door County,27785,23966,27961,19587,27785,27961 61 | 55033,050,55,033,32860,232,,,Dunn County,43857,17964,39858,15277,43857,39858 62 | 55051,050,55,051,99999,999,,,Iron County,5916,5999,6861,5706,5916,6861 63 | 55057,050,55,057,99999,999,,,Juneau County,26664,14669,24316,12370,26664,24316 64 | 55067,050,55,067,99999,999,,,Langlade County,19977,12360,20740,11187,19977,20740 65 | 55075,050,55,075,31940,999,,,Marinette County,41749,30379,43384,26260,41749,43384 66 | 55077,050,55,077,99999,999,,,Marquette County,15404,9896,15832,8664,15404,15832 67 | 55085,050,55,085,99999,999,,,Oneida County,35998,30125,36776,26627,35998,36776 68 | 55093,050,55,093,33460,378,,,Pierce County,41019,16132,36804,13493,41019,36804 69 | 55103,050,55,103,99999,999,,,Richland County,18021,8868,17924,8164,18021,17924 70 | 55113,050,55,113,99999,999,,,Sawyer County,16557,15975,16196,13722,16557,16196 71 | 55117,050,55,117,43100,999,,,Sheboygan County,115507,50766,112646,45947,115507,112646 72 | 55125,050,55,125,99999,999,,,Vilas County,21430,25116,21033,22397,21430,21033 73 | 55135,050,55,135,99999,999,,,Waupaca County,52410,25396,51731,22508,52410,51731 74 | -------------------------------------------------------------------------------- /svg_map/wisconsin_bigger_cities/wisconsin_bigger_cities.dbf: -------------------------------------------------------------------------------- 1 | _!WSTATEFP10CPLACEFP10CPLACENS10CGEOID10CNAME10CdNAMELSAD10CdLSAD10CCLASSFP10CPCICBSA10CPCINECTA10CMTFCC10CFUNCSTAT10CALAND10NAWATER10NINTPTLAT10C INTPTLON10C 5583975015843655583975Watertown Watertown city 25C5YNG4110A 31370005 1036033+43.1896630-088.7288427 5526675015832195526675Fort Atkinson Fort Atkinson city 25C5YNG4110A 14680534 395670+42.9246196-088.8447096 5586925015844325586925Whitewater Whitewater city 25C5YNG4110A 22678538 775465+42.8374392-088.7342824 5540775015834995540775La Crosse La Crosse city 25C5YNG4110A 53136958 5235135+43.8258663-091.2242447 5502375015827035502375Appleton Appleton city 25C5YNG4110A 63004369 1267183+44.2788191-088.3926255 5566000015839915566000Racine Racine city 25C5YNG4110A 40096717 8288262+42.7282842-087.8070858 5553000015837245553000Milwaukee Milwaukee city 25C5YNG4110A 248955419 1755108+43.0633484-087.9666952 5584250015843715584250Waukesha Waukesha city 25C5YNG4110A 64252317 661317+43.0090837-088.2450618 5526275015832085526275Fond du Lac Fond du Lac city 25C5YNG4110A 48753977 3343216+43.7721533-088.4402660 5588200015844635588200Wisconsin Rapids Wisconsin Rapids city 25C5YNG4110A 35801239 2198216+44.3929245-089.8267404 5549675015836665549675Marshfield Marshfield city 25C5YNG4110A 34853099 70991+44.6638072-090.1730518 5551025015836965551025Menomonie Menomonie city 25C5YNG4110A 35447122 4610069+44.8891998-091.9095702 5560500015838765560500Oshkosh Oshkosh city 25C5YNG4110A 66279943 2631283+44.0226282-088.5623520 5555750015837845555750Neenah Neenah city 25C5YNG4110A 23894381 995723+44.1675969-088.4759985 5549300015836545549300Marinette Marinette city 25C5YNG4110A 17677172 3376979+45.0876121-087.6269555 5548000015836255548000Madison Madison city 25C5YNG4110A 198882058 44658619+43.0878055-089.4301208 5522300015831245522300Eau Claire Eau Claire city 25C5YNG4110A 82991001 5448490+44.8213069-091.4948440 5537825015834485537825Janesville Janesville city 25C5YNG4110A 87694528 1523867+42.6846985-089.0131701 5553750015837405553750Monroe Monroe city 25C5YNG4110A 12498248 0+42.6010450-089.6438804 5585300015843975585300West Allis West Allis city 25C5YNG4110A 29486693 60789+43.0071860-088.0289858 5504625015827495504625Baraboo Baraboo city 25C5YNG4110A 19149355 201756+43.4694081-089.7372893 5548500015836365548500Manitowoc Manitowoc city 25C5YNG4110A 45658645 933736+44.0985920-087.6813003 5551250015837015551250Merrill Merrill city 25C5YNG4110A 18743761 1465269+45.1806141-089.7025046 5505900015827775505900Beaver Dam Beaver Dam city 25C5YNG4110A 17590728 3581185+43.4669806-088.8318878 5572975015841365572975Sheboygan Sheboygan city 25C5YNG4110A 36192779 376665+43.7460015-087.7305455 5531000015833095531000Green Bay Green Bay city 25C5YNG4110A 117758394 27155878+44.5206763-087.9841686 5563250015839335563250Platteville Platteville city 25C5YNG4110A 14125954 0+42.7332608-090.4708508 5584475015843795584475Wausau Wausau city 25C5YNG4110A 48633764 3274145+44.9618663-089.6434858 5577200015842235577200Stevens Point Stevens Point city 25C5YNG4110A 41336622 3222826+44.5254815-089.5537175 -------------------------------------------------------------------------------- /svg_map/models.py: -------------------------------------------------------------------------------- 1 | from django.contrib.gis.db import models 2 | from django.template.defaultfilters import slugify 3 | from django.contrib.gis import geos 4 | from django.contrib.gis.geos import fromstr 5 | from django.contrib.gis.gdal import OGRGeometry, OGRGeomType 6 | 7 | class Wisconsin(models.Model): 8 | state = models.CharField(max_length=20) 9 | state_fips = models.CharField(max_length=2) 10 | geom = models.MultiPolygonField(srid=4269) 11 | simple_mpoly_utm15n = models.MultiPolygonField(srid=26915, null=True) 12 | slug = models.SlugField(blank=True) 13 | objects = models.GeoManager() 14 | 15 | def save(self, **kwargs): 16 | self.slug = slugify(self.state) 17 | #self.internal_point = fromstr('POINT(%s %s)' % (self.lon_internal_point, self.lat_internal_point.replace('+', ''))) 18 | if self.geom and isinstance(self.geom, geos.Polygon): 19 | self.geom = geos.MultiPolygon(self.geom) 20 | 21 | super(self.__class__, self).save(**kwargs) 22 | 23 | def __unicode__(self): 24 | return self.slug 25 | 26 | def set_simple_polygons(self, target_field_name='simple_mpoly', tolerance=2, srid=4326): 27 | """ 28 | Ben Welsh method 29 | 30 | Simplifies the source polygons so they don't use so many points. 31 | 32 | Provide a tolerance score the indicates how sharply the 33 | the lines should be redrawn. 34 | 35 | Returns True if successful. 36 | """ 37 | 38 | # Fetch the source polygon 39 | source_field_name = 'geom' 40 | source = getattr(self, source_field_name) 41 | # Fetch the target polygon where the result will be saved 42 | #target_field_name = 'simple_mpoly' 43 | target = getattr(self, target_field_name) 44 | # Simplify the source 45 | simple = source.transform(srid, True).simplify(tolerance, True) 46 | # If it's a polygon, convert it to a MultiPolygon 47 | if simple.geom_type == 'Polygon': 48 | mp = OGRGeometry(OGRGeomType('MultiPolygon')) 49 | mp.add(simple.wkt) 50 | target = mp.wkt 51 | # Otherwise just save out right away 52 | else: 53 | target = simple.wkt 54 | 55 | # Set the attribute 56 | setattr(self, target_field_name, target) 57 | 58 | # Save out 59 | self.save() 60 | return True 61 | 62 | class WisconsinInterstate(models.Model): 63 | feature = models.CharField(max_length=80) 64 | route = models.CharField(max_length=120) 65 | state_fips = models.CharField(max_length=2) 66 | state = models.CharField(max_length=2) 67 | geom = models.LineStringField(srid=4269) 68 | slug = models.SlugField(blank=True) 69 | simple_mpoly_utm15n = models.MultiLineStringField(srid=26915,null=True) 70 | objects = models.GeoManager() 71 | 72 | def save(self, **kwargs): 73 | self.slug = slugify(self.route) 74 | #self.internal_point = fromstr('POINT(%s %s)' % (self.lon_internal_point, self.lat_internal_point.replace('+', ''))) 75 | # if self.geom and isinstance(self.geom, geos.LineString): 76 | # self.geom = geos.LineString(self.geom) 77 | 78 | super(self.__class__, self).save(**kwargs) 79 | 80 | def __unicode__(self): 81 | return self.slug 82 | 83 | def set_simple_polylines(self, target_field_name='simple_mpoly', tolerance=2, srid=4326): 84 | """ 85 | Ben Welsh method 86 | 87 | Simplifies the source polygons so they don't use so many points. 88 | 89 | Provide a tolerance score the indicates how sharply the 90 | the lines should be redrawn. 91 | 92 | Returns True if successful. 93 | """ 94 | 95 | # Fetch the source polygon 96 | source_field_name = 'geom' 97 | source = getattr(self, source_field_name) 98 | # Fetch the target polygon where the result will be saved 99 | #target_field_name = 'simple_mpoly' 100 | target = getattr(self, target_field_name) 101 | # Simplify the source 102 | simple = source.transform(srid, True).simplify(tolerance, True) 103 | # If it's a polyline, convert it to a MultiPolyline 104 | if simple.geom_type == 'LineString': 105 | mp = OGRGeometry(OGRGeomType('MultiLineString')) 106 | mp.add(simple.wkt) 107 | target = mp.wkt 108 | # Otherwise just save out right away 109 | else: 110 | target = simple.wkt 111 | 112 | # Set the attribute 113 | setattr(self, target_field_name, target) 114 | 115 | # Save out 116 | self.save() 117 | return True 118 | 119 | 120 | class WisconsinCity(models.Model): 121 | statefp10 = models.CharField(max_length=2) 122 | placefp10 = models.CharField(max_length=5) 123 | placens10 = models.CharField(max_length=8) 124 | geoid10 = models.CharField(max_length=7) 125 | name10 = models.CharField(max_length=100) 126 | namelsad10 = models.CharField(max_length=100) 127 | lsad10 = models.CharField(max_length=2) 128 | classfp10 = models.CharField(max_length=2) 129 | pcicbsa10 = models.CharField(max_length=1) 130 | pcinecta10 = models.CharField(max_length=1) 131 | mtfcc10 = models.CharField(max_length=5) 132 | funcstat10 = models.CharField(max_length=1) 133 | aland10 = models.FloatField() 134 | awater10 = models.FloatField() 135 | intptlat10 = models.CharField(max_length=11) 136 | intptlon10 = models.CharField(max_length=12) 137 | geom = models.PointField(srid=4326) 138 | geom_utm15n = models.PointField(srid=26915) 139 | slug = models.SlugField(blank=True) 140 | objects = models.GeoManager() 141 | 142 | def save(self, **kwargs): 143 | self.slug = slugify(self.name10) 144 | self.geom_utm15n = self.geom.transform(26915, True) 145 | 146 | super(self.__class__, self).save(**kwargs) 147 | 148 | def __unicode__(self): 149 | return self.slug 150 | 151 | class WisconsinCounty(models.Model): 152 | statefp10 = models.CharField(max_length=2) 153 | countyfp10 = models.CharField(max_length=3) 154 | countyns10 = models.CharField(max_length=8) 155 | geoid10 = models.CharField(max_length=5) 156 | name10 = models.CharField(max_length=100) 157 | namelsad10 = models.CharField(max_length=100) 158 | lsad10 = models.CharField(max_length=2) 159 | classfp10 = models.CharField(max_length=2) 160 | mtfcc10 = models.CharField(max_length=5) 161 | csafp10 = models.CharField(max_length=3) 162 | cbsafp10 = models.CharField(max_length=5) 163 | metdivfp10 = models.CharField(max_length=5) 164 | funcstat10 = models.CharField(max_length=1) 165 | aland10 = models.FloatField() 166 | awater10 = models.FloatField() 167 | intptlat10 = models.CharField(max_length=11) 168 | intptlon10 = models.CharField(max_length=12) 169 | geom = models.MultiPolygonField(srid=4269) 170 | simple_mpoly_utm15n = models.MultiPolygonField(srid=26915, null=True) 171 | slug = models.SlugField(blank=True) 172 | objects = models.GeoManager() 173 | 174 | def save(self, **kwargs): 175 | self.slug = slugify(self.name10) 176 | #self.internal_point = fromstr('POINT(%s %s)' % (self.lon_internal_point, self.lat_internal_point.replace('+', ''))) 177 | if self.geom and isinstance(self.geom, geos.Polygon): 178 | self.geom = geos.MultiPolygon(self.geom) 179 | 180 | super(self.__class__, self).save(**kwargs) 181 | 182 | def __unicode__(self): 183 | return self.slug 184 | 185 | def set_simple_polygons(self, target_field_name='simple_mpoly', tolerance=2, srid=4326): 186 | """ 187 | Ben Welsh method 188 | 189 | Simplifies the source polygons so they don't use so many points. 190 | 191 | Provide a tolerance score the indicates how sharply the 192 | the lines should be redrawn. 193 | 194 | Returns True if successful. 195 | """ 196 | 197 | # Fetch the source polygon 198 | source_field_name = 'geom' 199 | source = getattr(self, source_field_name) 200 | # Fetch the target polygon where the result will be saved 201 | #target_field_name = 'simple_mpoly' 202 | target = getattr(self, target_field_name) 203 | # Simplify the source 204 | simple = source.transform(srid, True).simplify(tolerance, True) 205 | # If it's a polygon, convert it to a MultiPolygon 206 | if simple.geom_type == 'Polygon': 207 | mp = OGRGeometry(OGRGeomType('MultiPolygon')) 208 | mp.add(simple.wkt) 209 | target = mp.wkt 210 | # Otherwise just save out right away 211 | else: 212 | target = simple.wkt 213 | 214 | # Set the attribute 215 | setattr(self, target_field_name, target) 216 | 217 | # Save out 218 | self.save() 219 | return True 220 | 221 | class WisconsinCountyData(models.Model): 222 | geoid = models.CharField(max_length=20) 223 | statefps = models.IntegerField(max_length=2) 224 | countyfps = models.IntegerField(max_length=3) 225 | name = models.CharField(max_length=100) 226 | pop_2010 = models.IntegerField(max_length=10) 227 | pop_2000 = models.IntegerField(max_length=10) 228 | slug = models.SlugField(blank=True) 229 | 230 | def save(self, **kwargs): 231 | self.slug = slugify(self.name) 232 | super(self.__class__, self).save(**kwargs) 233 | 234 | def pop_change(self): 235 | return self.pop_2010 - self.pop_2000 236 | 237 | def pop_pct_change(self): 238 | pct_change = round(float((self.pop_2010 - self.pop_2000))/float(self.pop_2010),3) 239 | return pct_change 240 | 241 | def __unicode__(self): 242 | return self.slug -------------------------------------------------------------------------------- /static/js/modernizr-1.5.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Modernizr JavaScript library 1.5 3 | * http://www.modernizr.com/ 4 | * 5 | * Copyright (c) 2009-2010 Faruk Ates - http://farukat.es/ 6 | * Dual-licensed under the BSD and MIT licenses. 7 | * http://www.modernizr.com/license/ 8 | * 9 | * Featuring major contributions by 10 | * Paul Irish - http://paulirish.com 11 | */ 12 | window.Modernizr=function(i,e,I){function C(a,b){for(var c in a)if(m[a[c]]!==I&&(!b||b(a[c],D)))return true}function r(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1);return!!C([a,"Webkit"+c,"Moz"+c,"O"+c,"ms"+c,"Khtml"+c],b)}function P(){j[E]=function(a){for(var b=0,c=a.length;b7)};d.historymanagement=function(){return!!(i.history&&history.pushState)};d.draganddrop=function(){return u("drag")&&u("dragstart")&&u("dragenter")&&u("dragover")&&u("dragleave")&&u("dragend")&&u("drop")};d.websockets=function(){return"WebSocket"in i};d.rgba=function(){m.cssText="background-color:rgba(150,255,150,.5)";return(""+m.backgroundColor).indexOf("rgba")!==-1};d.hsla=function(){m.cssText="background-color:hsla(120,40%,100%,.5)";return(""+ 17 | m.backgroundColor).indexOf("rgba")!==-1};d.multiplebgs=function(){m.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(m.background)};d.backgroundsize=function(){return r("backgroundSize")};d.borderimage=function(){return r("borderImage")};d.borderradius=function(){return r("borderRadius","",function(a){return(""+a).indexOf("orderRadius")!==-1})};d.boxshadow=function(){return r("boxShadow")};d.opacity=function(){var a=y.join("opacity:.5;")+"";m.cssText=a;return(""+m.opacity).indexOf("0.5")!== 18 | -1};d.cssanimations=function(){return r("animationName")};d.csscolumns=function(){return r("columnCount")};d.cssgradients=function(){var a=("background-image:"+y.join("gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:")+y.join("linear-gradient(left top,#9f9, white);background-image:")).slice(0,-17);m.cssText=a;return(""+m.backgroundImage).indexOf("gradient")!==-1};d.cssreflections=function(){return r("boxReflect")};d.csstransforms=function(){return!!C(["transformProperty", 19 | "WebkitTransform","MozTransform","OTransform","msTransform"])};d.csstransforms3d=function(){var a=!!C(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);if(a){var b=document.createElement("style"),c=e.createElement("div");b.textContent="@media ("+y.join("transform-3d),(")+"modernizr){#modernizr{height:3px}}";e.getElementsByTagName("head")[0].appendChild(b);c.id="modernizr";s.appendChild(c);a=c.offsetHeight===3;b.parentNode.removeChild(b);c.parentNode.removeChild(c)}return a}; 20 | d.csstransitions=function(){return r("transitionProperty")};d.fontface=function(){var a;if(/*@cc_on@if(@_jscript_version>=5)!@end@*/0)a=true;else{var b=e.createElement("style"),c=e.createElement("span"),h,t=false,g=e.body,o,w;b.textContent="@font-face{font-family:testfont;src:url('data:font/ttf;base64,AAEAAAAMAIAAAwBAT1MvMliohmwAAADMAAAAVmNtYXCp5qrBAAABJAAAANhjdnQgACICiAAAAfwAAAAEZ2FzcP//AAMAAAIAAAAACGdseWYv5OZoAAACCAAAANxoZWFk69bnvwAAAuQAAAA2aGhlYQUJAt8AAAMcAAAAJGhtdHgGDgC4AAADQAAAABRsb2NhAIQAwgAAA1QAAAAMbWF4cABVANgAAANgAAAAIG5hbWUgXduAAAADgAAABPVwb3N03NkzmgAACHgAAAA4AAECBAEsAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAACAAMDAAAAAAAAgAACbwAAAAoAAAAAAAAAAFBmRWQAAAAgqS8DM/8zAFwDMwDNAAAABQAAAAAAAAAAAAMAAAADAAAAHAABAAAAAABGAAMAAQAAAK4ABAAqAAAABgAEAAEAAgAuqQD//wAAAC6pAP///9ZXAwAAAAAAAAACAAAABgBoAAAAAAAvAAEAAAAAAAAAAAAAAAAAAAABAAIAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEACoAAAAGAAQAAQACAC6pAP//AAAALqkA////1lcDAAAAAAAAAAIAAAAiAogAAAAB//8AAgACACIAAAEyAqoAAwAHAC6xAQAvPLIHBADtMrEGBdw8sgMCAO0yALEDAC88sgUEAO0ysgcGAfw8sgECAO0yMxEhESczESMiARDuzMwCqv1WIgJmAAACAFUAAAIRAc0ADwAfAAATFRQWOwEyNj0BNCYrASIGARQGKwEiJj0BNDY7ATIWFX8aIvAiGhoi8CIaAZIoN/43KCg3/jcoAWD0JB4eJPQkHh7++EY2NkbVRjY2RgAAAAABAEH/+QCdAEEACQAANjQ2MzIWFAYjIkEeEA8fHw8QDxwWFhwWAAAAAQAAAAIAAIuYbWpfDzz1AAsEAAAAAADFn9IuAAAAAMWf0i797/8zA4gDMwAAAAgAAgAAAAAAAAABAAADM/8zAFwDx/3v/98DiAABAAAAAAAAAAAAAAAAAAAABQF2ACIAAAAAAVUAAAJmAFUA3QBBAAAAKgAqACoAWgBuAAEAAAAFAFAABwBUAAQAAgAAAAEAAQAAAEAALgADAAMAAAAQAMYAAQAAAAAAAACLAAAAAQAAAAAAAQAhAIsAAQAAAAAAAgAFAKwAAQAAAAAAAwBDALEAAQAAAAAABAAnAPQAAQAAAAAABQAKARsAAQAAAAAABgAmASUAAQAAAAAADgAaAUsAAwABBAkAAAEWAWUAAwABBAkAAQBCAnsAAwABBAkAAgAKAr0AAwABBAkAAwCGAscAAwABBAkABABOA00AAwABBAkABQAUA5sAAwABBAkABgBMA68AAwABBAkADgA0A/tDb3B5cmlnaHQgMjAwOSBieSBEYW5pZWwgSm9obnNvbi4gIFJlbGVhc2VkIHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgT3BlbiBGb250IExpY2Vuc2UuIEtheWFoIExpIGdseXBocyBhcmUgcmVsZWFzZWQgdW5kZXIgdGhlIEdQTCB2ZXJzaW9uIDMuYmFlYzJhOTJiZmZlNTAzMiAtIHN1YnNldCBvZiBKdXJhTGlnaHRiYWVjMmE5MmJmZmU1MDMyIC0gc3Vic2V0IG9mIEZvbnRGb3JnZSAyLjAgOiBKdXJhIExpZ2h0IDogMjMtMS0yMDA5YmFlYzJhOTJiZmZlNTAzMiAtIHN1YnNldCBvZiBKdXJhIExpZ2h0VmVyc2lvbiAyIGJhZWMyYTkyYmZmZTUwMzIgLSBzdWJzZXQgb2YgSnVyYUxpZ2h0aHR0cDovL3NjcmlwdHMuc2lsLm9yZy9PRkwAQwBvAHAAeQByAGkAZwBoAHQAIAAyADAAMAA5ACAAYgB5ACAARABhAG4AaQBlAGwAIABKAG8AaABuAHMAbwBuAC4AIAAgAFIAZQBsAGUAYQBzAGUAZAAgAHUAbgBkAGUAcgAgAHQAaABlACAAdABlAHIAbQBzACAAbwBmACAAdABoAGUAIABPAHAAZQBuACAARgBvAG4AdAAgAEwAaQBjAGUAbgBzAGUALgAgAEsAYQB5AGEAaAAgAEwAaQAgAGcAbAB5AHAAaABzACAAYQByAGUAIAByAGUAbABlAGEAcwBlAGQAIAB1AG4AZABlAHIAIAB0AGgAZQAgAEcAUABMACAAdgBlAHIAcwBpAG8AbgAgADMALgBiAGEAZQBjADIAYQA5ADIAYgBmAGYAZQA1ADAAMwAyACAALQAgAHMAdQBiAHMAZQB0ACAAbwBmACAASgB1AHIAYQBMAGkAZwBoAHQAYgBhAGUAYwAyAGEAOQAyAGIAZgBmAGUANQAwADMAMgAgAC0AIABzAHUAYgBzAGUAdAAgAG8AZgAgAEYAbwBuAHQARgBvAHIAZwBlACAAMgAuADAAIAA6ACAASgB1AHIAYQAgAEwAaQBnAGgAdAAgADoAIAAyADMALQAxAC0AMgAwADAAOQBiAGEAZQBjADIAYQA5ADIAYgBmAGYAZQA1ADAAMwAyACAALQAgAHMAdQBiAHMAZQB0ACAAbwBmACAASgB1AHIAYQAgAEwAaQBnAGgAdABWAGUAcgBzAGkAbwBuACAAMgAgAGIAYQBlAGMAMgBhADkAMgBiAGYAZgBlADUAMAAzADIAIAAtACAAcwB1AGIAcwBlAHQAIABvAGYAIABKAHUAcgBhAEwAaQBnAGgAdABoAHQAdABwADoALwAvAHMAYwByAGkAcAB0AHMALgBzAGkAbAAuAG8AcgBnAC8ATwBGAEwAAAAAAgAAAAAAAP+BADMAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAQACAQIAEQt6ZXJva2F5YWhsaQ==')}"; 21 | e.getElementsByTagName("head")[0].appendChild(b);c.setAttribute("style","font:99px _,arial,helvetica;position:absolute;visibility:hidden");if(!g){g=s.appendChild(e.createElement("fontface"));t=true}c.innerHTML="........";c.id="fonttest";g.appendChild(c);h=c.offsetWidth*c.offsetHeight;c.style.font="99px testfont,_,arial,helvetica";a=h!==c.offsetWidth*c.offsetHeight;var v=function(){if(g.parentNode){a=j.fontface=h!==c.offsetWidth*c.offsetHeight;s.className=s.className.replace(/(no-)?fontface\b/,"")+ 22 | (a?" ":" no-")+"fontface"}};setTimeout(v,75);setTimeout(v,150);addEventListener("load",function(){v();(w=true)&&o&&o(a);setTimeout(function(){t||(g=c);g.parentNode.removeChild(g);b.parentNode.removeChild(b)},50)},false)}j._fontfaceready=function(p){w||a?p(a):(o=p)};return a||h!==c.offsetWidth};d.video=function(){var a=e.createElement("video"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('video/ogg; codecs="theora"');b.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"');b.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return b}; 23 | d.audio=function(){var a=e.createElement("audio"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('audio/ogg; codecs="vorbis"');b.mp3=a.canPlayType("audio/mpeg;");b.wav=a.canPlayType('audio/wav; codecs="1"');b.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}return b};d.localStorage=function(){return"localStorage"in i&&i.localStorage!==null};d.sessionStorage=function(){try{return"sessionStorage"in i&&i.sessionStorage!==null}catch(a){return false}};d.webworkers=function(){return!!i.Worker}; 24 | d.applicationCache=function(){var a=i.applicationCache;return!!(a&&typeof a.status!="undefined"&&typeof a.update=="function"&&typeof a.swapCache=="function")};d.svg=function(){return!!e.createElementNS&&!!e.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect};d.smil=function(){return!!e.createElementNS&&/SVG/.test(M.call(e.createElementNS("http://www.w3.org/2000/svg","animate")))};d.svgclippaths=function(){return!!e.createElementNS&&/SVG/.test(M.call(e.createElementNS("http://www.w3.org/2000/svg", 25 | "clipPath")))};for(var z in d)if(O(d,z))N.push(((j[z.toLowerCase()]=d[z]())?"":"no-")+z.toLowerCase());j[E]||P();j.addTest=function(a,b){a=a.toLowerCase();if(!j[a]){b=!!b();s.className+=" "+(b?"":"no-")+a;j[a]=b;return j}};m.cssText="";D=n=null;(function(){var a=e.createElement("div");a.innerHTML="";return a.childNodes.length!==1})()&&function(a,b){function c(f,k){if(o[f])o[f].styleSheet.cssText+=k;else{var l=t[G],q=b[A]("style");q.media=f;l.insertBefore(q,l[G]);o[f]=q;c(f,k)}}function h(f, 26 | k){for(var l=new RegExp("\\b("+w+")\\b(?!.*[;}])","gi"),q=function(B){return".iepp_"+B},x=-1;++x\\s*$","i");g.innerHTML=f.outerHTML.replace(/\r|\n/g," ").replace(l,f.currentStyle.display=="block"?"":"");l=g.childNodes[0];l.className+=" iepp_"+q;l=p[p.length]=[f,l];f.parentNode.replaceChild(l[1],l[0])}h(b.styleSheets,"all")});a.attachEvent("onafterprint", 28 | function(){for(var f=-1,k;++f self.geobounds.numMaxLat: 28 | self.geobounds.numMaxLat = floatYPoint 29 | 30 | if floatXPoint < self.geobounds.numMinLng: 31 | self.geobounds.numMinLng = floatXPoint 32 | 33 | if floatXPoint > self.geobounds.numMaxLng: 34 | self.geobounds.numMaxLng = floatXPoint 35 | 36 | self.mapGeoWidth = math.fabs(self.geobounds.numMaxLng - self.geobounds.numMinLng) 37 | self.mapGeoHeight = math.fabs(self.geobounds.numMaxLat - self.geobounds.numMinLat) 38 | 39 | def buildSVGMapViewBox(self): 40 | #Find maximum bounds to get translation values to make zero-based 41 | for l in self.orig_layers: 42 | if l['type'] == 'point': 43 | for point in l['point_set']: 44 | self.updateGeoBounds(point.arrGeometry) 45 | 46 | if l['type'] == 'multipolygon': 47 | for multipolygon in l['multi_set']: 48 | for polygon in multipolygon.rings: 49 | for key in range(len(polygon.arrGeometry)): 50 | point = polygon.arrGeometry[key] 51 | if key != len(polygon.arrGeometry)-1: 52 | self.updateGeoBounds(point) 53 | 54 | if l['type'] == 'multilinestring': 55 | for multilinestring in l['multi_set']: 56 | for linestring in multilinestring.rings: 57 | for key in range(len(linestring.arrGeometry)): 58 | point = linestring.arrGeometry[key] 59 | self.updateGeoBounds(point) 60 | 61 | self.scaleFactor = self.mapPixelWidth/self.mapGeoWidth 62 | self.pixelPadding = self.mapPixelWidth*self.paddingPct 63 | 64 | self.mapPixelHeight = self.mapGeoHeight*self.scaleFactor 65 | 66 | #convert bounds to 0-based values 67 | self.pixelbounds.numMinLat = 0 68 | self.pixelbounds.numMinLng = 0 69 | 70 | self.pixelbounds.numMaxLat = round(self.mapGeoHeight*self.scaleFactor,self.sigdigs) 71 | self.pixelbounds.numMaxLng = round(self.mapGeoWidth*self.scaleFactor,self.sigdigs) 72 | 73 | self.viewBox.x = round(self.pixelbounds.numMinLng-self.pixelPadding,self.sigdigs) 74 | self.viewBox.y = round(self.pixelbounds.numMinLat-self.pixelPadding,self.sigdigs) 75 | self.viewBox.width = round(self.mapPixelWidth+(self.pixelPadding*2),self.sigdigs) 76 | self.viewBox.height = round(self.mapPixelHeight+(self.pixelPadding*2),self.sigdigs) 77 | 78 | return self.viewBox 79 | 80 | def translateLayers(self): 81 | for l in self.orig_layers: 82 | if (l['type'] == 'point'): 83 | self.svg_layers.append(SVGPointLayer(self,l['point_set'],l['id'])) 84 | if (l['type'] == 'multilinestring'): 85 | self.svg_layers.append(SVGLinestringLayer(self,l['multi_set'],l['id'])) 86 | if (l['type'] == 'multipolygon'): 87 | self.svg_layers.append(SVGPolygonLayer(self,l['multi_set'],l['id'])) 88 | return self.svg_layers 89 | 90 | def buildSVGPointLayer(self, layerid, queryset, geomfieldname, idfieldname): 91 | point_set = [] 92 | for q in queryset: 93 | #Problems arise when transforming simplified geometries, and too slow with unsimplified. For now better to create a new field in the model. 94 | #coordinates = getattr(q, geomfieldname).transform(3395, True) 95 | coordinates = getattr(q, geomfieldname) 96 | pointid = getattr(q, idfieldname) 97 | point = Point(coordinates, pointid) 98 | point_set.append(point) 99 | self.orig_layers.append({'type':'point','id':layerid,'point_set':point_set}) 100 | 101 | def buildSVGLinestringLayer(self, layerid, queryset, geomfieldname, idfieldname): 102 | multi_set = [] 103 | for q in queryset: 104 | #Problems arise when transforming simplified geometries, and too slow with unsimplified. For now better to create a new field in your preferred projection in the model rather than transforming here. 105 | #coordinates = getattr(q, geomfieldname).transform(3395, True) 106 | coordinates = getattr(q, geomfieldname) 107 | multiid = getattr(q, idfieldname) 108 | multi = MultiLinestring(coordinates, multiid) 109 | multi_set.append(multi) 110 | self.orig_layers.append({'type':'multilinestring','id':layerid,'multi_set':multi_set}) 111 | 112 | def buildSVGPolygonLayer(self, layerid, queryset, geomfieldname, idfieldname): 113 | multi_set = [] 114 | for q in queryset: 115 | #Problems arise when transforming simplified geometries, and too slow with unsimplified. For now better to create a new field in your preferred projection in the model rather than transforming here. 116 | #coordinates = getattr(q, geomfieldname).transform(3395, True) 117 | coordinates = getattr(q, geomfieldname) 118 | multiid = getattr(q, idfieldname) 119 | multi = MultiPolygon(coordinates, multiid) 120 | multi_set.append(multi) 121 | self.orig_layers.append({'type':'multipolygon','id':layerid,'multi_set':multi_set}) 122 | 123 | def drawSVGPoint(self,point): 124 | point_geom = point.arrGeometry 125 | xpoint = round(self.scaleFactor*(0 - self.geobounds.numMinLng + float(point_geom[0])),self.sigdigs) 126 | ypoint = round(self.scaleFactor*((math.fabs(self.geobounds.numMaxLat)) - float(point_geom[1])),self.sigdigs) 127 | return [xpoint,ypoint] 128 | 129 | def drawSVGLinestring(self,Linestring): 130 | paths = [] 131 | for key in range(len(Linestring.arrGeometry)): 132 | point = Linestring.arrGeometry[key] 133 | 134 | xpoint = round(self.scaleFactor*(0 - self.geobounds.numMinLng + float(point[0])),self.sigdigs) 135 | ypoint = round(self.scaleFactor*((math.fabs(self.geobounds.numMaxLat)) - float(point[1])),self.sigdigs) 136 | paths.append(str(xpoint) + ',' + str(ypoint)) 137 | strSVGPath = 'M' + string.join(paths,'L') 138 | 139 | return strSVGPath 140 | 141 | def drawSVGPolygon(self,polygon): 142 | paths = [] 143 | for key in range(len(polygon.arrGeometry)): 144 | point = polygon.arrGeometry[key] 145 | 146 | if key != len(polygon.arrGeometry)-1: 147 | xpoint = round(self.scaleFactor*(0 - self.geobounds.numMinLng + float(point[0])),self.sigdigs) 148 | ypoint = round(self.scaleFactor*((math.fabs(self.geobounds.numMaxLat)) - float(point[1])),self.sigdigs) 149 | paths.append(str(xpoint) + ',' + str(ypoint)) 150 | strSVGPath = 'M' + string.join(paths,'L') + 'Z' 151 | 152 | return strSVGPath 153 | 154 | 155 | class SVGPointLayer: 156 | def __init__(self,map,pointlist,identifier=''): 157 | self.type = 'point' 158 | self.identifier = identifier 159 | self.geometries = [] 160 | for point in pointlist: 161 | point_string = '' 162 | svgpoint = map.drawSVGPoint(point) 163 | self.geometries.append({'id':point.identifier,'svgpoint':svgpoint}) 164 | 165 | class SVGLinestringLayer: 166 | def __init__(self,map,multilinestringlist,identifier=''): 167 | self.type = 'multilinestring' 168 | self.identifier = identifier 169 | self.geometries = [] 170 | for multilinestring in multilinestringlist: 171 | multi_poly_string = '' 172 | for ring in multilinestring.rings: 173 | svgpath = map.drawSVGLinestring(ring) 174 | multi_poly_string += svgpath 175 | self.geometries.append({'id':string.replace(multilinestring.identifier,'-','_'),'svgstring':multi_poly_string}) 176 | 177 | class SVGPolygonLayer: 178 | def __init__(self,map,multipolygonlist,identifier=''): 179 | self.type = 'multipolygon' 180 | self.identifier = identifier 181 | self.geometries = [] 182 | for multipolygon in multipolygonlist: 183 | multi_poly_string = '' 184 | for ring in multipolygon.rings: 185 | svgpath = map.drawSVGPolygon(ring) 186 | multi_poly_string += svgpath 187 | self.geometries.append({'id':string.replace(multipolygon.identifier,'-','_'),'svgstring':multi_poly_string}) 188 | 189 | class Point: 190 | def __init__(self, arrInputPoint, identifier=''): 191 | self.arrGeometry = arrInputPoint 192 | self.identifier = identifier 193 | 194 | class Linestring: 195 | def __init__(self, arrInputPoints, identifier='', identifierkey=''): 196 | self.arrGeometry = arrInputPoints 197 | self.identifier = '%s-%s' % (identifier, identifierkey) 198 | 199 | class Polygon: 200 | def __init__(self, arrInputPoints, identifier='', identifierkey=''): 201 | self.arrGeometry = arrInputPoints 202 | self.identifier = '%s-%s' % (identifier, identifierkey) 203 | 204 | class MultiLinestring: 205 | def __init__(self, arrInputMultiLinestring, identifier=''): 206 | self.arrGeometry = arrInputMultiLinestring 207 | self.identifier = identifier 208 | self.rings = [] 209 | for key in range(len(arrInputMultiLinestring)): 210 | self.rings.append(Linestring(arrInputMultiLinestring[key],identifier,key)) 211 | 212 | class MultiPolygon: 213 | def __init__(self, arrInputMultiPolygon, identifier=''): 214 | self.arrGeometry = arrInputMultiPolygon 215 | self.identifier = identifier 216 | self.rings = [] 217 | for key in range(len(arrInputMultiPolygon)): 218 | self.rings.append(Polygon(arrInputMultiPolygon[key][0],identifier,key)) 219 | 220 | class LatLngBounds: 221 | def __init__(self, numMinLat=float('inf'), numMaxLat=float('-inf'), numMinLng=float('inf'), numMaxLng=float('-inf')): 222 | self.numMinLat = numMinLat 223 | self.numMaxLat = numMaxLat 224 | self.numMinLng = numMinLng 225 | self.numMaxLng = numMaxLng 226 | 227 | class SVGViewBox: 228 | def __init__(self): 229 | self.x = 0 230 | self.y = 0 231 | self.width = 10 232 | self.height = 10 -------------------------------------------------------------------------------- /svg_map/wisconsin_counties/tl_2010_55_county10.dbf: -------------------------------------------------------------------------------- 1 | n HA%STATEFP10CCOUNTYFP10CCOUNTYNS10CGEOID10CNAME10CdNAMELSAD10CdLSAD10CCLASSFP10CMTFCC10CCSAFP10CCBSAFP10CMETDIVFP10CFUNCSTAT10CALAND10NAWATER10NINTPTLAT10C INTPTLON10C 550110158106555011Buffalo Buffalo County 06H1G4020 A 1739526593 98314066+44.3897593-091.7587135 550510158108555051Iron Iron County 06H1G4020 A 1963660997 416963329+46.3265500-090.2612985 550190158106955019Clark Clark County 06H1G4020 A 3133407354 23235757+44.7335964-090.6102007 550490158108455049Iowa Iowa County 06H1G402035831540 A 1975072643 13869428+43.0010208-090.1336915 550470158108355047Green Lake Green Lake County 06H1G4020 A 905037501 79929990+43.7614097-088.9872277 550550158108755055Jefferson Jefferson County 06H1G4020 48020 A 1441259924 68019815+43.0138065-088.7739855 550150158106755015Calumet Calumet County 06H1G402011811540 A 824227417 204196417+44.0784104-088.2121322 550310158107555031Douglas Douglas County 06H1G4020 20260 A 3377697851 454647037+46.4633156-091.8925795 550830158110255083Oconto Oconto County 06H1G4020 24580 A 2584775696 390589546+44.9965754-088.2065162 550610158109055061Kewaunee Kewaunee County 06H1G4020 24580 A 887118289 1921198771+44.5009489-087.1618133 550570158108855057Juneau Juneau County 06H1G4020 A 1986327042 96096159+43.9328362-090.1139837 550630158109155063La Crosse La Crosse County 06H1G4020 29100 A 1169862598 73139930+43.9082222-091.1117584 550850158110355085Oneida Oneida County 06H1G4020 A 2882578692 318622517+45.7137913-089.5366933 550950158110855095Polk Polk County 06H1G4020 A 2367150768 109933269+45.4680297-092.4531541 550590158108955059Kenosha Kenosha County 06H1G40201761698029404A 704452046 1248438057+42.5797028-087.4248983 550930158110755093Pierce Pierce County 06H1G402037833460 A 1485999482 46945602+44.7253365-092.4262793 550370158107855037Florence Florence County 06H1G4020 27020 A 1264419915 24160218+45.8496459-088.4003217 550230158107155023Crawford Crawford County 06H1G4020 A 1478001974 73945297+43.2499100-090.9512302 550010158106055001Adams Adams County 06H1G4020 A 1672214172 111125910+43.9737629-089.7672232 551210158112055121Trempealeau Trempealeau County 06H1G4020 A 1898370021 23371308+44.3030501-091.3588668 551230158112155123Vernon Vernon County 06H1G4020 A 2050180266 64301270+43.5998583-090.8152256 551410158113055141Wood Wood County 06H1G4020 32270 A 2054162108 42280594+44.4614126-090.0388252 551070158111455107Rusk Rusk County 06H1G4020 A 2366174321 44800571+45.4727340-091.1367448 551330158112655133Waukesha Waukesha County 06H1G402037633340 A 1423388982 80346783+43.0193081-088.3067069 551130158111655113Sawyer Sawyer County 06H1G4020 A 3256403571 240766843+45.8649127-091.1471302 551310158112555131Washington Washington County 06H1G402037633340 A 1115515204 13005075+43.3911560-088.2329166 550330158107655033Dunn Dunn County 06H1G402023232860 A 2201762202 35638625+44.9477408-091.8977203 551250158112255125Vilas Vilas County 06H1G4020 A 2218594892 417610669+46.0498480-089.5012540 550670158109355067Langlade Langlade County 06H1G4020 A 2254946857 44657283+45.2592039-089.0681897 550390158107955039Fond du Lac Fond du Lac County 06H1G402025222540 A 1863633125 119883005+43.7547219-088.4932840 550350158107755035Eau Claire Eau Claire County 06H1G402023220740 A 1652369085 18811805+44.7263547-091.2864137 551010158111155101Racine Racine County 06H1G402037639540 A 861173331 1190399042+42.7540747-087.4146760 551190158111955119Taylor Taylor County 06H1G4020 A 2524917815 24721890+45.2116558-090.5048529 550810158110155081Monroe Monroe County 06H1G4020 A 2332998070 19275338+43.9451751-090.6199687 550070158106355007Bayfield Bayfield County 06H1G4020 A 3827647135 1460263062+46.6341992-091.1772815 550750158109755075Marinette Marinette County 06H1G4020 31940 A 3624293202 390213400+45.3468989-087.9911980 550170158106855017Chippewa Chippewa County 06H1G402023220740 A 2611672690 85235029+45.0690918-091.2835054 550780158109955078Menominee Menominee County 06H1G4020 A 926201079 19038425+44.9913041-088.6692512 550250158107255025Dane Dane County 06H1G402035831540 A 3100835926 106205344+43.0674684-089.4178523 551370158112855137Waushara Waushara County 06H1G4020 A 1621729475 29151283+44.1128248-089.2397520 551390158112955139Winnebago Winnebago County 06H1G402011836780 A 1125316243 373177955+44.0857068-088.6681488 550910158110655091Pepin Pepin County 06H1G4020 A 600833973 43282761+44.6274362-091.8348898 551290158112455129Washburn Washburn County 06H1G4020 A 2064513142 145566458+45.8924633-091.7964225 551030158111255103Richland Richland County 06H1G4020 A 1518123695 8153431+43.3761994-090.4356927 550530158108655053Jackson Jackson County 06H1G4020 A 2558182292 32520538+44.3248946-090.8065413 551350158112755135Waupaca Waupaca County 06H1G4020 A 1936566893 45301523+44.4780040-088.9670056 550450158108255045Green Green County 06H1G4020 33820 A 1512440867 1315724+42.6777275-089.6056390 551050158111355105Rock Rock County 06H1G4020 27500 A 1859980029 20625910+42.6699307-089.0751194 550290158107455029Door Door County 06H1G4020 A 1248316135 4890602262+45.0678080-087.0879363 550990158111055099Price Price County 06H1G4020 A 3248817969 62273299+45.6790724-090.3596497 550130158106655013Burnett Burnett County 06H1G4020 A 2128575375 151213123+45.8652545-092.3679775 550790158110055079Milwaukee Milwaukee County 06H1G402037633340 A 625228895 2455664378+43.0176546-087.4815749 550030158106155003Ashland Ashland County 06H1G4020 A 2706628242 3230607930+46.5462905-090.6651539 550210158107055021Columbia Columbia County 06H1G402035831540 A 1982711486 78845739+43.4718818-089.3304721 551110158111555111Sauk Sauk County 06H1G402035812660 A 2152025932 45881330+43.4279976-089.9433290 550050158106255005Barron Barron County 06H1G4020 A 2234411472 70065655+45.4371917-091.8528921 550770158109855077Marquette Marquette County 06H1G4020 A 1180003730 22524386+43.8260529-089.4090953 550870158110455087Outagamie Outagamie County 06H1G402011811540 A 1651177709 18299478+44.4182258-088.4649883 551090158183355109St. Croix St. Croix County 06H1G402037833460 A 1870824361 34588261+45.0289589-092.4472842 550430158108155043Grant Grant County 06H1G4020 38420 A 2970324643 94521211+42.8700621-090.6953683 551150158111755115Shawano Shawano County 06H1G4020 A 2313007314 42514240+44.7896407-088.7558134 550650158109255065Lafayette Lafayette County 06H1G4020 A 1640985371 2539100+42.6555782-090.1302916 550090158106455009Brown Brown County 06H1G4020 24580 A 1371938244 222741055+44.4739612-087.9959258 551170158111855117Sheboygan Sheboygan County 06H1G4020 43100 A 1324171349 1968280402+43.7460015-087.7305455 550710158109555071Manitowoc Manitowoc County 06H1G4020 31820 A 1525716187 2343921717+44.1051076-087.3138281 550890158110555089Ozaukee Ozaukee County 06H1G402037633340 A 603666538 2287271020+43.3607150-087.4965534 550970158110955097Portage Portage County 06H1G4020 44620 A 2073747839 56926153+44.4762457-089.4980699 550730158109655073Marathon Marathon County 06H1G402055448140 A 4001488029 81139058+44.8980363-089.7578230 551270158112355127Walworth Walworth County 06H1G4020 48580 A 1437771449 55507309+42.6681095-088.5417306 550410158108055041Forest Forest County 06H1G4020 A 2626421270 83551459+45.6668822-088.7732251 550270158107355027Dodge Dodge County 06H1G402025213180 A 2267857853 81401698+43.4227057-088.7043791 550690158109455069Lincoln Lincoln County 06H1G402055432980 A 2276530049 72588161+45.3383191-089.7420823 -------------------------------------------------------------------------------- /svg_map/wisconsin_counties/tl_2010_55_county10.shp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | U.S. Department of Commerce, U.S. Census Bureau, Geography Division 7 | 2010 8 | TIGER/Line Shapefile, 2010, 2010 state, Wisconsin, 2010 Census County and Equivalent State-based 9 | 2010 10 | vector digital data 11 | http://www.census.gov/geo/www/tiger 12 | 13 | 14 | 15 | The TIGER/Line Files are shapefiles and related database files (.dbf) that are an extract of selected geographic and cartographic information from the U.S. Census Bureau's Master Address File / Topologically Integrated Geographic Encoding and Referencing (MAF/TIGER) Database (MTDB). The MTDB represents a seamless national file with no overlaps or gaps between parts, however, each TIGER/Line File is designed to stand alone as an independent data set, or they can be combined to cover the entire nation. The primary legal divisions of most States are termed counties. In Louisiana, these divisions are known as parishes. In Alaska, which has no counties, the equivalent entities are the organized boroughs, city and boroughs, and municipalities, and for the unorganized area, census areas. The latter are delineated cooperatively for statistical purposes by the State of Alaska and the Census Bureau. In four States (Maryland, Missouri, Nevada, and Virginia), there are one or more incorporated places that are independent of any county organization and thus constitute primary divisions of their States. These incorporated places are known as independent cities and are treated as equivalent entities for purposes of data presentation. The District of Columbia and Guam have no primary divisions, and each area is considered an equivalent entity for purposes of data presentation. The Census Bureau treats the following entities as equivalents of counties for purposes of data presentation: Municipios in Puerto Rico, Districts and Islands in American Samoa, Municipalities in the Commonwealth of the Northern Mariana Islands, and Islands in the U.S. Virgin Islands. The entire area of the United States, Puerto Rico, and the Island Areas is covered by counties or equivalent entities. The 2010 Census boundaries for counties and equivalent entities are as of January 1, 2010, primarily as reported through the Census Bureau's Boundary and Annexation Survey (BAS). 16 | 17 | In order for others to use the information in the Census MAF/TIGER database in a geographic information system (GIS) or for other geographic applications, the Census Bureau releases to the public extracts of the database in the form of TIGER/Line Shapefiles. 18 | Wisconsin(55) 19 | 20 | 21 | 22 | 23 | 201001 24 | 201007 25 | 26 | 27 | Publication Date 28 | 29 | 30 | Complete 31 | TIGER/Line Shapefiles are extracted from the Census MAF/TIGER database. No changes or updates will be made to this version of the TIGER/Line Shapefiles. Future releases of TIGER/Line Shapefiles will reflect updates made to the Census MAF/TIGER database. 32 | 33 | 34 | 35 | -92.889433 36 | -86.249548 37 | 47.309822 38 | 42.49172 39 | 40 | 41 | 42 | 43 | ISO 19115 Topic Categories 44 | boundaries 45 | 46 | 47 | None 48 | 49 | State or equivalent entity 50 | Polygon 51 | 52 | 53 | INCITS.38-200x (R2004),INCITS.31-200x (R2007),INCITS.454-200x,INCITS 455-200x,INCITS 446-2008 54 | United States 55 | U.S. 56 | State or Equivalent Entity 57 | Wisconsin 58 | WI 59 | 55 60 | 61 | 62 | None 63 | The TIGER/Line Shapefile products are not copyrighted however TIGER/Line and Census TIGER are registered trademarks of the U.S. Census Bureau. These products are free to use in a product or publication, however acknowledgement must be given to the U.S. Census Bureau as the source. 64 | The boundary information in the TIGER/Line Shapefiles are for statistical data collection and tabulation purposes only; their depiction and designation for statistical purposes does not constitute a determination of jurisdictional authority or rights of ownership or entitlement and they are not legal land descriptions.Coordinates in the TIGER/Line shapefiles have six implied decimal places, but the positional accuracy of these coordinates is not as great as the six decimal places suggest. 65 | Yes, the data are free from Title 13 restrictions 66 | 67 | 68 | 69 | U.S. Department of Commerce, U.S. Census Bureau, Geography Division, Geographic Products Branch 70 | 71 | 72 | Mailing address 73 |
4600 Silver Hill Road, Stop 7400
74 | Washington 75 | DC 76 | 20233-7400 77 | United States 78 |
79 | 301-763-1128 80 | 301-763-4710 81 | geo.tiger@census.gov 82 |
83 |
84 |
85 | 8859part1 86 | eng 87 | 88 | 89 | Accurate against Federal Information Processing Standards (FIPS), FIPS Publication 6-4, and FIPS-55 at the 100% level for the codes and base names. The remaining attribute information has been examined but has not been fully tested for accuracy. 90 | 91 | The Census Bureau performed automated tests to ensure logical consistency and limits of shapefiles. Segments making up the outer and inner boundaries of a polygon tie end-to-end to completely enclose the area. All polygons are tested for closure. 92 | The Census Bureau uses its internally developed geographic update system to enhance and modify spatial and attribute data in the Census MAF/TIGER database. Standard geographic codes, such as FIPS codes for states, counties, municipalities, county subdivisions, places, American Indian/Alaska Native/Native Hawaiian areas, and congressional districts are used when encoding spatial entities. The Census Bureau performed spatial data tests for logical consistency of the codes during the compilation of the original Census MAF/TIGER database files. Most of the codes for geographic entities except states, counties, urban areas, Core Based Statistical Areas (CBSAs), American Indian Areas (AIAs), and congressional districts were provided to the Census Bureau by the USGS, the agency responsible for maintaining FIPS 55. Feature attribute information has been examined but has not been fully tested for consistency. 93 | For the TIGER/Line Shapefiles, the Point and Vector Object Count for the G-polygon SDTS Point and Vector Object Type reflects the number of records in the shapefile attribute table. For multi-polygon features, only one attribute record exists for each multi-polygon rather than one attribute record per individual G-polygon component of the multi-polygon feature. TIGER/Line Shapefile multi-polygons are an exception to the G-polygon object type classification. Therefore, when multi-polygons exist in a shapefile, the object count will be less than the actual number of G-polygons. 94 | Data completeness of the TIGER/Line Shapefiles reflects the contents of the Census MAF/TIGER database at the time the TIGER/Line Shapefiles were created. 95 | 96 | 97 | 98 | 99 | U.S. Department of Commerce, U.S. Census Bureau, Geography Division 100 | Unpublished material 101 | Census MAF/TIGER database 102 | 103 | 104 | online 105 | 106 | 107 | 108 | 201001 109 | 201007 110 | 111 | 112 | Publication Date 113 | 114 | MAF/TIGER 115 | The selected geographic and cartographic information (line segments) are derived from the U.S. Census Bureau's Master Address File Topologically Integrated Geographic Encoding and Referencing (MAF/TIGER) database. 116 | 117 | 118 | TIGER/Line Shapefiles are extracted from the Census MAF/TIGER database by nation, state, county, and entity. Census MAF/TIGER data for all of the aforementioned geographic entities are then distributed among the shapefiles each containing attributes for line, polygon, or landmark geographic data. 119 | Census MAF/TIGER 120 | 2010 121 | 122 | 123 | 124 | 125 | Federal Information Processing Standards (FIPS), ANSI, and feature names. 126 | Vector 127 | 128 | 129 | G-polygon 130 | 72 131 | 132 | 133 | 134 | 135 | 136 | 137 | 0.000458 138 | 0.000458 139 | Decimal degrees 140 | 141 | 142 | North American Datum of 1983 in the 48 contiguous states, the District of Columbia, Alaska, Hawaii, Puerto Rico, the Virgin Islands of the United States, and the Pacific Island Areas. 143 | Geodetic Reference System 80 144 | 6378137 145 | 298257 146 | 147 | 148 | 149 | 150 | 151 | 152 | COUNTY10.shp 153 | 2010 Census County and Equivalent State-based 154 | U.S. Census Bureau 155 | 156 | 157 | STATEFP10 158 | 2010 Census state Federal Information Processing Standards 159 | (FIPS) codes 160 | U.S. Census Bureau 161 | 162 | 163 | INCITS.38-200x (R2004), Codes for the Identification of 164 | the States, the District of Columbia, Puerto Rico, and the 165 | Insular Areas of the United States (Formerly FIPS 5-2) 166 | U.S. Census Bureau 167 | 168 | 169 | 170 | 171 | COUNTYFP10 172 | 2010 Census county Federal Information Processing Standards 173 | (FIPS) code 174 | U.S. Census Bureau 175 | 176 | 177 | INCITS.31-200x (R2007), Codes for the Identification of 178 | the Counties and Equivalent Areas of the United States, 179 | Puerto Rico, and the Insular Areas of the United States 180 | (Formerly FIPS 6-4) 181 | U.S. Census Bureau 182 | 183 | 184 | 185 | 186 | COUNTYNS10 187 | 2010 Census county ANSI code 188 | U.S. Census Bureau 189 | 190 | 191 | INCITS 446-2008, (GNIS) Identifying Attributes for Named 192 | Physical and Cultural Geographic Features (Except Roads 193 | and Highways) of the United States, Its Territories, 194 | Outlying Areas, and Freely Associated Areas, and the 195 | Waters of the Same to the Limit of the Twelve-Mile 196 | Statutory Zone 197 | U.S. Geological Survey (USGS) 198 | 199 | 200 | 201 | 202 | GEOID10 203 | County identifier; a concatenation of 2010 Census state FIPS 204 | code and county FIPS code 205 | U.S. Census Bureau 206 | 207 | 208 | INCITS.38-200x (R2004), Codes for the Identification of 209 | the States, the District of Columbia, Puerto Rico, and the 210 | Insular Areas of the United States (Formerly FIPS 5-2), 211 | INCITS.31-200x (R2007), Codes for the Identification of 212 | the Counties and Equivalent Areas of the United States, 213 | Puerto Rico, and the Insular Areas of the United States 214 | (Formerly FIPS 6-4) 215 | U.S. Census Bureau 216 | 217 | 218 | 219 | 220 | NAME10 221 | 2010 Census county name 222 | U.S. Census Bureau 223 | 224 | 225 | INCITS.31-200x (R2007), Codes for the Identification of 226 | the Counties and Equivalent Areas of the United States, 227 | Puerto Rico, and the Insular Areas of the United States 228 | (Formerly FIPS 6-4) 229 | U.S. Census Bureau 230 | 231 | 232 | 233 | 234 | NAMELSAD10 235 | 2010 Census name and the translated legal/statistical area 236 | description code for county 237 | U.S. Census Bureau 238 | 239 | 240 | INCITS.31-200x (R2007), Codes for the Identification of 241 | the Counties and Equivalent Areas of the United States, 242 | Puerto Rico, and the Insular Areas of the United States 243 | (Formerly FIPS 6-4) and the translated legal/statistical 244 | area description code for county that appears in LSAD10 245 | U.S. Census Bureau 246 | 247 | 248 | 249 | 250 | LSAD10 251 | 2010 Census legal/statistical area description code for county 252 | U.S. Census Bureau 253 | 254 | 255 | 00 256 | Blank 257 | U.S. Census Bureau 258 | 259 | 260 | 03 261 | City and Borough 262 | U.S. Census Bureau 263 | 264 | 265 | 04 266 | Borough 267 | U.S. Census Bureau 268 | 269 | 270 | 05 271 | Census Area 272 | U.S. Census Bureau 273 | 274 | 275 | 06 276 | County 277 | U.S. Census Bureau 278 | 279 | 280 | 07 281 | District 282 | U.S. Census Bureau 283 | 284 | 285 | 10 286 | Island 287 | U.S. Census Bureau 288 | 289 | 290 | 12 291 | Municipality 292 | U.S. Census Bureau 293 | 294 | 295 | 13 296 | Municipio 297 | U.S. Census Bureau 298 | 299 | 300 | 15 301 | Parish 302 | U.S. Census Bureau 303 | 304 | 305 | 25 306 | city 307 | U.S. Census Bureau 308 | 309 | 310 | 311 | 312 | CLASSFP10 313 | 2010 Census Federal Information Processing Standards (FIPS) 314 | class code 315 | U.S. Census Bureau 316 | 317 | 318 | C7 319 | An incorporated place that is independent of any county 320 | U.S. Census Bureau 321 | 322 | 323 | H1 324 | An active county or equivalent feature 325 | U.S. Census Bureau 326 | 327 | 328 | H4 329 | An inactive county or equivalent feature 330 | U.S. Census Bureau 331 | 332 | 333 | H5 334 | A statistical county equivalent feature 335 | U.S. Census Bureau 336 | 337 | 338 | H6 339 | A county that is coextensive with an incorporated place, 340 | part of an incorporated place, or a consolidated city and 341 | the governmental functions of the county are part of the 342 | municipal govenment 343 | U.S. Census Bureau 344 | 345 | 346 | 347 | 348 | MTFCC10 349 | MAF/TIGER feature class code 350 | U.S. Census Bureau 351 | 352 | 353 | G4020 354 | County or Equivalent Feature 355 | U.S. Census Bureau 356 | 357 | 358 | 359 | 360 | CSAFP10 361 | 2010 Census combined statistical area code 362 | U.S. Census Bureau 363 | 364 | 365 | 100 366 | 599 367 | 368 | 369 | 370 | 371 | CBSAFP10 372 | 2010 Census metropolitan statistical area/micropolitan 373 | statistical area code 374 | U.S. Census Bureau 375 | 376 | 377 | 10000 378 | 49999 379 | 380 | 381 | 382 | 383 | METDIVFP10 384 | 2010 Census metropolitan division code 385 | U.S. Census Bureau 386 | 387 | 388 | 10004 389 | 49994 390 | 391 | 392 | 393 | 394 | FUNCSTAT10 395 | 2010 Census functional status 396 | U.S. Census Bureau 397 | 398 | 399 | A 400 | Active government providing primary general-purpose functions 401 | U.S. Census Bureau 402 | 403 | 404 | B 405 | Active government that is partially consolidated with 406 | another government but with separate officials providing 407 | primary general-purpose functions 408 | U.S. Census Bureau 409 | 410 | 411 | C 412 | Active government consolidated with another government with 413 | a single set of officials 414 | U.S. Census Bureau 415 | 416 | 417 | F 418 | Fictitious entity created to fill the Census Bureau 419 | geographic hierarchy 420 | U.S. Census Bureau 421 | 422 | 423 | G 424 | Active government that is subordinate to another unit of 425 | government 426 | U.S. Census Bureau 427 | 428 | 429 | N 430 | Nonfunctioning legal entity 431 | U.S. Census Bureau 432 | 433 | 434 | S 435 | Statistical entity 436 | U.S. Census Bureau 437 | 438 | 439 | 440 | 441 | ALAND10 442 | 2010 Census land area (square meters) 443 | U.S. Census Bureau 444 | 445 | 446 | 0 to 9,999,999,999,999 447 | Blank 448 | U.S. Census Bureau 449 | 450 | 451 | 452 | 453 | AWATER10 454 | 2010 Census water area (square meters) 455 | U.S. Census Bureau 456 | 457 | 458 | 0 to 9,999,999,999,999 459 | Blank 460 | U.S. Census Bureau 461 | 462 | 463 | 464 | 465 | INTPTLAT10 466 | 2010 Census latitude of the internal point 467 | U.S. Census Bureau 468 | 469 | 470 | 00 471 | Blank 472 | U.S. Census Bureau 473 | 474 | 475 | 476 | 477 | INTPTLON10 478 | 2010 Census longitude of the internal point 479 | U.S. Census Bureau 480 | 481 | 482 | 00 483 | Blank 484 | U.S. Census Bureau 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | U.S. Department of Commerce, U.S. Census Bureau, Geography Division, Geographic Products Branch 495 | 496 | 497 | Mailing address 498 |
4600 Silver Hill Road, Stop 7400
499 | Washington 500 | DC 501 | 20233-7400 502 | United States 503 |
504 | 301-763-1128 505 | 301-763-4710 506 | geo.tiger@census.gov 507 |
508 |
509 | No warranty, expressed or implied is made with regard to the accuracy of these data, and no liability is assumed by the U.S. Government in general or the U.S. Census Bureau in specific as to the spatial or attribute accuracy of the data. The act of distribution shall not constitute any such warranty and no responsibility is assumed by the U.S. government in the use of these files. The boundary information in the TIGER/Line Shapefiles is for statistical data collection and tabulation purposes only; their depiction and designation for statistical purposes do not constitute a determination of jurisdictional authority or rights of ownership or entitlement and they are not legal land descriptions. 510 | 511 | 512 | 513 | TGRSHP (compressed) 514 | PK-ZIP, version 1.93 A or higher 515 | 516 | 517 | 518 | 519 | 520 | http://www.census.gov/geo/www/tiger 521 | 522 | 523 | 524 | 525 | DVD-ROM (Only if offered offline) 526 | ISO 9660 527 | 528 | 529 | 530 | The online copy of the TIGER/Line files may be accessed without charge. 531 | To obtain more information about ordering TIGER/Line shapefiles visit http://www.census.gov/geo/www/tiger 532 | 533 | The TIGER/Line shapefiles contain geographic data only and do not include display mapping software or statistical data. For information on how to use the TIGER/Line shapefile data with specific software package users shall contact the company that produced the software. 534 |
535 | 536 | 20100507 537 | 538 | 539 | 540 | U.S. Department of Commerce, U.S. Census Bureau, Geography Division, Geographic Products Branch 541 | 542 | 543 | Mailing address 544 |
4600 Silver Hill Road, Stop 7400
545 | Washington 546 | DC 547 | 20233-7400 548 | United States 549 |
550 | 301-763-1128 551 | 301-763-4710 552 | geo.tiger@census.gov 553 |
554 |
555 | FGDC Content Standards for Digital Geospatial Metadata 556 | FGDC-STD-001-1998 557 | 8859part1 558 | tl_2010_55_county10.shp.xml 559 | eng 560 |
561 |
562 | -------------------------------------------------------------------------------- /static/js/raphael-2.0.2-min.js: -------------------------------------------------------------------------------- 1 | // ┌────────────────────────────────────────────────────────────────────┐ \\ 2 | // │ Raphaël 2.0.2 - JavaScript Vector Library │ \\ 3 | // ├────────────────────────────────────────────────────────────────────┤ \\ 4 | // │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ 5 | // │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\ 6 | // ├────────────────────────────────────────────────────────────────────┤ \\ 7 | // │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\ 8 | // └────────────────────────────────────────────────────────────────────┘ \\ 9 | (function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;tf*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bH(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;yd)return d;while(cf?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function m(a){return((i*a+h)*a+g)*a}var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;return n(a,1/(200*f))}function ce(){return this.x+q+this.y+q+this.width+" × "+this.height}function cd(){return this.x+q+this.y}function bR(a,b,c,d,e,f){a!=null?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bx(a,b){var c=[];for(var d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function bw(){return this.hex}function bu(a,b,c){function d(){var e=Array.prototype.slice.call(arguments,0),f=e.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];if(h[g](f)){bt(i,f);return c?c(h[f]):h[f]}i.length>=1e3&&delete h[i.shift()],i.push(f),h[f]=a[m](b,e);return c?c(h[f]):h[f]}return d}function bt(a,b){for(var c=0,d=a.length;c',bl=bk.firstChild,bl.style.behavior="url(#default#VML)";if(!bl||typeof bl.adj!="object")return a.type=p;bk=null}a.svg=!(a.vml=a.type=="VML"),a._Paper=j,a.fn=k=j.prototype=a.prototype,a._id=0,a._oid=0,a.is=function(a,b){b=v.call(b);if(b=="finite")return!M[g](+a);if(b=="array")return a instanceof Array;return b=="null"&&a===null||b==typeof a&&a!==null||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||H.call(a).slice(8,-1).toLowerCase()==b},a.angle=function(b,c,d,e,f,g){if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return(180+w.atan2(-i,-h)*180/B+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)},a.rad=function(a){return a%360*B/180},a.deg=function(a){return a*180/B%360},a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,E)){var e=b.length;while(e--)if(z(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(fb-d)return c-f+b}return c};var bm=a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=w.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)});a.setWindow=function(b){eve("setWindow",a,h.win,b),h.win=b,h.doc=h.win.document,a._engine.initWin&&a._engine.initWin(h.win)};var bn=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write(""),e.close(),d=e.body}catch(f){d=createPopup().document.body}var g=d.createTextRange();bn=bu(function(a){try{d.style.color=r(a).replace(c,p);var b=g.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=h.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",h.doc.body.appendChild(i),bn=bu(function(a){i.style.color=a;return h.doc.defaultView.getComputedStyle(i,p).getPropertyValue("color")})}return bn(b)},bo=function(){return"hsb("+[this.h,this.s,this.b]+")"},bp=function(){return"hsl("+[this.h,this.s,this.l]+")"},bq=function(){return this.hex},br=function(b,c,d){c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(d=b.b,c=b.g,b=b.r);if(c==null&&a.is(b,D)){var e=a.getRGB(b);b=e.r,c=e.g,d=e.b}if(b>1||c>1||d>1)b/=255,c/=255,d/=255;return[b,c,d]},bs=function(b,c,d,e){b*=255,c*=255,d*=255;var f={r:b,g:c,b:d,hex:a.rgb(b,c,d),toString:bq};a.is(e,"finite")&&(f.opacity=e);return f};a.color=function(b){var c;a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b?(c=a.hsb2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b?(c=a.hsl2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):(a.is(b,"string")&&(b=a.getRGB(b)),a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b?(c=a.rgb2hsl(b),b.h=c.h,b.s=c.s,b.l=c.l,c=a.rgb2hsb(b),b.v=c.b):(b={hex:"none"},b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1)),b.toString=bq;return b},a.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;a=a%360/60,i=c*b,h=i*(1-z(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bs(e,f,g,d)},a.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h);if(a>1||b>1||c>1)a/=360,b/=100,c/=100;a*=360;var e,f,g,h,i;a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-z(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bs(e,f,g,d)},a.rgb2hsb=function(a,b,c){c=br(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;f=x(a,b,c),g=f-y(a,b,c),d=g==0?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=g==0?0:g/f;return{h:d,s:e,b:f,toString:bo}},a.rgb2hsl=function(a,b,c){c=br(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;g=x(a,b,c),h=y(a,b,c),i=g-h,d=i==0?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=i==0?0:f<.5?i/(2*f):i/(2-2*f);return{h:d,s:e,l:f,toString:bp}},a._path2string=function(){return this.join(",").replace(Y,"$1")};var bv=a._preload=function(a,b){var c=h.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,h.doc.body.removeChild(this)},c.onerror=function(){h.doc.body.removeChild(this)},h.doc.body.appendChild(c),c.src=a};a.getRGB=bu(function(b){if(!b||!!((b=r(b)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bw};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:bw};!X[g](b.toLowerCase().substring(0,2))&&b.charAt()!="#"&&(b=bn(b));var c,d,e,f,h,i,j,k=b.match(L);if(k){k[2]&&(f=R(k[2].substring(5),16),e=R(k[2].substring(3,5),16),d=R(k[2].substring(1,3),16)),k[3]&&(f=R((i=k[3].charAt(3))+i,16),e=R((i=k[3].charAt(2))+i,16),d=R((i=k[3].charAt(1))+i,16)),k[4]&&(j=k[4][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),k[1].toLowerCase().slice(0,4)=="rgba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100));if(k[5]){j=k[5][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,f,h)}if(k[6]){j=k[6][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsla"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,f,h)}k={r:d,g:e,b:f,toString:bw},k.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1),a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bw}},a),a.hsb=bu(function(b,c,d){return a.hsb2rgb(b,c,d).hex}),a.hsl=bu(function(b,c,d){return a.hsl2rgb(b,c,d).hex}),a.rgb=bu(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b}));return c.hex},a.getColor.reset=function(){delete this.start},a.parsePathString=bu(function(b){if(!b)return null;var c={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bz(b)),d.length||r(b).replace(Z,function(a,b,e){var f=[],g=b.toLowerCase();e.replace(_,function(a,b){b&&f.push(+b)}),g=="m"&&f.length>2&&(d.push([b][n](f.splice(0,2))),g="l",b=b=="m"?"l":"L");if(g=="r")d.push([b][n](f));else while(f.length>=c[g]){d.push([b][n](f.splice(0,c[g])));if(!c[g])break}}),d.toString=a._path2string;return d}),a.parseTransformString=bu(function(b){if(!b)return null;var c={r:3,s:4,t:2,m:6},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bz(b)),d.length||r(b).replace($,function(a,b,c){var e=[],f=v.call(b);c.replace(_,function(a,b){b&&e.push(+b)}),d.push([b][n](e))}),d.toString=a._path2string;return d}),a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3),l=A(j,2),m=i*i,n=m*i,o=k*a+l*3*i*c+j*3*i*i*e+n*g,p=k*b+l*3*i*d+j*3*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,x=j*e+i*g,y=j*f+i*h,z=90-w.atan2(q-s,r-t)*180/B;(q>s||r1&&(v=w.sqrt(v),c=v*c,d=v*d);var x=c*c,y=d*d,A=(f==g?-1:1)*w.sqrt(z((x*y-x*u*u-y*t*t)/(x*u*u+y*t*t))),C=A*c*u/d+(a+h)/2,D=A*-d*t/c+(b+i)/2,E=w.asin(((b-D)/d).toFixed(9)),F=w.asin(((i-D)/d).toFixed(9));E=aF&&(E=E-B*2),!g&&F>E&&(F=F-B*2)}else E=j[0],F=j[1],C=j[2],D=j[3];var G=F-E;if(z(G)>k){var H=F,I=h,J=i;F=E+k*(g&&F>E?1:-1),h=C+c*w.cos(F),i=D+d*w.sin(F),m=bE(h,i,c,d,e,0,g,I,J,[F,H,C,D])}G=F-E;var K=w.cos(E),L=w.sin(E),M=w.cos(F),N=w.sin(F),O=w.tan(G/4),P=4/3*c*O,Q=4/3*d*O,R=[a,b],S=[a+P*L,b-Q*K],T=[h+P*N,i-Q*M],U=[h,i];S[0]=2*R[0]-S[0],S[1]=2*R[1]-S[1];if(j)return[S,T,U][n](m);m=[S,T,U][n](m).join()[s](",");var V=[];for(var W=0,X=m.length;W"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bF(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bF(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y)),i=f-2*d+b-(h-2*f+d),j=2*(d-b)-2*(f-d),k=b-d,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bF(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bF(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y));return{min:{x:y[m](0,p),y:y[m](0,o)},max:{x:x[m](0,p),y:x[m](0,o)}}}),bH=a._path2curve=bu(function(a,b){var c=bB(a),d=b&&bB(b),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][n](bE[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][n](bD(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][n](bD(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](bC(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](bC(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](bC(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](bC(b.x,b.y,b.X,b.Y))}return a},h=function(a,b){if(a[b].length>7){a[b].shift();var e=a[b];while(e.length)a.splice(b++,0,["C"][n](e.splice(0,6)));a.splice(b,1),k=x(c.length,d&&d.length||0)}},i=function(a,b,e,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),e.bx=0,e.by=0,e.x=a[g][1],e.y=a[g][2],k=x(c.length,d&&d.length||0))};for(var j=0,k=x(c.length,d&&d.length||0);j=j)return p;o=p}if(j==null)return k},ch=function(b,c){return function(d,e,f){d=bH(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;oe){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(;c1&&!d.next){for(s in k)k[g](s)&&(r[s]=d.totalOrigin[s]);d.el.attr(r),cs(d.anim,d.el,d.anim.percents[0],null,d.totalOrigin,d.repeat-1)}d.next&&!d.stop&&cs(d.anim,d.el,d.next,null,d.totalOrigin,d.repeat)}}a.svg&&m&&m.paper&&m.paper.safari(),cm.length&&cn(co)},cp=function(a){return a>255?255:a<0?0:a};b_.animateWith=function(b,c,d,e,f,g){var h=this;if(h.removed){g&&g.call(h);return h}var i=d instanceof cr?d:a.animation(d,e,f,g),j,k;cs(i,h,i.percents[0],null,h.attr());for(var l=0,m=cm.length;l.5)*2-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&n!=.5&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/);if(j=="linear"){var t=e.shift();t=-d(t);if(isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient);if(!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,j=="radial"?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x1?G.opacity/100:G.opacity});case"stroke":G=a.getRGB(p),i.setAttribute(o,G.hex),o=="stroke"&&G[b]("opacity")&&q(i,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity}),o=="stroke"&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":(d.type=="circle"||d.type=="ellipse"||c(p).charAt()!="r")&&r(d,p);break;case"opacity":k.gradient&&!k[b]("stroke-opacity")&&q(i,{"stroke-opacity":p>1?p/100:p});case"fill-opacity":if(k.gradient){H=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),H&&(I=H.getElementsByTagName("stop"),q(I[I.length-1],{"stop-opacity":p}));break};default:o=="font-size"&&(p=e(p,10)+"px");var J=o.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[J]=p,d._.dirty=1,i.setAttribute(o,p)}}y(d,f),i.style.visibility=m},x=1.2,y=function(d,f){if(d.type=="text"&&!!(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){g.text=f.text;while(h.firstChild)h.removeChild(h.firstChild);var j=c(f.text).split("\n"),k=[],m;for(var n=0,o=j.length;n"));var $=X.getBoundingClientRect();t.W=m.w=($.right-$.left)/Y,t.H=m.h=($.bottom-$.top)/Y,t.X=m.x,t.Y=m.y+t.H/2,("x"in i||"y"in i)&&(t.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));var _=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var ba=0,bb=_.length;ba.25&&(c=e.sqrt(.25-i(b-.5,2))*((c>.5)*2-1)+.5),m=b+n+c);return o}),f=f.split(/\s*\-\s*/);if(l=="linear"){var p=f.shift();p=-d(p);if(isNaN(p))return null}var q=a._parseDots(f);if(!q)return null;b=b.shape||b.node;if(q.length){b.removeChild(g),g.on=!0,g.method="none",g.color=q[0].color,g.color2=q[q.length-1].color;var r=[];for(var s=0,t=q.length;s')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e,f=b.width,g=b.x,h=b.y;if(!c)throw new Error("VML container not found.");var i=new a._Paper,j=i.canvas=a._g.doc.createElement("div"),k=j.style;g=g||0,h=h||0,f=f||512,d=d||342,i.width=f,i.height=d,f==+f&&(f+="px"),d==+d&&(d+="px"),i.coordsize=u*1e3+n+u*1e3,i.coordorigin="0 0",i.span=a._g.doc.createElement("span"),i.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",j.appendChild(i.span),k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d),c==1?(a._g.doc.body.appendChild(j),k.left=g+"px",k.top=h+"px",k.position="absolute"):c.firstChild?c.insertBefore(j,c.firstChild):c.appendChild(j),i.renderfix=function(){};return i},a.prototype.clear=function(){a.eve("clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}(window.Raphael) --------------------------------------------------------------------------------