CINXE.COM
California’s 8th Congressional District - CA-08 Representatives & District Map - GovTrack.us
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>California’s 8th Congressional District - CA-08 Representatives & District Map - GovTrack.us</title> <link rel="apple-touch-icon" sizes="57x57" href="/static/favicon/apple-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="/static/favicon/apple-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="/static/favicon/apple-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="/static/favicon/apple-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="/static/favicon/apple-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="/static/favicon/apple-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="/static/favicon/apple-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="/static/favicon/apple-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="/static/favicon/apple-icon-180x180.png"> <link rel="icon" type="image/png" sizes="192x192" href="/static/favicon/android-icon-192x192.png"> <link rel="icon" type="image/png" sizes="32x32" href="/static/favicon/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="96x96" href="/static/favicon/favicon-96x96.png"> <link rel="icon" type="image/png" sizes="16x16" href="/static/favicon/favicon-16x16.png"> <link rel="manifest" href="/static/favicon/manifest.json"> <meta name="msapplication-TileColor" content="#9B2347"> <meta name="msapplication-TileImage" content="/static/favicon/ms-icon-144x144.png"> <meta name="theme-color" content="#9B2347"> <link href="/static/vendor/bootstrap.min.css" rel="stylesheet"> <link href="/static/vendor/fontawesome/css/fontawesome.css" rel="stylesheet"> <link href="/static/vendor/fontawesome/css/solid.css" rel="stylesheet"> <link href="/static/vendor/fontawesome/css/brands.css" rel="stylesheet"> <link media="all" rel="stylesheet" href="/static/css/all-min.css?20240426" /> <meta name="description" content="Find your U.S. Congress senators and representative in California’s 8th Congressional District (CA08) using a map." /> <meta name="keywords" content="United States Congress,U.S. Congress,congressional districts,map,senator,senators,representative,representatives,congressman,congressmen,congresswoman,congresswomen,House of Representatives,Senate" /> <meta name="robots" content="noai, noimageai"> <meta name="fediverse:creator" content="@govtrack@mastodon.social" /> <meta property="fb:app_id" content="119329904748946" /> <meta property="og:site_name" content="GovTrack.us" /> <meta property="og:image" content="https://www.govtrack.us/static/images/media_icon.png?20230729" /> <script async src="https://www.googletagmanager.com/gtag/js?id=G-GD8FT6MB9V"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-GD8FT6MB9V'); </script> <script type="text/javascript"> window.post_jquery_load_scripts = []; </script> <!-- Mapbox --> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <script src='https://api.mapbox.com/mapbox-gl-js/v2.6.0-beta.1/mapbox-gl.js'></script> <link href='https://api.mapbox.com/mapbox-gl-js/v2.6.0-beta.1/mapbox-gl.css' rel='stylesheet' /> <style> .spanbullets span:after { display: inline; content: " · "; } .spanbullets span:last-child:after { display: none; content: ""; } #map { width: 100%; height: 80vh; border: 1px solid #999; } </style> </head> <body class=""> <!--[if lt IE 8]><p style="background-color: black; color: white;">Internet Explorer version 8 or any modern web browser is required to use this website, sorry.<![endif]--> <!--[if gt IE 7]><!--> <div id="bodybody"> <div id="skiptocontent"><a href="#maincontent">skip to main content</a></div> <div id="master-fundraiser-bar"> <div class="container"> <a href="/accounts/membership"> Hide All The Ads With a Yearly Membership <span>Subscribe ▶</span> </a> </div> </div> <div id="masthead"> <nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container"> <a id="logo" href="/" class="navbar-brand ">govtrack.us</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav me-auto mb-2 mb-lg-0"> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Bills & Votes </a> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="/congress/bills">Bills and Resolutions</a></li> <li><a class="dropdown-item" href="/congress/votes">Roll Call Votes</a></li> <li><a class="dropdown-item" href="/posts">Coming Up, Recap, and Analysis</a></li> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="/how-a-bill-becomes-a-law">How does a bill become a law?</a></li> <li><a class="dropdown-item" href="/what-is-the-law">What is the law?</a></li> <li><a class="dropdown-item" href="/congressional-procedures">Congressional Procedures</a></li> </ul> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Legislators </a> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="/congress/members">Members of Congress</a></li> <li><a class="dropdown-item" href="/congress/members/map">Congressional Districts Map</a></li> <li><a class="dropdown-item" href="/congress/committees">Committees</a></li> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="/misconduct">Misconduct Database</a></li> <li><a class="dropdown-item" href="/covid-19">COVID-19 in Congress</a></li> <li><a class="dropdown-item" href="/congress/committees/game">Guess the Committee<i>!</i></a></li> </ul> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Using GovTrack </a> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="/how-to-use">How To Use GovTrack</a></li> <li><a class="dropdown-item" href="/for-educators">For Educators</a></li> <li><a class="dropdown-item" href="/for-advocates">For Advocates</a></li> <li><a class="dropdown-item" href="/for-hill-staff">For Congressional Staff</a></li> <li><a class="dropdown-item" href="/for-journalists">For Journalists</a></li> </ul> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> About Us </a> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="/about">About GovTrack.us</a></li> <li><a class="dropdown-item" href="/about-our-data">About Our Data</a></li> <li><a class="dropdown-item" href="/posts/news">Site News</a></li> <li><a class="dropdown-item" href="/press">Press Clips</a></li> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="/reading-list">Books and Games We Recommend</a></li> </ul> </li> </ul> <form class="d-flex" role="search" name="header_search" action="/search"> <label for="master_search_q" class="sr-only">Search GovTrack for</label> <input class="form-control me-2" type="search" placeholder="bill, name, or topic" aria-label="Search" id="master_search_q" name="q"> <button class="btn btn-outline-success" type="submit">Search</button> </form> <ul class="navbar-nav d-flex" style="padding-left: 2em;"> <li id="nav_login" class="nav-item"><a class="nav-link" href="/accounts/login?next=/congress/members/CA/8">Log In</a></li> <li id="nav_session" class="nav-item dropdown" style="display: none"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Your Account </a> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="/accounts/lists">Your Email Subscriptions & Tracker Lists</a></li> <li><a class="dropdown-item" href="/accounts/positions">Your Positions</a></li> <li><a class="dropdown-item" href="/accounts/docket">Your Docket</a></li> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="/accounts/profile" title="">Account Settings</a></li> <li><a class="dropdown-item" href="/accounts/logout?next=/congress/members/CA/8">Log Out</a></li> </ul> </li> </ul> </div> </div> </nav> <div id="sitenewscontainer" class="navbar-default" > <div id="sitenews"> <a href="/posts/456/2024-11-26_what-is-the-social-security-fairness-act-of-2023-about">Analysis and Commentary Nov 26, 2024: <b>What is the Social Security Fairness Act of 2023 About?</b> »</a> </div> <!-- /sitenews --> </div> <!-- /sitenewscontainer --> </div> <!-- /masthead --> <div id="breadcrumbs"> <div class="container"> <nav aria-label="breadcrumb"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="/congress/members">Members of Congress</a></li> <li class="breadcrumb-item"><a href="/congress/members/map">Map</a></li> <li class="breadcrumb-item"><a href="/congress/members/CA">California</a></li> </ol> </nav> </div> </div> <div id="maincontent" class="container"> <div id="content"> <h1>California’s 8<sup>th</sup> Congressional District</h1> <div style="margin: 2em 0"> <form class="form-inline" onsubmit="do_address(); return false;"> <p>Find your representative (a.k.a. congressman or congresswoman) by entering your address:</p> <div class="form-group"> <label for="user-address" class="sr-only">Address</label> <input type="text" class="form-control" id="user-address" placeholder="Enter an address in the United States"> </div> <button type="submit" class="btn btn-primary">Find My District</button> </form> <div style="margin: .5em"><a href="#" onclick="do_by_current_location(); return false;" style="text-decoration: none"><i class="fas fa-map-marker" aria-hidden="true"></i> I’m at home, use my phone/computer’s location</a></div> </div> <div class="row"> <div class="col-md-6"> <h2 style="margin-top: 0"><span>Senators</span></h2> <p>Each state elects two senators to the United States Senate for staggered 6-year terms. Senators represent the entire state. California’s senators are:</p> <div class="row" style="margin-bottom: 1.5em;"> <div class="col-sm-3" style="padding-right: 0; padding-bottom: 1em;"> <img src="/static/legislator-photos/456856-100px.jpeg" alt="Photo" class="img-fluid" /> </div> <div class="col-sm-9"> <div style="margin-bottom: 2px"> <a href="/congress/members/alejandro_padilla/456856" style="font-weight: bold; font-size: 110%; text-decoration: none; color: inherit;"> Alejandro “Alex” Padilla </a> </div> <div>Senior Senator for California</div> <div>Since Jan 20, 2021 (next election in 2028) </div> <div style="margin-bottom: .45em;">Democrat</div> <div class="spanbullets" style="margin-bottom: .75em;"> <span><a href="https://www.padilla.senate.gov">Official Website <i class="fas fa-external-link-alt"></i></a></span> <span><span class="nowrap"><a href="tel:+1-202-224-3553">202-224-3553</a></span></span> </div> <div style="margin-bottom: .5em;"><a href="/congress/members/alejandro_padilla/456856" class="btn btn-success">View Legislative Profile & Get Alerts »</a></div> </div> </div> <div class="row" style="margin-bottom: 1.5em;"> <div class="col-sm-3" style="padding-right: 0; padding-bottom: 1em;"> <div style="border: 1px solid black; width: 100px; height: 120px;" class="img-fluid"> </div> </div> <div class="col-sm-9"> <div style="margin-bottom: 2px"> <a href="/congress/members/laphonza_butler/456954" style="font-weight: bold; font-size: 110%; text-decoration: none; color: inherit;"> Laphonza Butler </a> </div> <div>Junior Senator for California</div> <div>Since Oct 3, 2023 (current term ends Jan 3, 2025) </div> <div style="margin-bottom: .45em;">Democrat</div> <div class="spanbullets" style="margin-bottom: .75em;"> <span><a href="https://www.butler.senate.gov">Official Website <i class="fas fa-external-link-alt"></i></a></span> <span><span class="nowrap"><a href="tel:+1-202-224-3841">202-224-3841</a></span></span> </div> <div style="margin-bottom: .5em;"><a href="/congress/members/laphonza_butler/456954" class="btn btn-success">View Legislative Profile & Get Alerts »</a></div> </div> </div> <h2><span>Representative</span></h2> <p>The United States is divided into 435 congressional districts, each with a population of about 710,000 individuals. Each district elects a representative to the U.S. House of Representatives for a two-year term. Representatives are also called congressmen/congresswomen.</p> <div class="row" style="margin-bottom: 1.5em;"> <div class="col-sm-3" style="padding-right: 0; padding-bottom: 1em;"> <img src="/static/legislator-photos/412382-100px.jpeg" alt="Photo" class="img-fluid" /> </div> <div class="col-sm-9"> <div style="margin-bottom: 2px"> <a href="/congress/members/john_garamendi/412382" style="font-weight: bold; font-size: 110%; text-decoration: none; color: inherit;"> John Garamendi </a> </div> <div>Representative for California's 8th congressional district</div> <div>Since Jan 3, 2023 (current term ends Jan 3, 2025) </div> <div style="margin-bottom: .45em;">Democrat</div> <div class="spanbullets" style="margin-bottom: .75em;"> <span><a href="https://garamendi.house.gov">Official Website <i class="fas fa-external-link-alt"></i></a></span> <span><span class="nowrap"><a href="tel:+1-202-225-1880">202-225-1880</a></span></span> </div> <div style="margin-bottom: .5em;"><a href="/congress/members/john_garamendi/412382" class="btn btn-success">View Legislative Profile & Get Alerts »</a></div> <div style="margin-top: .5em; line-height: 126%; font-size: 85%; color: #555; font-style: italic;">Check the map <span class="visible-xs-inline visible-sm-inline">below</span> to make sure we’ve located your address accurately.</div> </div> </div> </div> <!-- /col --> <div class="col-md-6"> <div style="margin: 2em 0"> <div class="alert alert-info" role="alert" style="padding: 8px; font-size: 14px;"> Some states have changed or are changing their congressional districts for the 2024 election. Although this map based on 2022 congressional districts is still the <i>correct map</i> for determining who represents you in Congress, you may be in a different district when you vote in the 2024 election. </div> </div> <div id='map'></div> <div style="clear: both; text-align: center; margin: 1em"> <div id="embed_teaser"> <a href="#" onclick="$('#embed_teaser').hide(); $('#embed_details').fadeIn(); return false;">Embed this map on your website...</a> </div> <div id="embed_details" style="display: none;"> <div style="text-align: center">Use this HTML code:</div> <pre id="embedpre" wrap="hard" style="overflow: auto; margin: 15px; font-size: 90%; color: black;"><iframe width="425" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.govtrack.us/congress/members/embed/mapframe?state=ca&district=8&bounds=<span id="embedbounds"></span>"></iframe></pre> </div> </div> </div> <!-- /col --> </div> <!-- /row --> <div class="ads footer leaderboard" data-zone="footer"> <div class="explainer">(<a href="/advertising">About Ads</a> | <a href="/accounts/membership">Hide These Ads</a>)</div> </div> </div><!-- /content --> </div> <!-- /container --> </div> <!-- /#bodybody --> <footer id="footer"> <div class="container"> <div class="row"> <nav class="col-6 col-md-2"> <ul> <li><a href="/">Home</a></li> <li><a href="/about">About GovTrack</a></li> <li><a href="/about-our-data">About the Data</a></li> <li><a href="/contact">Contact Us</a></li> <li><a href="/legal">Privacy & Legal</a></li> </ul> </nav> <nav class="col-6 col-md-2"> <ul> <li><a href="/posts/news"><i class="fas fa-list fa-fw"></i>Site News</a></li> <li><a rel="me" href="https://mastodon.social/@GovTrack"><i class="fab fa-mastodon fa-fw"></i>Mastodon</a></li> <li><a href="https://bsky.app/profile/govtrack.us"><i class="fab fa-bluesky fa-fw"></i>Bluesky</a></li> <li><a href="https://www.patreon.com/govtrack"><i class="fas fa-dollar-sign fa-fw"></i><span>Patreon</span></a></li> <li><a href="https://github.com/govtrack"><i class="fab fa-github fa-fw"></i><span>GitHub</span></a></li> </ul> </nav> <section class="col-12 col-md-8"> <p>GovTrack helps everyone learn about and track the activities of the United States Congress. Launched more than 20 years ago, we’re one of the oldest government transparency and accountability websites on the Internet.</p> <p>This is a project of <a href="http://www.civicimpulse.com">Civic Impulse, LLC</a>. GovTrack.us is <b>not</b> a government website.</p> </section> </div> </div> </footer> <div id="error_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="errorModalTitle" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h2 class="modal-title" id="errorModalTitle">[error message]</h2> <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-bs-dismiss="modal">OK</button> </div> </div> </div> </div> <script type="text/javascript" src="/static/vendor/jquery.js"></script> <script type="text/javascript" src="/static/js/jquery.cookie.js"></script> <script type="text/javascript" src="/static/js/jquery-utils.js?20160310"></script> <script type="text/javascript" src="/static/vendor/jquery.lazy.min.js"></script> <script src="/static/vendor/bootstrap.bundle.min.js"></script> <script type="text/javascript" src="/_twostream/user-head?path=/congress/members/CA/8"> </script> <script> gtag('set', 'user_properties', { Registered: the_user ? "Logged In" : "Anonymous", GeoSegment: the_segment }); <!-- Master page elements when using the user-head script --> if (the_user) { $('#nav_login').hide(); $('#nav_session').show(); $('#nav_session > a').text(the_user.email); } </script> <script src="/static/js/govtrack.js?20240911"></script> <script src="/static/js/congressional-districts-bboxes-118-2022.js"> </script> <script> // Mapbox configuration var accessToken = 'pk.eyJ1IjoiZ292dHJhY2siLCJhIjoiY2lua2J1cmwzMHhyNnVrbHl3bmx4ZnZneiJ9.Wld_AdbKwOgmF2ZXn2SPmw'; var styleURL = 'mapbox://styles/govtrack/clc1uktpa003214o289yqxbvl'; var mapId = 'govtrack.cd\u002D118\u002D2022\u002Darp'; var state = "CA"; var district = parseInt("8"); if (district < 10) district = "0" + district; else district = "" + district; var bbox; if (state && district) bbox = bboxes[state + district] else if (state) bbox = bboxes[state]; else bbox = [-128.8, 23.5, -65.4, 53]; // United States function lngLatBoundsToCameraOptions(bounds) { var w = $('#map').width(); var h = $('#map').height(); // during initialization the element dimensions may not be available and can be negative?! in which case use the window dimensions if (!w || !h || (w*h) < 320*200) { w = $(window).width(); h = $(window).height(); } var zoom = Math.log(((w*h) / ((bounds.getNorth()-bounds.getSouth()) * (bounds.getEast() - bounds.getWest())))) / 1.75 return { center: bounds.getCenter(), zoom: zoom }; } // Initialize the map // Use an Albers equal area projection. Center the projection on the state/district // if we're opening on a state/district to minimize distortion in the default view, // although that creates an interesting effect when zooming out! mapboxgl.accessToken = accessToken; var bounds = mapboxgl.LngLatBounds.convert([[bbox[0], bbox[1]], [bbox[2], bbox[3]]]); var camera = lngLatBoundsToCameraOptions(bounds); var projection = null; if (state != "AK" && state != "AS") // the albers projection doesn't work right for these projection = { name: 'albers', center: camera.center.toArray(), parallels: [23.5, 53] }; var map = new mapboxgl.Map({ container: 'map', style: styleURL, projection: projection, center: camera.center, zoom: camera.zoom }); // Once map is fully loaded... map.on('load', function() { // set controls map.addControl(new mapboxgl.NavigationControl(), 'top-left'); map.touchZoomRotate.disableRotation(); // Create a filter to show only the selected state and district. map.showCongressionalDistrict = function(state, district) { var filter = ['all']; if (state) filter.push(['==', 'state', state]); if (district) filter.push(['==', 'number', district]); map.setFilter("CD-Fills", filter); // Could also do CD-Outlines and CD-Labels. } map.showCongressionalDistrict(state, district); }); // Add markers. map.addMarker = function(label, lnglat) { var marker = new mapboxgl.Popup({ closeButton: false, closeOnClick: false }).setLngLat(lnglat) .setText(label) .addTo(map); return marker; }; function address_to_latlng(address, callback) { $.ajax({ url: 'https://api.mapbox.com/geocoding/v5/mapbox.places/' + encodeURIComponent(address) + '.json?country=us&access_token=' + accessToken, method: 'GET', success: function(resp) { if (resp.type == "FeatureCollection" && resp.features.length > 0) { callback(resp.features[0].center); return; } alert("Could not find that address."); } }); } function map_click_to_district(clickEventData, callback) { // The map control provides a client-side-only way to determine what // is under the cursor. But this only sees features that are currently // shown on the map. so if a filter is applied and the click is on // a district that is not shown, then this will miss the feature, // but we'll fall back to the tilequery API in that case. And it // uses the click event's screen coordinate. var features = map.queryRenderedFeatures( clickEventData.point, { layers: ["CD-Fills"] }); if (features.length > 0) { callback(features[0].properties); return; } if (!map.getFilter("CD-Fills")) { // If no filter is applied, then a negative result is definitive. callback(null); return; } // Fall back to the Mapbox Tilequery API. This is likely to happen // if a filter is applied (which you could test with // map.getFilter("CD-Fills"), but we might as well see if the click // is on a rendered feature before hitting the API. return latlng_to_district(clickEventData.lngLat, callback); } function latlng_to_district(lngLat, callback) { // Note that, from the Mapbox API docs: // "Use of this endpoint is rate limited to 600 requests per minute." $.ajax({ url: 'https://api.mapbox.com/v4/' + mapId + '/tilequery/' + lngLat.lng + ',' + lngLat.lat + '.json?radius=0&access_token=' + accessToken, method: 'GET', success: function(resp) { if (resp.type == "FeatureCollection" && resp.features.length > 0) // resp is always a FeatureCollection, just sanity checking, but it might // be empty. If it's not empty, it will contain a single Feature // (whose geometry is a Polygon) represending the boundaries of a // congressional district. Its properties come from the original // GeoJSON uploaded to Mapbox. callback(resp.features[0].properties); else // Click was not on a district. callback(null); } }); } </script> <script> var current_district_popup; var hover_popup = new mapboxgl.Popup({ closeButton: false, closeOnClick: false }); map.on("mouseenter", "CD-Fills", function(e) { map.getCanvas().style.cursor = 'pointer'; }); //map.on("mouseleave", "CD-Fills", function(e) { map.getCanvas().style.cursor = ''; }); // when going between districts a leave event for the previous district can fire after the enter event for the next district? //map.on("click", "CD-Fills", function(e) { show_district_popup(e, e.features[0].properties); }); // doesn't work if not all districts are shaded map.on("click", function(e) { map_click_to_district(e, function(feature) { show_district_popup(e, feature); }) }); var current_legislators_by_district = { }; function show_district_popup(e, feature_properties) { // https://docs.mapbox.com/mapbox-gl-js/example/popup-on-hover/ var district = feature_properties.state_name + (feature_properties.number == "00" ? " At Large" : "’s " + ordinal(parseInt(feature_properties.number)) + " Congressional District"); var url = "/congress/members/" + feature_properties.state + (feature_properties.number == "00" ? "" : "/" + parseInt(feature_properties.number)); var n = $("<div><div style='text-align: center'><div class=district style='font-weight: bold;'></div><div class='repname'></div><div><a>More »</a></div></div>"); n.find('.district').html(district); n.find('a').attr('href', url); if (url == current_district_popup) { // click to toggle visibility hover_popup.remove(); current_district_popup = null; return; } current_district_popup = url; //var coord = feature.geometry.coordinates[0][0]; // works for polygon but not multipolygon features //var coord = [feature_properties.label_pt_lon, feature_properties.label_pt_lat]; // from census data but not the actual label points? hover_popup .setLngLat(e.lngLat) .setHTML(n.html()) .addTo(map); } // Update the map embed iframe code to match the current viewport when the user moves the map map.on("moveend", update_embed_code_bounds); function update_embed_code_bounds() { var b = map.getBounds(); $("#embedbounds").text(Math.round(b.getWest()*1000)/1000 + "," + Math.round(b.getNorth()*1000)/1000 + "," + Math.round(b.getEast()*1000)/1000 + "," + Math.round(b.getSouth()*1000)/1000); } update_embed_code_bounds(); // initialize // Fix the form layout. if ($(window).width() > 768) { var input = $('#user-address'); var w = $('#user-address').parents("form").innerWidth(); $('#user-address').parents("form").find("button").each(function() { w -= $(this).outerWidth(); }) input.width(w-50); } function go_to_district(state, number, fragment) { if (number != 0) { // URLs don't use zero-padding var path = "/congress/members/" + state + "/" + number; if (path == window.location.pathname) { // The page won't reload. Just add a marker & alert. map.addMarker(q, pt); alert("That address is in the same congressional district."); } window.location = path + (fragment || ""); } else { // There is no district page for at-large districts. Redirect to the state page. window.location = "/congress/members/" + state; } } // Handle geocoding result. function go_to_point(pt, q) { // Query Mapbox API to get what district is at this location. latlng_to_district({ lat: pt[1], lng: pt[0]}, function(district) { if (!district) { alert("That location does not seem to be in a United States Congressional District."); return; } var fragment = "#q=" + encodeURIComponent(q) + "&marker_lng=" + pt[0] + "&marker_lat=" + pt[1]; go_to_district(district.state, parseInt(district.number), fragment); // remove zero-padding }); } function do_address(addr) { if (!addr) addr = $("#user-address").val(); if (addr == "") { window.location = "/congress/members/map"; return; } // this special query triggers geocoding if (addr == "my location") { do_by_current_location(); return; } // If a congressional district number is given, skip the geocoding step. // Try matching XXNN, with an optional dash or space, then check that the state and district are a valid district (add zero-padding to the district number). var match = /^\s*([A-Za-z]{2})[- ]?(\d+)$/.exec(addr.toUpperCase()); if (match && ((match[1] + (match[2].length == 2 ? "" : "0") + match[2]) in bboxes)) { go_to_district(match[1], parseInt(match[2])); return; } address_to_latlng(addr, function (pt) { go_to_point(pt, addr); }); } function do_by_current_location() { if ("geolocation" in navigator) navigator.geolocation.getCurrentPosition(function(position) { go_to_point([position.coords.longitude, position.coords.latitude], ""); }); } // utility function function parse_qs(qs) { // Parse something that looks like a query string. Based on // http://stackoverflow.com/a/2880929/125992. var match, pl = /\+/g, // Regex for replacing addition symbol with a space search = /([^&=]+)=?([^&]*)/g, decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, ret = {}; while (match = search.exec(qs)) ret[decode(match[1])] = decode(match[2]); return ret; } var q = parse_qs(window.location.hash.substring(1)); if (q.address) do_address(q.address); else if (q.my_location) do_by_current_location(); if (q.q) $('#user-address').val(q.q); if (q.marker_lat) map.addMarker(q.q ? q.q : "Location", [parseFloat(q.marker_lng), parseFloat(q.marker_lat)]); </script> <!-- Quantcast Tag --> <script type="text/javascript"> var _qevents = _qevents || []; (function() { var elem = document.createElement('script'); elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js"; elem.async = true; elem.type = "text/javascript"; var scpt = document.getElementsByTagName('script')[0]; scpt.parentNode.insertBefore(elem, scpt); })(); _qevents.push({ qacct:"p-NscxJMTcyb6nu" }); </script> <noscript> <div style="display:none;"> <img src="//pixel.quantserve.com/pixel/p-NscxJMTcyb6nu.gif" border="0" height="1" width="1" alt="Quantcast"/> </div> </noscript> <!-- End Quantcast tag --> </body> </html>