county-selection
Version:
This package contains a CountySelectionComponent class that displays a state map with county data on a \<county-selection\>\</county-selection> element. Currently state data is limited to "AL" and "AK".
1,096 lines (1,093 loc) • 1.51 MB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
typeof define === 'function' && define.amd ? define('county-selection', ['exports', '@angular/core'], factory) :
(factory((global['county-selection'] = {}),global.ng.core));
}(this, (function (exports,i0) { 'use strict';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var CountySelectionService = (function () {
function CountySelectionService() {
}
CountySelectionService.decorators = [
{ type: i0.Injectable, args: [{
providedIn: 'root'
},] },
];
/** @nocollapse */
CountySelectionService.ctorParameters = function () { return []; };
/** @nocollapse */ CountySelectionService.ngInjectableDef = i0.defineInjectable({ factory: function CountySelectionService_Factory() { return new CountySelectionService(); }, token: CountySelectionService, providedIn: "root" });
return CountySelectionService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var CountySelectionComponent = (function () {
// main function
function CountySelectionComponent() {
// GeoJSON data for each state
// - county shapefile data came from here: https://www.census.gov/geo/maps-data/data/tiger-line.html
// - http://mapshaper.org/ used to edit and select counties. The following commands were used in the mapshaper console:
// - filter "STATEFP == 05" // (or whatever the statefp that you want to select is)
// - dissolve "NAME"
// - // then use the simplify command and set it to .6%
// - // then export as a GeoJSON, add it as a variable like below, and update the stateData and selectedState public variables
this.alabamaData = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-85.85189,
33.498742
],
[
-85.870053,
33.476757
],
[
-85.782735,
33.469349
],
[
-85.765427,
33.498593
],
[
-85.64348199999999,
33.495885
],
[
-85.65308,
33.212117
],
[
-85.653654,
33.106634
],
[
-85.97471499999999,
33.105286
],
[
-86.00917,
33.09026
],
[
-86.00931299999999,
33.104642
],
[
-86.17437,
33.104394
],
[
-86.17282999999999,
33.195681
],
[
-86.120567,
33.194511
],
[
-86.11819799999999,
33.29632
],
[
-85.980293,
33.29419
],
[
-85.976525,
33.38187
],
[
-85.923762,
33.396206
],
[
-85.922817,
33.454575999999996
],
[
-85.90490899999999,
33.498655
],
[
-85.85189,
33.498742
]
]
]
},
"properties": {
"NAME": "Clay"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-87.930661,
32.310573999999995
],
[
-87.97094299999999,
32.344347
],
[
-88.046335,
32.377086999999996
],
[
-88.031623,
32.43361
],
[
-87.956211,
32.470405
],
[
-87.901264,
32.523171999999995
],
[
-87.85342,
32.532086
],
[
-87.812559,
32.52456
],
[
-87.728521,
32.524532
],
[
-87.72874399999999,
32.480917999999996
],
[
-87.524485,
32.482028
],
[
-87.52429,
32.307293
],
[
-87.47308,
32.307614
],
[
-87.472206,
32.264919
],
[
-87.523405,
32.25483
],
[
-87.521946,
32.132816
],
[
-87.624005,
32.132345
],
[
-87.622756,
32.005482
],
[
-87.66776899999999,
31.991355
],
[
-88.07348999999999,
31.990181999999997
],
[
-88.11743299999999,
32.016819999999996
],
[
-88.114087,
32.058056
],
[
-88.07061499999999,
32.0617
],
[
-88.03581199999999,
32.14501
],
[
-88.007077,
32.185313
],
[
-88.019145,
32.28524
],
[
-87.930661,
32.310573999999995
]
]
]
},
"properties": {
"NAME": "Marengo"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-85.583145,
34.860371
],
[
-85.534089,
34.623858
],
[
-85.527261,
34.588682999999996
],
[
-85.513612,
34.523824999999995
],
[
-85.560386,
34.489909
],
[
-85.579656,
34.439709
],
[
-85.636645,
34.366622
],
[
-85.675283,
34.343396
],
[
-85.774165,
34.259094
],
[
-85.843801,
34.244595
],
[
-85.843617,
34.200006
],
[
-86.10608599999999,
34.200756
],
[
-86.110362,
34.427797
],
[
-86.057712,
34.475994
],
[
-86.00384,
34.480031
],
[
-85.785471,
34.624584
],
[
-85.69303699999999,
34.74425
],
[
-85.660198,
34.754963
],
[
-85.627068,
34.831879
],
[
-85.583145,
34.860371
]
]
]
},
"properties": {
"NAME": "DeKalb"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-85.843617,
34.200006
],
[
-85.843801,
34.244595
],
[
-85.774165,
34.259094
],
[
-85.675283,
34.343396
],
[
-85.636645,
34.366622
],
[
-85.579656,
34.439709
],
[
-85.560386,
34.489909
],
[
-85.513612,
34.523824999999995
],
[
-85.46220699999999,
34.286386
],
[
-85.421852,
34.080822
],
[
-85.398837,
33.964129
],
[
-85.495289,
33.95691
],
[
-85.53009399999999,
33.941423
],
[
-85.529432,
33.95598
],
[
-85.738975,
33.96846
],
[
-85.73713699999999,
33.989202999999996
],
[
-85.811967,
34.125096
],
[
-85.84146799999999,
34.111095999999996
],
[
-85.843617,
34.200006
]
]
]
},
"properties": {
"NAME": "Cherokee"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-87.71570899999999,
33.006824
],
[
-87.421936,
33.003378999999995
],
[
-87.4212,
32.874508
],
[
-87.421387,
32.830829
],
[
-87.472174,
32.830619999999996
],
[
-87.47391499999999,
32.655867
],
[
-87.52519799999999,
32.655713
],
[
-87.524485,
32.482028
],
[
-87.72874399999999,
32.480917999999996
],
[
-87.728521,
32.524532
],
[
-87.812559,
32.52456
],
[
-87.80095899999999,
32.558890999999996
],
[
-87.73692799999999,
32.589689
],
[
-87.783271,
32.605230999999996
],
[
-87.813401,
32.633874999999996
],
[
-87.786571,
32.682480999999996
],
[
-87.82317599999999,
32.765895
],
[
-87.813178,
32.810176
],
[
-87.831586,
32.864866
],
[
-87.793758,
32.898441
],
[
-87.768294,
32.898956999999996
],
[
-87.74709899999999,
32.965576
],
[
-87.71570899999999,
33.006824
]
]
]
},
"properties": {
"NAME": "Hale"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-87.4212,
32.874508
],
[
-87.319473,
32.875124
],
[
-87.31918399999999,
32.831522
],
[
-87.01915699999999,
32.837033999999996
],
[
-87.01776199999999,
32.729532
],
[
-87.047873,
32.620776
],
[
-87.041158,
32.597892
],
[
-87.08129799999999,
32.570475
],
[
-87.11236199999999,
32.48865
],
[
-87.233798,
32.484372
],
[
-87.423153,
32.482965
],
[
-87.42174399999999,
32.308101
],
[
-87.47308,
32.307614
],
[
-87.52429,
32.307293
],
[
-87.524485,
32.482028
],
[
-87.52519799999999,
32.655713
],
[
-87.47391499999999,
32.655867
],
[
-87.472174,
32.830619999999996
],
[
-87.421387,
32.830829
],
[
-87.4212,
32.874508
]
]
]
},
"properties": {
"NAME": "Perry"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-87.42651,
34.800022
],
[
-87.43306,
34.717484999999996
],
[
-87.52966699999999,
34.567081
],
[
-87.952122,
34.575114
],
[
-88.139988,
34.581703
],
[
-88.11840699999999,
34.724292
],
[
-88.097888,
34.892202
],
[
-88.050792,
34.90618
],
[
-87.97322199999999,
34.88255
],
[
-87.937212,
34.847364999999996
],
[
-87.92029,
34.804468
],
[
-87.835833,
34.741239
],
[
-87.7603,
34.735578
],
[
-87.707572,
34.772919
],
[
-87.613694,
34.79903
],
[
-87.580637,
34.821802
],
[
-87.524363,
34.832384
],
[
-87.42651,
34.800022
]
]
]
},
"properties": {
"NAME": "Colbert"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-88.171852,
32.99586
],
[
-88.13557899999999,
33.03656
],
[
-88.086075,
33.036246999999996
],
[
-88.03148,
33.061284
],
[
-87.96883799999999,
33.077641
],
[
-87.927146,
33.121103999999995
],
[
-87.837521,
33.153636999999996
],
[
-87.832233,
33.017258
],
[
-87.71570899999999,
33.006824
],
[
-87.74709899999999,
32.965576
],
[
-87.768294,
32.898956999999996
],
[
-87.793758,
32.898441
],
[
-87.831586,
32.864866
],
[
-87.813178,
32.810176
],
[
-87.82317599999999,
32.765895
],
[
-87.786571,
32.682480999999996
],
[
-87.813401,
32.633874999999996
],
[
-87.783271,
32.605230999999996
],
[
-87.73692799999999,
32.589689
],
[
-87.80095899999999,
32.558890999999996
],
[
-87.812559,
32.52456
],
[
-87.85342,
32.532086
],
[
-87.90484099999999,
32.614576
],
[
-87.92868899999999,
32.632284
],
[
-87.97700499999999,
32.610780999999996
],
[
-88.05372899999999,
32.593052
],
[
-88.07915899999999,
32.619684
],
[
-88.055004,
32.646482
],
[
-88.109633,
32.770989
],
[
-88.07933799999999,
32.772948
],
[
-88.132685,
32.832853
],
[
-88.179966,
32.871674999999996
],
[
-88.20731599999999,
32.924782
],
[
-88.171852,
32.99586
]
]
]
},
"properties": {
"NAME": "Greene"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-86.90589899999999,
31.753034999999997
],
[
-86.906899,
31.830627999999997
],
[
-86.90893899999999,
31.961672999999998
],
[
-86.85758299999999,
31.962166999999997
],
[
-86.44819799999999,
31.964629
],
[
-86.445978,
31.70112
],
[
-86.448635,
31.655617
],
[
-86.499533,
31.655247
],
[
-86.499213,
31.525330999999998
],
[
-86.701554,
31.523946
],
[
-86.83938599999999,
31.525204
],
[
-86.86630199999999,
31.546981
],
[
-86.906769,
31.632671
],
[
-86.90589899999999,
31.753034999999997
]
]
]
},
"properties": {
"NAME": "Butler"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-85.135038,
32.74653
],
[
-85.105432,
32.644934
],
[
-85.080784,
32.608072
],
[
-85.067199,
32.579305999999995
],
[
-85.00102,
32.510157
],
[
-85.06091699999999,
32.509195999999996
],
[
-85.059294,
32.472909
],
[
-85.333843,
32.468638999999996
],
[
-85.33014299999999,
32.410841999999995
],
[
-85.434045,
32.409839999999996
],
[
-85.438575,
32.49709
],
[
-85.48934799999999,
32.496936999999996
],
[
-85.661053,
32.567935
],
[
-85.695854,
32.595932999999995
],
[
-85.696755,
32.697429
],
[
-85.67985399999999,
32.71253
],
[
-85.610253,
32.713929
],
[
-85.59315099999999,
32.72853
],
[
-85.285043,
32.730731
],
[
-85.284843,
32.745131
],
[
-85.135038,
32.74653
]
]
]
},
"properties": {
"NAME": "Lee"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-88.425432,
30.998323
],
[
-88.432007,
31.114297999999998
],
[
-88.329927,
31.114357
],
[
-88.329782,
31.143821
],
[
-88.022649,
31.144267
],
[
-87.972869,
31.162694
],
[
-87.939696,
31.145805
],
[
-87.97585099999999,
31.082421999999998
],
[
-87.941561,
31.061342
],
[
-87.957352,
31.029367999999998
],
[
-87.96326499999999,
30.966051
],
[
-87.949901,
30.926651999999997
],
[
-87.98126099999999,
30.886895
],
[
-87.980971,