├── .gitattributes ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.md ├── pandas_datapackage_reader ├── __init__.py └── _version.py ├── setup.cfg ├── setup.py ├── tests ├── __init__.py ├── conftest.py ├── test-package │ ├── admin1-us.geojson │ ├── data-8859-1.csv │ ├── data.csv │ ├── datapackage.json │ ├── datawithints.csv │ ├── datawithmixedtypes.csv │ ├── datawiththousands.csv │ ├── datetimes.csv │ ├── europeandata.csv │ ├── moredata.csv │ └── only.json └── test_pandas_datapackage_reader.py └── versioneer.py /.gitattributes: -------------------------------------------------------------------------------- 1 | pandas_datapackage_reader/_version.py export-subst 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | tests: 7 | name: Tests 8 | runs-on: ubuntu-latest 9 | strategy: 10 | max-parallel: 4 11 | matrix: 12 | python-version: ['3.10'] 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up Python ${{ matrix.python-version }} 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: ${{ matrix.python-version }} 20 | - name: Use pip cache 21 | uses: actions/cache@v2 22 | with: 23 | path: ~/.cache/pip 24 | key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} 25 | restore-keys: | 26 | ${{ runner.os }}-pip- 27 | ${{ runner.os }}- 28 | - name: Installation 29 | run: | 30 | python -m pip install --upgrade pip 31 | pip install .[tests] 32 | - name: Pytest 33 | run: | 34 | pytest tests 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | dist 3 | venv 4 | .cache 5 | .eggs 6 | *.egg-info 7 | __pycache__ 8 | dist 9 | *.pyc 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Note: This license has also been called the "Simplified BSD License" and the "FreeBSD License". See also the 3-clause BSD License. 2 | 3 | Copyright 2017 Robert Gieseke (robert.gieseke@pik-potsdam.de) 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | include LICENSE 3 | include versioneer.py 4 | include pandas_datapackage_reader/_version.py 5 | include tests/test-package/*.csv 6 | include tests/test-package/*.json 7 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | publish-on-pypi: 2 | @rm -rf build dist 3 | @status=$$(git status --porcelain); \ 4 | if test "x$${status}" = x; then \ 5 | ./venv/bin/python setup.py sdist bdist_wheel --universal; \ 6 | ./venv/bin/twine upload dist/*; \ 7 | else \ 8 | echo Working directory is dirty >&2; \ 9 | fi; 10 | 11 | test-pypi-install: 12 | $(eval TEMPVENV := $(shell mktemp -d)) 13 | python3 -m venv $(TEMPVENV) 14 | $(TEMPVENV)/bin/pip install pip --upgrade 15 | $(TEMPVENV)/bin/pip install pandas_datapackage_reader 16 | $(TEMPVENV)/bin/python -c "import sys; sys.path.remove(''); import pandas_datapackage_reader as pdr; print(pdr.__version__)" 17 | 18 | venv: 19 | [ -d ./venv ] || python3 -m venv venv 20 | ./venv/bin/pip install --upgrade pip 21 | ./venv/bin/pip install pytest pytest-cov 22 | ./venv/bin/pip install twine wheel setuptools geopandas --upgrade 23 | ./venv/bin/pip install -e . 24 | 25 | .PHONY: publish-on-pypi test-pypi-install venv 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![PyPI](https://img.shields.io/pypi/v/pandas-datapackage-reader.svg)](https://pypi.python.org/pypi/pandas-datapackage-reader/) 2 | [![CI](https://img.shields.io/github/actions/workflow/status/rgieseke/pandas-datapackage-reader/ci.yml?branch=main&label=actions&logo=github&logoColor=white)](https://github.com/rgieseke/pandas-datapackage-reader/actions) 3 | 4 | # pandas-datapackage-reader 5 | 6 | Easy loading of tabular data from [Data Packages](http://frictionlessdata.io/data-packages/) into Pandas DataFrames. 7 | 8 | ## Installation 9 | 10 | pip install pandas-datapackage-reader 11 | 12 | ## Usage 13 | 14 | ```python 15 | from pandas_datapackage_reader import read_datapackage 16 | 17 | # From GitHub repository 18 | country_codes = read_datapackage("https://github.com/datasets/country-codes") 19 | 20 | # From local directory 21 | country_codes = read_datapackage("country-codes") 22 | 23 | # Data Package with GeoJSON 24 | geo_countries = read_datapackage("https://github.com/datasets/geo-countries") 25 | ``` 26 | 27 | Resource metadata from the Data Package is returned as a dictionary in the 28 | `_metadata` attribute. 29 | 30 | ```python 31 | country_codes._metadata 32 | ``` 33 | 34 | contains 35 | 36 | ``` 37 | {'format': 'csv', 38 | 'name': 'country-codes', 39 | 'path': 'data/country-codes.csv', 40 | 'schema': {'fields': [{'description': 'Country or Area official Arabic short name from UN Statistics Divsion', 41 | 'name': 'official_name_ar', 42 | 'title': 'official name Arabic', 43 | 'type': 'string'}, 44 | {'description': 'Country or Area official Chinese short name from UN Statistics Divsion', 45 | 'name': 'official_name_cn', 46 | 'title': 'official name Chinese', 47 | 'type': 'string'}, 48 | # ... 49 | ``` 50 | 51 | ## License 52 | 53 | BSD-2-Clause, see [LICENSE](LICENSE) 54 | -------------------------------------------------------------------------------- /pandas_datapackage_reader/__init__.py: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | 3 | """ 4 | pandas-datapackage-reader 5 | ------------------------- 6 | 7 | Easy loading of tabular data from Data Packages into Pandas DataFrames. 8 | 9 | See README.md and repository for details: 10 | https://github.com/rgieseke/pandas-datapackage-reader 11 | """ 12 | 13 | import json 14 | import os 15 | 16 | import requests 17 | import pandas as pd 18 | 19 | from ._version import get_versions 20 | 21 | __version__ = get_versions()["version"] 22 | del get_versions 23 | 24 | 25 | def read_datapackage(url_or_path, resource_name=None): 26 | """ 27 | Read tabular CSV files from Data Packages into DataFrames. 28 | 29 | Parameters: 30 | ----------- 31 | path_or_url: string 32 | Local path or URL of a Data Package. For GitHub URLs the repository can 33 | be used. 34 | resource_name: string or list of strings 35 | Name or names of resources to read. Lists of strings are used to 36 | request multiple resources. 37 | 38 | Returns 39 | ------- 40 | data_frames : DataFrame or Dict of DataFrames 41 | DataFrame(s) of the passed in Data Package. See notes in resource_name 42 | argument for more information on when a Dict of DataFrames is returned. 43 | 44 | """ 45 | url_or_path = str(url_or_path) # Allows using PosixPath 46 | if url_or_path.startswith("https://github.com/") and not url_or_path.endswith( 47 | "/datapackage.json" 48 | ): 49 | username_project = url_or_path.split("https://github.com/")[1] 50 | if username_project.endswith("/"): 51 | username_project = username_project[:-1] 52 | url_or_path = ( 53 | "https://raw.githubusercontent.com/" 54 | + username_project 55 | + "/master/datapackage.json" 56 | ) 57 | elif not url_or_path.endswith("datapackage.json"): 58 | url_or_path = os.path.join(url_or_path, "datapackage.json") 59 | 60 | if url_or_path.startswith("http"): 61 | r = requests.get(url_or_path) 62 | if r.status_code == 200: 63 | metadata = json.loads(r.text) 64 | else: 65 | r.raise_for_status() 66 | else: 67 | with open(url_or_path, "r") as f: 68 | metadata = json.load(f) 69 | 70 | if type(resource_name) is str: 71 | resource_name = [resource_name] 72 | 73 | resources = [resource for resource in metadata["resources"]] 74 | if resource_name is not None: 75 | resources = [ 76 | resource for resource in resources if resource["name"] in resource_name 77 | ] 78 | 79 | data_frames = {} 80 | 81 | for idx, resource in enumerate(resources): 82 | if "name" in resource.keys(): 83 | name = resource["name"] 84 | else: 85 | name = str(idx) 86 | 87 | index_col = None 88 | 89 | resource_path = url_or_path.replace("datapackage.json", resource["path"]) 90 | 91 | if "format" in resource.keys(): 92 | format = resource["format"] 93 | else: 94 | format = resource_path.rsplit(".", 1)[-1] 95 | 96 | dtypes = {} 97 | if "schema" in resource: 98 | # Get missing values representations if defined 99 | missing_values = resource["schema"].get("missingValues", ['']) 100 | 101 | # Get decimal character if they are defined 102 | decimal_char = resource["schema"].get("decimalChar", '.') 103 | 104 | # Get encoding 105 | encoding = resource.get("encoding", "utf-8") 106 | 107 | if "fields" in resource["schema"]: 108 | for column in resource["schema"]["fields"]: 109 | col_type = column.get("type", None) 110 | # Get thousands separator from field level, if defined. 111 | # Note that this will be applied to all fields. 112 | thousands_sep = column.get("groupChar", None) 113 | if col_type == "number": 114 | dtypes[column["name"]] = "float64" 115 | elif col_type == "integer": 116 | dtypes[column["name"]] = "Int64" 117 | elif col_type == "string": 118 | dtypes[column["name"]] = "object" 119 | 120 | if format == "csv": 121 | df = pd.read_csv( 122 | resource_path, 123 | na_filter=True, 124 | na_values=missing_values, 125 | keep_default_na=False, 126 | dtype=dtypes, 127 | thousands=thousands_sep, 128 | decimal=decimal_char, 129 | encoding=encoding, 130 | ) 131 | elif format == "geojson": 132 | import geopandas 133 | 134 | df = geopandas.read_file(resource_path) 135 | else: 136 | continue 137 | 138 | if "primaryKey" in resource["schema"]: 139 | index_col = resource["schema"]["primaryKey"] 140 | 141 | # Process dates. 142 | for column in resource["schema"]["fields"]: 143 | format = column.get("format", None) 144 | if column["type"] == "date": 145 | df[column["name"]] = pd.to_datetime( 146 | df[column["name"]], format=format 147 | ).dt.date 148 | elif column["type"] == "datetime": 149 | df[column["name"]] = pd.to_datetime(df[column["name"]], format=format) 150 | elif column["type"] == "time": 151 | df[column["name"]] = pd.to_datetime( 152 | df[column["name"]], format=format 153 | ).dt.time 154 | elif column["type"] == "year": 155 | df[column["name"]] = df[column["name"]].astype(int) 156 | elif column["type"] == "yearmonth": 157 | df[column["name"]] = pd.to_datetime( 158 | df[column["name"]], format="%Y-%m" 159 | ).dt.to_period("M") 160 | 161 | # Set index column 162 | if index_col: 163 | try: 164 | df = df.set_index(index_col) 165 | except KeyError: 166 | raise KeyError("Error dealing with {}".format(name)) 167 | 168 | # Add resource description as a `_metadata` attribute. This won't 169 | # survive methods returning new DataFrames but can be useful. 170 | df._metadata = resource 171 | 172 | data_frames[name] = df 173 | 174 | if len(list(data_frames.values())) == 1: 175 | return list(data_frames.values())[0] 176 | else: 177 | return data_frames 178 | -------------------------------------------------------------------------------- /pandas_datapackage_reader/_version.py: -------------------------------------------------------------------------------- 1 | 2 | # This file helps to compute a version number in source trees obtained from 3 | # git-archive tarball (such as those provided by githubs download-from-tag 4 | # feature). Distribution tarballs (built by setup.py sdist) and build 5 | # directories (produced by setup.py build) will contain a much shorter file 6 | # that just contains the computed version number. 7 | 8 | # This file is released into the public domain. Generated by 9 | # versioneer-0.18 (https://github.com/warner/python-versioneer) 10 | 11 | """Git implementation of _version.py.""" 12 | 13 | import errno 14 | import os 15 | import re 16 | import subprocess 17 | import sys 18 | 19 | 20 | def get_keywords(): 21 | """Get the keywords needed to look up the version information.""" 22 | # these strings will be replaced by git during git-archive. 23 | # setup.py/versioneer.py will grep for the variable names, so they must 24 | # each be defined on a line of their own. _version.py will just call 25 | # get_keywords(). 26 | git_refnames = " (HEAD -> main)" 27 | git_full = "56689d623b0996414f5d9fda37dfd2a3080a3b7a" 28 | git_date = "2023-02-10 11:54:07 +0100" 29 | keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} 30 | return keywords 31 | 32 | 33 | class VersioneerConfig: 34 | """Container for Versioneer configuration parameters.""" 35 | 36 | 37 | def get_config(): 38 | """Create, populate and return the VersioneerConfig() object.""" 39 | # these strings are filled in when 'setup.py versioneer' creates 40 | # _version.py 41 | cfg = VersioneerConfig() 42 | cfg.VCS = "git" 43 | cfg.style = "pep440" 44 | cfg.tag_prefix = "v" 45 | cfg.parentdir_prefix = "pandas_datapackage_reader-" 46 | cfg.versionfile_source = "pandas_datapackage_reader/_version.py" 47 | cfg.verbose = False 48 | return cfg 49 | 50 | 51 | class NotThisMethod(Exception): 52 | """Exception raised if a method is not valid for the current scenario.""" 53 | 54 | 55 | LONG_VERSION_PY = {} 56 | HANDLERS = {} 57 | 58 | 59 | def register_vcs_handler(vcs, method): # decorator 60 | """Decorator to mark a method as the handler for a particular VCS.""" 61 | def decorate(f): 62 | """Store f in HANDLERS[vcs][method].""" 63 | if vcs not in HANDLERS: 64 | HANDLERS[vcs] = {} 65 | HANDLERS[vcs][method] = f 66 | return f 67 | return decorate 68 | 69 | 70 | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, 71 | env=None): 72 | """Call the given command(s).""" 73 | assert isinstance(commands, list) 74 | p = None 75 | for c in commands: 76 | try: 77 | dispcmd = str([c] + args) 78 | # remember shell=False, so use git.cmd on windows, not just git 79 | p = subprocess.Popen([c] + args, cwd=cwd, env=env, 80 | stdout=subprocess.PIPE, 81 | stderr=(subprocess.PIPE if hide_stderr 82 | else None)) 83 | break 84 | except EnvironmentError: 85 | e = sys.exc_info()[1] 86 | if e.errno == errno.ENOENT: 87 | continue 88 | if verbose: 89 | print("unable to run %s" % dispcmd) 90 | print(e) 91 | return None, None 92 | else: 93 | if verbose: 94 | print("unable to find command, tried %s" % (commands,)) 95 | return None, None 96 | stdout = p.communicate()[0].strip() 97 | if sys.version_info[0] >= 3: 98 | stdout = stdout.decode() 99 | if p.returncode != 0: 100 | if verbose: 101 | print("unable to run %s (error)" % dispcmd) 102 | print("stdout was %s" % stdout) 103 | return None, p.returncode 104 | return stdout, p.returncode 105 | 106 | 107 | def versions_from_parentdir(parentdir_prefix, root, verbose): 108 | """Try to determine the version from the parent directory name. 109 | 110 | Source tarballs conventionally unpack into a directory that includes both 111 | the project name and a version string. We will also support searching up 112 | two directory levels for an appropriately named parent directory 113 | """ 114 | rootdirs = [] 115 | 116 | for i in range(3): 117 | dirname = os.path.basename(root) 118 | if dirname.startswith(parentdir_prefix): 119 | return {"version": dirname[len(parentdir_prefix):], 120 | "full-revisionid": None, 121 | "dirty": False, "error": None, "date": None} 122 | else: 123 | rootdirs.append(root) 124 | root = os.path.dirname(root) # up a level 125 | 126 | if verbose: 127 | print("Tried directories %s but none started with prefix %s" % 128 | (str(rootdirs), parentdir_prefix)) 129 | raise NotThisMethod("rootdir doesn't start with parentdir_prefix") 130 | 131 | 132 | @register_vcs_handler("git", "get_keywords") 133 | def git_get_keywords(versionfile_abs): 134 | """Extract version information from the given file.""" 135 | # the code embedded in _version.py can just fetch the value of these 136 | # keywords. When used from setup.py, we don't want to import _version.py, 137 | # so we do it with a regexp instead. This function is not used from 138 | # _version.py. 139 | keywords = {} 140 | try: 141 | f = open(versionfile_abs, "r") 142 | for line in f.readlines(): 143 | if line.strip().startswith("git_refnames ="): 144 | mo = re.search(r'=\s*"(.*)"', line) 145 | if mo: 146 | keywords["refnames"] = mo.group(1) 147 | if line.strip().startswith("git_full ="): 148 | mo = re.search(r'=\s*"(.*)"', line) 149 | if mo: 150 | keywords["full"] = mo.group(1) 151 | if line.strip().startswith("git_date ="): 152 | mo = re.search(r'=\s*"(.*)"', line) 153 | if mo: 154 | keywords["date"] = mo.group(1) 155 | f.close() 156 | except EnvironmentError: 157 | pass 158 | return keywords 159 | 160 | 161 | @register_vcs_handler("git", "keywords") 162 | def git_versions_from_keywords(keywords, tag_prefix, verbose): 163 | """Get version information from git keywords.""" 164 | if not keywords: 165 | raise NotThisMethod("no keywords at all, weird") 166 | date = keywords.get("date") 167 | if date is not None: 168 | # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant 169 | # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 170 | # -like" string, which we must then edit to make compliant), because 171 | # it's been around since git-1.5.3, and it's too difficult to 172 | # discover which version we're using, or to work around using an 173 | # older one. 174 | date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) 175 | refnames = keywords["refnames"].strip() 176 | if refnames.startswith("$Format"): 177 | if verbose: 178 | print("keywords are unexpanded, not using") 179 | raise NotThisMethod("unexpanded keywords, not a git-archive tarball") 180 | refs = set([r.strip() for r in refnames.strip("()").split(",")]) 181 | # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of 182 | # just "foo-1.0". If we see a "tag: " prefix, prefer those. 183 | TAG = "tag: " 184 | tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) 185 | if not tags: 186 | # Either we're using git < 1.8.3, or there really are no tags. We use 187 | # a heuristic: assume all version tags have a digit. The old git %d 188 | # expansion behaves like git log --decorate=short and strips out the 189 | # refs/heads/ and refs/tags/ prefixes that would let us distinguish 190 | # between branches and tags. By ignoring refnames without digits, we 191 | # filter out many common branch names like "release" and 192 | # "stabilization", as well as "HEAD" and "master". 193 | tags = set([r for r in refs if re.search(r'\d', r)]) 194 | if verbose: 195 | print("discarding '%s', no digits" % ",".join(refs - tags)) 196 | if verbose: 197 | print("likely tags: %s" % ",".join(sorted(tags))) 198 | for ref in sorted(tags): 199 | # sorting will prefer e.g. "2.0" over "2.0rc1" 200 | if ref.startswith(tag_prefix): 201 | r = ref[len(tag_prefix):] 202 | if verbose: 203 | print("picking %s" % r) 204 | return {"version": r, 205 | "full-revisionid": keywords["full"].strip(), 206 | "dirty": False, "error": None, 207 | "date": date} 208 | # no suitable tags, so version is "0+unknown", but full hex is still there 209 | if verbose: 210 | print("no suitable tags, using unknown + full revision id") 211 | return {"version": "0+unknown", 212 | "full-revisionid": keywords["full"].strip(), 213 | "dirty": False, "error": "no suitable tags", "date": None} 214 | 215 | 216 | @register_vcs_handler("git", "pieces_from_vcs") 217 | def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): 218 | """Get version from 'git describe' in the root of the source tree. 219 | 220 | This only gets called if the git-archive 'subst' keywords were *not* 221 | expanded, and _version.py hasn't already been rewritten with a short 222 | version string, meaning we're inside a checked out source tree. 223 | """ 224 | GITS = ["git"] 225 | if sys.platform == "win32": 226 | GITS = ["git.cmd", "git.exe"] 227 | 228 | out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, 229 | hide_stderr=True) 230 | if rc != 0: 231 | if verbose: 232 | print("Directory %s not under git control" % root) 233 | raise NotThisMethod("'git rev-parse --git-dir' returned error") 234 | 235 | # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] 236 | # if there isn't one, this yields HEX[-dirty] (no NUM) 237 | describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", 238 | "--always", "--long", 239 | "--match", "%s*" % tag_prefix], 240 | cwd=root) 241 | # --long was added in git-1.5.5 242 | if describe_out is None: 243 | raise NotThisMethod("'git describe' failed") 244 | describe_out = describe_out.strip() 245 | full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) 246 | if full_out is None: 247 | raise NotThisMethod("'git rev-parse' failed") 248 | full_out = full_out.strip() 249 | 250 | pieces = {} 251 | pieces["long"] = full_out 252 | pieces["short"] = full_out[:7] # maybe improved later 253 | pieces["error"] = None 254 | 255 | # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] 256 | # TAG might have hyphens. 257 | git_describe = describe_out 258 | 259 | # look for -dirty suffix 260 | dirty = git_describe.endswith("-dirty") 261 | pieces["dirty"] = dirty 262 | if dirty: 263 | git_describe = git_describe[:git_describe.rindex("-dirty")] 264 | 265 | # now we have TAG-NUM-gHEX or HEX 266 | 267 | if "-" in git_describe: 268 | # TAG-NUM-gHEX 269 | mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) 270 | if not mo: 271 | # unparseable. Maybe git-describe is misbehaving? 272 | pieces["error"] = ("unable to parse git-describe output: '%s'" 273 | % describe_out) 274 | return pieces 275 | 276 | # tag 277 | full_tag = mo.group(1) 278 | if not full_tag.startswith(tag_prefix): 279 | if verbose: 280 | fmt = "tag '%s' doesn't start with prefix '%s'" 281 | print(fmt % (full_tag, tag_prefix)) 282 | pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" 283 | % (full_tag, tag_prefix)) 284 | return pieces 285 | pieces["closest-tag"] = full_tag[len(tag_prefix):] 286 | 287 | # distance: number of commits since tag 288 | pieces["distance"] = int(mo.group(2)) 289 | 290 | # commit: short hex revision ID 291 | pieces["short"] = mo.group(3) 292 | 293 | else: 294 | # HEX: no tags 295 | pieces["closest-tag"] = None 296 | count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], 297 | cwd=root) 298 | pieces["distance"] = int(count_out) # total number of commits 299 | 300 | # commit date: see ISO-8601 comment in git_versions_from_keywords() 301 | date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], 302 | cwd=root)[0].strip() 303 | pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) 304 | 305 | return pieces 306 | 307 | 308 | def plus_or_dot(pieces): 309 | """Return a + if we don't already have one, else return a .""" 310 | if "+" in pieces.get("closest-tag", ""): 311 | return "." 312 | return "+" 313 | 314 | 315 | def render_pep440(pieces): 316 | """Build up version string, with post-release "local version identifier". 317 | 318 | Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you 319 | get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty 320 | 321 | Exceptions: 322 | 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] 323 | """ 324 | if pieces["closest-tag"]: 325 | rendered = pieces["closest-tag"] 326 | if pieces["distance"] or pieces["dirty"]: 327 | rendered += plus_or_dot(pieces) 328 | rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) 329 | if pieces["dirty"]: 330 | rendered += ".dirty" 331 | else: 332 | # exception #1 333 | rendered = "0+untagged.%d.g%s" % (pieces["distance"], 334 | pieces["short"]) 335 | if pieces["dirty"]: 336 | rendered += ".dirty" 337 | return rendered 338 | 339 | 340 | def render_pep440_pre(pieces): 341 | """TAG[.post.devDISTANCE] -- No -dirty. 342 | 343 | Exceptions: 344 | 1: no tags. 0.post.devDISTANCE 345 | """ 346 | if pieces["closest-tag"]: 347 | rendered = pieces["closest-tag"] 348 | if pieces["distance"]: 349 | rendered += ".post.dev%d" % pieces["distance"] 350 | else: 351 | # exception #1 352 | rendered = "0.post.dev%d" % pieces["distance"] 353 | return rendered 354 | 355 | 356 | def render_pep440_post(pieces): 357 | """TAG[.postDISTANCE[.dev0]+gHEX] . 358 | 359 | The ".dev0" means dirty. Note that .dev0 sorts backwards 360 | (a dirty tree will appear "older" than the corresponding clean one), 361 | but you shouldn't be releasing software with -dirty anyways. 362 | 363 | Exceptions: 364 | 1: no tags. 0.postDISTANCE[.dev0] 365 | """ 366 | if pieces["closest-tag"]: 367 | rendered = pieces["closest-tag"] 368 | if pieces["distance"] or pieces["dirty"]: 369 | rendered += ".post%d" % pieces["distance"] 370 | if pieces["dirty"]: 371 | rendered += ".dev0" 372 | rendered += plus_or_dot(pieces) 373 | rendered += "g%s" % pieces["short"] 374 | else: 375 | # exception #1 376 | rendered = "0.post%d" % pieces["distance"] 377 | if pieces["dirty"]: 378 | rendered += ".dev0" 379 | rendered += "+g%s" % pieces["short"] 380 | return rendered 381 | 382 | 383 | def render_pep440_old(pieces): 384 | """TAG[.postDISTANCE[.dev0]] . 385 | 386 | The ".dev0" means dirty. 387 | 388 | Eexceptions: 389 | 1: no tags. 0.postDISTANCE[.dev0] 390 | """ 391 | if pieces["closest-tag"]: 392 | rendered = pieces["closest-tag"] 393 | if pieces["distance"] or pieces["dirty"]: 394 | rendered += ".post%d" % pieces["distance"] 395 | if pieces["dirty"]: 396 | rendered += ".dev0" 397 | else: 398 | # exception #1 399 | rendered = "0.post%d" % pieces["distance"] 400 | if pieces["dirty"]: 401 | rendered += ".dev0" 402 | return rendered 403 | 404 | 405 | def render_git_describe(pieces): 406 | """TAG[-DISTANCE-gHEX][-dirty]. 407 | 408 | Like 'git describe --tags --dirty --always'. 409 | 410 | Exceptions: 411 | 1: no tags. HEX[-dirty] (note: no 'g' prefix) 412 | """ 413 | if pieces["closest-tag"]: 414 | rendered = pieces["closest-tag"] 415 | if pieces["distance"]: 416 | rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) 417 | else: 418 | # exception #1 419 | rendered = pieces["short"] 420 | if pieces["dirty"]: 421 | rendered += "-dirty" 422 | return rendered 423 | 424 | 425 | def render_git_describe_long(pieces): 426 | """TAG-DISTANCE-gHEX[-dirty]. 427 | 428 | Like 'git describe --tags --dirty --always -long'. 429 | The distance/hash is unconditional. 430 | 431 | Exceptions: 432 | 1: no tags. HEX[-dirty] (note: no 'g' prefix) 433 | """ 434 | if pieces["closest-tag"]: 435 | rendered = pieces["closest-tag"] 436 | rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) 437 | else: 438 | # exception #1 439 | rendered = pieces["short"] 440 | if pieces["dirty"]: 441 | rendered += "-dirty" 442 | return rendered 443 | 444 | 445 | def render(pieces, style): 446 | """Render the given version pieces into the requested style.""" 447 | if pieces["error"]: 448 | return {"version": "unknown", 449 | "full-revisionid": pieces.get("long"), 450 | "dirty": None, 451 | "error": pieces["error"], 452 | "date": None} 453 | 454 | if not style or style == "default": 455 | style = "pep440" # the default 456 | 457 | if style == "pep440": 458 | rendered = render_pep440(pieces) 459 | elif style == "pep440-pre": 460 | rendered = render_pep440_pre(pieces) 461 | elif style == "pep440-post": 462 | rendered = render_pep440_post(pieces) 463 | elif style == "pep440-old": 464 | rendered = render_pep440_old(pieces) 465 | elif style == "git-describe": 466 | rendered = render_git_describe(pieces) 467 | elif style == "git-describe-long": 468 | rendered = render_git_describe_long(pieces) 469 | else: 470 | raise ValueError("unknown style '%s'" % style) 471 | 472 | return {"version": rendered, "full-revisionid": pieces["long"], 473 | "dirty": pieces["dirty"], "error": None, 474 | "date": pieces.get("date")} 475 | 476 | 477 | def get_versions(): 478 | """Get version information or return default if unable to do so.""" 479 | # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have 480 | # __file__, we can work backwards from there to the root. Some 481 | # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which 482 | # case we can only use expanded keywords. 483 | 484 | cfg = get_config() 485 | verbose = cfg.verbose 486 | 487 | try: 488 | return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, 489 | verbose) 490 | except NotThisMethod: 491 | pass 492 | 493 | try: 494 | root = os.path.realpath(__file__) 495 | # versionfile_source is the relative path from the top of the source 496 | # tree (where the .git directory might live) to this file. Invert 497 | # this to find the root from __file__. 498 | for i in cfg.versionfile_source.split('/'): 499 | root = os.path.dirname(root) 500 | except NameError: 501 | return {"version": "0+unknown", "full-revisionid": None, 502 | "dirty": None, 503 | "error": "unable to find root of source tree", 504 | "date": None} 505 | 506 | try: 507 | pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) 508 | return render(pieces, cfg.style) 509 | except NotThisMethod: 510 | pass 511 | 512 | try: 513 | if cfg.parentdir_prefix: 514 | return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) 515 | except NotThisMethod: 516 | pass 517 | 518 | return {"version": "0+unknown", "full-revisionid": None, 519 | "dirty": None, 520 | "error": "unable to compute version", "date": None} 521 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = README.md 3 | 4 | [aliases] 5 | test = pytest 6 | 7 | [tool:pytest] 8 | testpaths = tests 9 | 10 | [versioneer] 11 | VCS = git 12 | style = pep440 13 | versionfile_source = pandas_datapackage_reader/_version.py 14 | versionfile_build = pandas_datapackage_reader/_version.py 15 | tag_prefix = v 16 | parentdir_prefix = pandas_datapackage_reader- 17 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | pandas-datapackage-reader 3 | ------------------------- 4 | 5 | Easy loading of tabular data from Data Packages into Pandas DataFrames. 6 | 7 | Install using :: 8 | 9 | pip install pandas-datapackage-reader 10 | 11 | See README.md and repository for details: 12 | """ 13 | 14 | import os 15 | import sys 16 | 17 | from setuptools import setup 18 | from setuptools.command.test import test as TestCommand 19 | 20 | import versioneer 21 | 22 | 23 | path = os.path.abspath(os.path.dirname(__file__)) 24 | 25 | 26 | class PyTest(TestCommand): 27 | def finalize_options(self): 28 | TestCommand.finalize_options(self) 29 | self.test_args = [] 30 | self.test_suite = True 31 | 32 | def run_tests(self): 33 | import pytest 34 | 35 | sys.exit(pytest.main(self.test_args)) 36 | 37 | 38 | with open(os.path.join(path, "README.md"), "r") as f: 39 | readme = f.read() 40 | 41 | 42 | cmdclass = versioneer.get_cmdclass() 43 | cmdclass.update({"test": PyTest}) 44 | 45 | REQUIREMENTS = ["pandas>=0.24.0", "requests"] 46 | REQUIREMENTS_EXTRAS = {"tests": ["pytest>=4.1", "geopandas"]} 47 | 48 | setup( 49 | name="pandas-datapackage-reader", 50 | version=versioneer.get_version(), 51 | description="Pandas Data Package Reader", 52 | long_description=readme, 53 | long_description_content_type="text/markdown", 54 | url="https://github.com/rgieseke/pandas-datapackage-reader", 55 | author="Robert Gieseke", 56 | author_email="robert.gieseke@pik-potsdam.de", 57 | license="BSD", 58 | platforms="any", 59 | classifiers=[ 60 | "Development Status :: 4 - Beta", 61 | "Intended Audience :: Developers", 62 | "Operating System :: OS Independent", 63 | "Programming Language :: Python :: 3.6", 64 | "Programming Language :: Python :: 3.7", 65 | ], 66 | keywords=["data-package"], 67 | cmdclass=cmdclass, 68 | packages=["pandas_datapackage_reader"], 69 | install_requires=REQUIREMENTS, 70 | extras_require=REQUIREMENTS_EXTRAS, 71 | ) 72 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rgieseke/pandas-datapackage-reader/56689d623b0996414f5d9fda37dfd2a3080a3b7a/tests/__init__.py -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | 4 | def pytest_addoption(parser): 5 | parser.addoption( 6 | "--skip-slow", action="store_true", default=False, help="skip any slow tests" 7 | ) 8 | 9 | 10 | def pytest_collection_modifyitems(config, items): 11 | if config.getoption("--skip-slow"): 12 | # --skip-slow given in cli: skipping slow tests 13 | skip_slow = pytest.mark.skip(reason="--skip-slow option was provided") 14 | for item in items: 15 | if "slow" in item.keywords: 16 | item.add_marker(skip_slow) 17 | -------------------------------------------------------------------------------- /tests/test-package/admin1-us.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | 4 | "features": [ 5 | { "type": "Feature", "properties": { "name": "Minnesota", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "MN", "id": "USA-3514" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -89.599409145856669, 48.010273952824832 ], [ -89.488884557221013, 48.013438878606507 ], [ -89.522695482119332, 47.960535386743913 ], [ -89.613697679385382, 47.819252020857959 ], [ -89.728005947615031, 47.641976019880644 ], [ -89.842830980167548, 47.464725857119504 ], [ -89.957656012720122, 47.28690725360326 ], [ -90.131753913111424, 47.292746690452191 ], [ -90.30585181350267, 47.298017686546018 ], [ -90.479949713894086, 47.303857123394891 ], [ -90.654047614285332, 47.309128119488719 ], [ -90.857781948596084, 47.21282908791278 ], [ -91.060973680367738, 47.11704682065988 ], [ -91.26470801467849, 47.021264553406809 ], [ -91.468442348989129, 46.924965521831041 ], [ -91.592259080760527, 46.876260484395914 ], [ -91.716618415070855, 46.827607123393136 ], [ -91.840977749381295, 46.778385321635085 ], [ -91.96479448115258, 46.729706122416133 ], [ -92.011897549186642, 46.711722723978539 ], [ -92.274878913119949, 46.65614472104869 ], [ -92.264827847039214, 46.095222886736394 ], [ -92.29658301468254, 46.096282253598361 ], [ -92.543699713902299, 45.985694688493822 ], [ -92.756968349970805, 45.889912421240922 ], [ -92.89982784704182, 45.705763454768714 ], [ -92.689220547236232, 45.518436387710665 ], [ -92.765417446650645, 45.267082221042983 ], [ -92.766476813512611, 44.9961426865367 ], [ -92.796655849970989, 44.776026923189534 ], [ -92.505071580764138, 44.58391978614452 ], [ -92.385492316440718, 44.574928086925695 ], [ -92.062152879590428, 44.432585354177775 ], [ -91.949989183301, 44.364837551443088 ], [ -91.879605882519456, 44.257428086924392 ], [ -91.627709113312733, 44.085448920257079 ], [ -91.289590216827037, 43.937292588876289 ], [ -91.257292446644556, 43.854739488290079 ], [ -91.254656948597699, 43.61397899024206 ], [ -91.228198615264205, 43.501246853197358 ], [ -92.540004848993419, 43.51977285417405 ], [ -94.001026780965447, 43.513416653002253 ], [ -95.359936082728666, 43.500187486335392 ], [ -96.452660081756449, 43.501789455736457 ], [ -96.439430915089815, 44.435763454763674 ], [ -96.560612148814243, 45.393017686538371 ], [ -96.735769416067512, 45.470816555353849 ], [ -96.834703945690308, 45.625329087906437 ], [ -96.78072791216141, 45.760798855159635 ], [ -96.556891445689132, 45.872445787126196 ], [ -96.539450649790751, 46.017966620460186 ], [ -96.538908047251653, 46.199480088885366 ], [ -96.601359015676337, 46.351357123391153 ], [ -96.685488247447495, 46.513285223977732 ], [ -96.73365068234358, 46.716476955749272 ], [ -96.745820482148304, 46.944525051453297 ], [ -96.779694383515618, 46.99904368752135 ], [ -96.820415412161651, 47.292204087913092 ], [ -96.824652879609516, 47.426614488304381 ], [ -96.844238247448175, 47.546193752627744 ], [ -96.893976813529093, 47.748868720076416 ], [ -97.015158047253522, 47.95420502378812 ], [ -97.131042446668005, 48.137294623398304 ], [ -97.148509080782731, 48.31878225360731 ], [ -97.161221483126496, 48.514584255561317 ], [ -97.127347581759125, 48.642121690457543 ], [ -97.120474616264346, 48.758522854195007 ], [ -97.214138149793428, 48.902441718127932 ], [ -97.228943447645008, 49.000885321643864 ], [ -95.158837246464827, 48.999825954781898 ], [ -95.156201748417914, 49.384014390655921 ], [ -94.817540249393232, 49.389285386749748 ], [ -94.640264248415917, 48.840016587919251 ], [ -94.329120449586469, 48.670672919298795 ], [ -93.630610114297326, 48.60928131773602 ], [ -92.609845547235864, 48.450014553412529 ], [ -91.639878913117457, 48.139930121445161 ], [ -90.830264248400624, 48.270103054388358 ], [ -89.599951748395767, 48.010273952824832 ], [ -89.599409145856669, 48.010273952824832 ] ] ] } }, 6 | { "type": "Feature", "properties": { "name": "Montana", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "MT", "id": "USA-3515" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -111.19418921593007, 44.561156317719878 ], [ -111.29154761436796, 44.701406154960026 ], [ -111.40001644574861, 44.728923855155443 ], [ -111.54238501671271, 44.53048635515465 ], [ -111.77149247927873, 44.498214423188372 ], [ -112.33613501671589, 44.560639553396953 ], [ -112.36259335004932, 44.462221788097082 ], [ -112.69014441613137, 44.498731187511297 ], [ -112.87481014692638, 44.360083319672199 ], [ -113.05208614790365, 44.619912421235739 ], [ -113.174843512813, 44.765433254569658 ], [ -113.37857784712371, 44.78977285417912 ], [ -113.43942684614738, 44.862791653007548 ], [ -113.50293718143411, 45.124222723972125 ], [ -113.68021318241136, 45.249072984389301 ], [ -113.79449561242484, 45.56499685320567 ], [ -113.91410071496439, 45.702585354182773 ], [ -114.03579871301176, 45.730103054378205 ], [ -114.13793718143664, 45.589336452815132 ], [ -114.33531531457545, 45.470273952814665 ], [ -114.51365068241471, 45.569234320653592 ], [ -114.52370174849547, 45.825368557308266 ], [ -114.40727474654187, 45.889912421240822 ], [ -114.49142981652921, 46.147080186541331 ], [ -114.39404557987515, 46.410087388690812 ], [ -114.28451738163254, 46.631805121439101 ], [ -114.58561011438114, 46.641339423196953 ], [ -114.8433204822207, 46.786317653991802 ], [ -115.12164974654473, 47.09536855731335 ], [ -115.28833207890217, 47.250397854188975 ], [ -115.51906734908539, 47.345120754579966 ], [ -115.70479244674239, 47.504930121442584 ], [ -115.70427568241946, 47.684841620466742 ], [ -115.96779964889187, 47.950484320663122 ], [ -116.04823401575418, 49.000368557320968 ], [ -113.05950171593753, 49.001402085966802 ], [ -110.0707694161209, 49.003004055367853 ], [ -107.08203711630425, 49.004580186552758 ], [ -104.09276221394853, 49.005639553414738 ], [ -104.07741431355785, 47.17156545672772 ], [ -104.02661638061494, 45.956600857113486 ], [ -104.07795691609692, 45.040610256523877 ], [ -105.74589128296557, 45.051178086927564 ], [ -107.54663408082433, 45.045881252617647 ], [ -109.10237891318732, 45.057017523776551 ], [ -111.07140601280457, 45.049601955742659 ], [ -111.0671943835728, 44.541596788097408 ], [ -111.08517778201036, 44.506146755545174 ], [ -111.19418921593007, 44.561156317719878 ] ] ] } }, 7 | { "type": "Feature", "properties": { "name": "North Dakota", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "ND", "id": "USA-3516" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -96.60135901567638, 46.351357123391097 ], [ -96.538908047251653, 46.199480088885281 ], [ -96.539450649790723, 46.017966620460086 ], [ -98.44178931353531, 45.963447984392147 ], [ -100.06685807981785, 45.965566718116122 ], [ -102.11686214883646, 45.961355088884332 ], [ -104.02661638061494, 45.956600857113486 ], [ -104.07741431355785, 47.17156545672772 ], [ -104.09276221394853, 49.005639553414738 ], [ -100.62989864785396, 49.003004055367853 ], [ -97.228943447645037, 49.000885321643892 ], [ -97.214138149793413, 48.902441718127875 ], [ -97.120474616264403, 48.758522854195007 ], [ -97.12734758175921, 48.642121690457557 ], [ -97.161221483126539, 48.514584255561218 ], [ -97.148509080782731, 48.31878225360731 ], [ -97.13104244666809, 48.137294623398247 ], [ -97.01515804725355, 47.954205023788134 ], [ -96.893976813529122, 47.748868720076374 ], [ -96.844238247448189, 47.546193752627659 ], [ -96.824652879609573, 47.426614488304253 ], [ -96.820415412161623, 47.292204087913092 ], [ -96.779694383515633, 46.999043687521294 ], [ -96.745820482148304, 46.944525051453368 ], [ -96.73365068234358, 46.716476955749329 ], [ -96.685488247447552, 46.513285223977689 ], [ -96.60135901567638, 46.351357123391097 ] ] ] } }, 8 | { "type": "Feature", "properties": { "name": "Hawaii", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "HI", "id": "USA-3517" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -155.93665, 19.05939 ], [ -155.90806, 19.33888 ], [ -156.07347, 19.702939999999899 ], [ -156.02368, 19.81422 ], [ -155.85008, 19.97729 ], [ -155.91907, 20.17395 ], [ -155.86108, 20.26721 ], [ -155.78505, 20.2487 ], [ -155.40214, 20.07975 ], [ -155.22452, 19.993020000000172 ], [ -155.06226, 19.8591 ], [ -154.80741, 19.508710000000121 ], [ -154.83147, 19.45328 ], [ -155.22217, 19.239720000000148 ], [ -155.54211, 19.08348 ], [ -155.68817, 18.916190000000142 ], [ -155.93665, 19.05939 ] ] ], [ [ [ -155.99566, 20.76404 ], [ -156.07926, 20.64397 ], [ -156.41445, 20.57241 ], [ -156.58673, 20.783 ], [ -156.70167, 20.864300000000128 ], [ -156.71055, 20.92676 ], [ -156.61258, 21.012490000000128 ], [ -156.25711, 20.91745 ], [ -155.99566, 20.76404 ] ] ], [ [ [ -156.75824, 21.176840000000141 ], [ -156.78933, 21.06873 ], [ -157.32521, 21.09777 ], [ -157.25027, 21.219579999999894 ], [ -156.75824, 21.176840000000141 ] ] ], [ [ [ -158.12667, 21.31244 ], [ -158.2538, 21.53919 ], [ -158.29265, 21.579120000000103 ], [ -158.0252, 21.71696 ], [ -157.94161, 21.652720000000102 ], [ -157.65283, 21.32217 ], [ -157.70703, 21.26442 ], [ -157.7786, 21.27729 ], [ -158.12667, 21.31244 ] ] ], [ [ [ -159.80051, 22.065330000000131 ], [ -159.74877, 22.1382 ], [ -159.5962, 22.236180000000104 ], [ -159.36569, 22.21494 ], [ -159.34512, 21.982000000000141 ], [ -159.46372, 21.88299 ], [ -159.80051, 22.065330000000131 ] ] ] ] } }, 9 | { "type": "Feature", "properties": { "name": "Idaho", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "ID", "id": "USA-3518" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -111.04972774945814, 44.488163357107609 ], [ -111.05024451378105, 42.001596788087241 ], [ -114.03422258182684, 41.993121853191369 ], [ -117.0282517159534, 42.000020656902336 ], [ -117.0139631824247, 43.797068589852231 ], [ -116.92665585006759, 44.0812114528091 ], [ -117.00760698125281, 44.211410223968471 ], [ -117.19439144577179, 44.279132188486983 ], [ -117.19229855026396, 44.438941555349601 ], [ -117.0515319487009, 44.665956122407792 ], [ -116.83614457890837, 44.863851019869529 ], [ -116.69328508183749, 45.186647854180706 ], [ -116.55887468144633, 45.444358222020284 ], [ -116.45779557988342, 45.574531154963509 ], [ -116.51125484908937, 45.726408189469325 ], [ -116.67899654830879, 45.807359320654555 ], [ -116.91500281458576, 45.999983222022507 ], [ -116.9065278796899, 46.177775987322704 ], [ -116.99807267949495, 46.33016978615143 ], [ -117.02664974655237, 47.722927151065861 ], [ -117.03142981653936, 48.999309190458987 ], [ -116.04823401575418, 49.000368557320968 ], [ -115.96779964889187, 47.950484320663122 ], [ -115.70427568241946, 47.684841620466742 ], [ -115.70479244674239, 47.504930121442584 ], [ -115.51906734908539, 47.345120754579966 ], [ -115.28833207890217, 47.250397854188975 ], [ -115.12164974654473, 47.09536855731335 ], [ -114.8433204822207, 46.786317653991802 ], [ -114.58561011438114, 46.641339423196953 ], [ -114.28451738163254, 46.631805121439101 ], [ -114.39404557987515, 46.410087388690812 ], [ -114.49142981652921, 46.147080186541331 ], [ -114.40727474654187, 45.889912421240822 ], [ -114.52370174849547, 45.825368557308266 ], [ -114.51365068241471, 45.569234320653592 ], [ -114.33531531457545, 45.470273952814665 ], [ -114.13793718143664, 45.589336452815132 ], [ -114.03579871301176, 45.730103054378205 ], [ -113.91410071496439, 45.702585354182773 ], [ -113.79449561242484, 45.56499685320567 ], [ -113.68021318241136, 45.249072984389301 ], [ -113.50293718143411, 45.124222723972125 ], [ -113.43942684614738, 44.862791653007548 ], [ -113.37857784712371, 44.78977285417912 ], [ -113.174843512813, 44.765433254569658 ], [ -113.05208614790365, 44.619912421235739 ], [ -112.87481014692638, 44.360083319672199 ], [ -112.69014441613137, 44.498731187511297 ], [ -112.36259335004932, 44.462221788097082 ], [ -112.33613501671589, 44.560639553396953 ], [ -111.77149247927873, 44.498214423188372 ], [ -111.54238501671271, 44.53048635515465 ], [ -111.40001644574861, 44.728923855155443 ], [ -111.29154761436796, 44.701406154960026 ], [ -111.19418921593007, 44.561156317719878 ], [ -111.08517778201036, 44.506146755545174 ], [ -111.04972774945814, 44.488163357107609 ] ] ] } }, 10 | { "type": "Feature", "properties": { "name": "Washington", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "WA", "id": "USA-3519" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -116.9980726794949, 46.330169786151487 ], [ -116.90652787968992, 46.177775987322832 ], [ -116.9150028145857, 45.999983222022593 ], [ -118.97823605027111, 45.992567653988658 ], [ -119.33699968145743, 45.888336290055861 ], [ -119.59204952047821, 45.932235419287906 ], [ -119.78730891989301, 45.850767523779837 ], [ -120.15826818910023, 45.740670884781935 ], [ -120.60963598695361, 45.753900051448625 ], [ -120.83719315655094, 45.672948920263423 ], [ -121.0467410894945, 45.637498887711104 ], [ -121.203889120094, 45.689898790055224 ], [ -121.56107662009549, 45.732764390641307 ], [ -121.78809118715355, 45.700983384781807 ], [ -122.17491512107449, 45.595150051447945 ], [ -122.42045568910925, 45.591997789078221 ], [ -122.65170772361546, 45.63008331967734 ], [ -122.72578588930577, 45.770333156917559 ], [ -122.75224422263926, 45.93807485613678 ], [ -122.9379693202963, 46.12909678810388 ], [ -123.22849422264113, 46.186250922218562 ], [ -123.47137345441303, 46.277253119484669 ], [ -123.77670365460955, 46.282033189471633 ], [ -123.99867632678428, 46.283069487104399 ], [ -124.079635, 46.86475 ], [ -124.39567, 47.72017000000011 ], [ -124.68721008300781, 48.184432983398381 ], [ -124.56610107421875, 48.379714965820426 ], [ -123.12, 48.04 ], [ -122.58713802146673, 47.095885321636388 ], [ -122.34002132224703, 47.359951890647778 ], [ -122.49983068910967, 48.180160223984387 ], [ -122.84, 49.000000000000114 ], [ -120.00269628968556, 49.000885321643864 ], [ -117.03142981653929, 48.999309190458973 ], [ -117.02664974655227, 47.72292715106596 ], [ -116.9980726794949, 46.330169786151487 ] ] ] } }, 11 | { "type": "Feature", "properties": { "name": "Arizona", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "AZ", "id": "USA-3520" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -109.04522477907244, 36.999912421205295 ], [ -109.04367281021746, 31.341899137315409 ], [ -111.02378618044753, 31.334650987263331 ], [ -113.30501644575611, 32.038974921185513 ], [ -114.81474341516332, 32.52527598726806 ], [ -114.72139, 32.72083 ], [ -114.58984758182902, 32.716297919235103 ], [ -114.47977678104735, 32.916337388636919 ], [ -114.6559934151627, 33.053900051397932 ], [ -114.6914434477149, 33.203684190395791 ], [ -114.74330074751975, 33.379874986294965 ], [ -114.54855811242783, 33.609525051399999 ], [ -114.46918311242757, 34.067274888641464 ], [ -114.16597164595498, 34.272585354137163 ], [ -114.35490068241404, 34.464666652966002 ], [ -114.48453101281825, 34.653053086886075 ], [ -114.56708411340441, 34.828210354139287 ], [ -114.62211951379533, 34.963680121392485 ], [ -114.64222164595685, 35.053106187473588 ], [ -114.58085588261031, 35.249424953750463 ], [ -114.63005184615207, 35.4452269557043 ], [ -114.65069658085275, 35.638910223934147 ], [ -114.65017981652977, 35.854271755510581 ], [ -114.73960588261087, 35.99131765394867 ], [ -114.67134131555338, 36.114617621397031 ], [ -114.46073401574779, 36.114617621397031 ], [ -114.26916948124182, 36.043691718076445 ], [ -114.13264034712671, 36.004004218076261 ], [ -114.06649451379315, 36.156423855121147 ], [ -114.02362891320701, 36.189755153949477 ], [ -114.03052771691796, 36.994098822572425 ], [ -112.41760291222397, 37.009420884746987 ], [ -110.4962214831798, 37.007327989239059 ], [ -109.04522477907244, 36.999912421205295 ] ] ] } }, 12 | { "type": "Feature", "properties": { "name": "California", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "CA", "id": "USA-3521" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -114.35490068241404, 34.464666652966002 ], [ -114.16597164595498, 34.272585354137163 ], [ -114.46918311242757, 34.067274888641464 ], [ -114.54855811242783, 33.609525051399999 ], [ -114.74330074751975, 33.379874986294965 ], [ -114.6914434477149, 33.203684190395791 ], [ -114.6559934151627, 33.053900051397932 ], [ -114.47977678104735, 32.916337388636919 ], [ -114.58984758182902, 32.716297919235103 ], [ -114.72139, 32.72083 ], [ -115.99107988163934, 32.612583319625173 ], [ -117.12772884811523, 32.535327053348965 ], [ -117.29593769127388, 33.046224615203755 ], [ -117.944, 33.621236431201226 ], [ -118.41060227589759, 33.740909223124504 ], [ -118.51989482279981, 34.027781577575752 ], [ -119.081, 34.078 ], [ -119.43884064201677, 34.348477178284156 ], [ -120.36781612204385, 34.447225857067508 ], [ -120.6228651536203, 34.608611355114988 ], [ -120.74458898988388, 35.156820787083291 ], [ -121.71455562400223, 36.161720689431149 ], [ -122.54745052146654, 37.551816718082421 ], [ -122.51200048891434, 37.783611355127618 ], [ -122.95331722068698, 38.113797919256683 ], [ -123.72696508852863, 38.951472886707791 ], [ -123.86507035382857, 39.76692698827361 ], [ -124.39795772362243, 40.313017686518037 ], [ -124.17887548892094, 41.142243557289589 ], [ -124.21380875715033, 41.999478054363351 ], [ -119.9989755865605, 41.992605088868459 ], [ -120.00003495342247, 38.99539785415601 ], [ -118.11461951380932, 37.644420884749593 ], [ -116.32074968144531, 36.322046820616663 ], [ -114.64222164595685, 35.053106187473588 ], [ -114.62211951379533, 34.963680121392485 ], [ -114.56708411340441, 34.828210354139287 ], [ -114.48453101281825, 34.653053086886075 ], [ -114.35490068241404, 34.464666652966002 ] ] ] } }, 13 | { "type": "Feature", "properties": { "name": "Colorado", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "CO", "id": "USA-3522" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -102.05017371296381, 40.000814520826637 ], [ -102.04012264688303, 38.459874986315256 ], [ -102.04118201374501, 36.99198008884845 ], [ -103.00321631550668, 36.995158189434406 ], [ -104.20019751668335, 36.99619171808024 ], [ -105.8998612129792, 36.997276923158367 ], [ -107.47997148316782, 36.999912421205252 ], [ -109.04522477907251, 36.999912421205252 ], [ -109.05318294964546, 41.001993720049384 ], [ -108.05094438356073, 41.002536322588455 ], [ -107.04973934612183, 41.002536322588455 ], [ -105.04686418335339, 41.003595689450435 ], [ -104.04514238159157, 41.004112453773359 ], [ -102.04805497923984, 41.004112453773359 ], [ -102.05017371296381, 40.033086452792915 ], [ -102.05017371296381, 40.000814520826637 ] ] ] } }, 14 | { "type": "Feature", "properties": { "name": "Nevada", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "NV", "id": "USA-3523" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -114.03052771691799, 36.994098822572425 ], [ -114.02362891320701, 36.189755153949406 ], [ -114.06649451379312, 36.156423855121147 ], [ -114.13264034712672, 36.004004218076275 ], [ -114.26916948124185, 36.043691718076431 ], [ -114.46073401574782, 36.114617621397031 ], [ -114.67134131555335, 36.114617621397031 ], [ -114.73960588261092, 35.991317653948613 ], [ -114.65017981652983, 35.854271755510567 ], [ -114.65069658085275, 35.63891022393419 ], [ -114.63005184615216, 35.445226955704243 ], [ -114.58085588261028, 35.249424953750335 ], [ -114.64222164595688, 35.053106187473503 ], [ -116.32074968144536, 36.322046820616606 ], [ -118.11461951380932, 37.644420884749493 ], [ -120.00003495342257, 38.995397854155939 ], [ -119.99897558656059, 41.992605088868459 ], [ -117.0282517159534, 41.997359320639305 ], [ -117.0282517159534, 42.000020656902336 ], [ -114.03422258182684, 41.993121853191369 ], [ -114.03052771691799, 36.994098822572425 ] ] ] } }, 15 | { "type": "Feature", "properties": { "name": "New Mexico", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "NM", "id": "USA-3524" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -103.00161434610561, 33.879947821583414 ], [ -103.00161434610561, 31.999287421185329 ], [ -103.92977474649996, 31.999287421185329 ], [ -105.73000078003582, 31.999287421185329 ], [ -106.63012671591179, 31.999287421185329 ], [ -106.61953304729195, 31.914098822552091 ], [ -106.50734351278624, 31.754289455689502 ], [ -108.24, 31.75485371816643 ], [ -108.24196631552763, 31.342066555297265 ], [ -109.04367281021746, 31.341899137315409 ], [ -109.04522477907244, 36.999912421205295 ], [ -107.47997148316779, 36.999912421205295 ], [ -105.8998612129792, 36.997276923158495 ], [ -104.20019751668332, 36.996191718080354 ], [ -103.00321631550662, 36.995158189434392 ], [ -103.00161434610561, 36.499322821593978 ], [ -103.00161434610561, 33.879947821583414 ] ] ] } }, 16 | { "type": "Feature", "properties": { "name": "Oregon", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "OR", "id": "USA-3525" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -117.02825171595339, 42.000020656902393 ], [ -117.02825171595339, 41.997359320639418 ], [ -119.9989755865605, 41.992605088868459 ], [ -124.21380875715033, 41.999478054363351 ], [ -124.53284, 42.765990000000102 ], [ -124.14214, 43.70838 ], [ -123.89893, 45.523410000000126 ], [ -123.99867632678428, 46.283069487104399 ], [ -123.77670365460955, 46.282033189471633 ], [ -123.47137345441303, 46.277253119484669 ], [ -123.22849422264113, 46.186250922218562 ], [ -122.9379693202963, 46.12909678810388 ], [ -122.75224422263926, 45.93807485613678 ], [ -122.72578588930577, 45.770333156917559 ], [ -122.65170772361546, 45.63008331967734 ], [ -122.42045568910925, 45.591997789078221 ], [ -122.17491512107449, 45.595150051447945 ], [ -121.78809118715355, 45.700983384781807 ], [ -121.56107662009549, 45.732764390641307 ], [ -121.203889120094, 45.689898790055224 ], [ -121.0467410894945, 45.637498887711104 ], [ -120.83719315655094, 45.672948920263423 ], [ -120.60963598695361, 45.753900051448625 ], [ -120.15826818910023, 45.740670884781935 ], [ -119.78730891989301, 45.850767523779837 ], [ -119.59204952047821, 45.932235419287906 ], [ -119.33699968145743, 45.888336290055861 ], [ -118.97823605027111, 45.992567653988658 ], [ -116.9150028145857, 45.999983222022593 ], [ -116.67899654830876, 45.807359320654484 ], [ -116.51125484908931, 45.726408189469339 ], [ -116.4577955798834, 45.574531154963552 ], [ -116.5588746814463, 45.444358222020298 ], [ -116.69328508183747, 45.186647854180706 ], [ -116.83614457890837, 44.863851019869571 ], [ -117.05153194870093, 44.665956122407863 ], [ -117.19229855026396, 44.438941555349572 ], [ -117.19439144577171, 44.279132188486983 ], [ -117.00760698125271, 44.211410223968471 ], [ -116.92665585006762, 44.081211452809214 ], [ -117.01396318242467, 43.797068589852302 ], [ -117.02825171595339, 42.000020656902393 ] ] ] } }, 17 | { "type": "Feature", "properties": { "name": "Utah", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "UT", "id": "USA-3526" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -109.05318294964546, 41.001993720049384 ], [ -109.04522477907253, 36.999912421205238 ], [ -110.49622148317988, 37.007327989239137 ], [ -112.41760291222404, 37.009420884746952 ], [ -114.03052771691799, 36.994098822572425 ], [ -114.03422258182684, 41.993121853191376 ], [ -111.05024451378105, 42.00159678808722 ], [ -111.05448198122899, 41.027935289059904 ], [ -109.05318294964546, 41.001993720049384 ] ] ] } }, 18 | { "type": "Feature", "properties": { "name": "Wyoming", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "WY", "id": "USA-3527" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -111.0671943835728, 44.541596788097408 ], [ -111.07140601280457, 45.049601955742659 ], [ -109.10237891318732, 45.057017523776551 ], [ -107.54663408082433, 45.045881252617647 ], [ -105.74589128296557, 45.051178086927564 ], [ -104.07795691609692, 45.040610256523877 ], [ -104.05255794962545, 43.000140489263117 ], [ -104.04514238159157, 41.004112453773359 ], [ -105.04686418335339, 41.003595689450435 ], [ -107.04973934612183, 41.002536322588455 ], [ -108.05094438356073, 41.002536322588455 ], [ -109.05318294964546, 41.001993720049384 ], [ -111.05448198122899, 41.027935289059911 ], [ -111.05024451378105, 42.001596788087241 ], [ -111.04972774945814, 44.488163357107609 ], [ -111.08517778201036, 44.506146755545174 ], [ -111.0671943835728, 44.541596788097408 ] ] ] } }, 19 | { "type": "Feature", "properties": { "name": "Arkansas", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "AR", "id": "USA-3528" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -89.662919481143419, 36.023072821591967 ], [ -89.673513149763252, 35.94000295668279 ], [ -89.775109015649065, 35.799236355119717 ], [ -89.950266282902376, 35.701877956681827 ], [ -89.988894416040552, 35.536229152970236 ], [ -90.147101813502132, 35.404996853165017 ], [ -90.13493201369738, 35.113955186497193 ], [ -90.249240281927001, 35.020834255507239 ], [ -90.268283047226561, 34.941459255506913 ], [ -90.446618415065814, 34.866838487277448 ], [ -90.450313279974694, 34.7218602564826 ], [ -90.584206916042945, 34.454098822562258 ], [ -90.6995487129184, 34.397461452770358 ], [ -90.876307949572748, 34.261474921194306 ], [ -90.982141282906497, 34.055105088836697 ], [ -91.20068091506883, 33.706392523731139 ], [ -91.223444383493415, 33.469326890592171 ], [ -91.1080767484018, 33.2068364527656 ], [ -91.156239183297828, 33.010000922165858 ], [ -92.001303880566837, 33.043874823533173 ], [ -93.094027879594648, 33.010517686488768 ], [ -94.059757046265162, 33.012119655889819 ], [ -94.002086147827441, 33.57991445569678 ], [ -94.233338182333569, 33.583609320605646 ], [ -94.427538214886425, 33.570380153938927 ], [ -94.479912279014258, 33.635983384733464 ], [ -94.451361050172991, 34.510710354137998 ], [ -94.430173712933311, 35.483312486303348 ], [ -94.628611212934118, 36.540586452778939 ], [ -93.412587246457889, 36.52629791925024 ], [ -92.30717668330243, 36.523662421203355 ], [ -91.251478848011743, 36.52314565688043 ], [ -90.112194383488969, 36.461754055317684 ], [ -90.029098680363632, 36.337937323546356 ], [ -90.141804979192216, 36.230502020811556 ], [ -90.253994513697862, 36.122549953753833 ], [ -90.315386115260608, 36.023072821591967 ], [ -89.662919481143419, 36.023072821591967 ] ] ] } }, 20 | { "type": "Feature", "properties": { "name": "Iowa", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "IA", "id": "USA-3529" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -90.156636115259971, 42.103735256512124 ], [ -90.21006954624977, 41.834914455729802 ], [ -90.395277879583844, 41.608416652994521 ], [ -90.461966315456507, 41.536457221028087 ], [ -90.690557013699618, 41.478786322590352 ], [ -91.033998582711405, 41.429564520832344 ], [ -91.123424648792479, 41.257585354164988 ], [ -90.999065314482095, 41.179812323565727 ], [ -90.956742316435054, 41.024757188473956 ], [ -91.087432013701203, 40.851718654944619 ], [ -91.154120449573867, 40.699841620438804 ], [ -91.410228848012395, 40.551142686518943 ], [ -91.43033098017392, 40.368595689447901 ], [ -91.567402716828127, 40.452208156896148 ], [ -91.758424648795028, 40.614110419266581 ], [ -92.851665412145763, 40.59243215592015 ], [ -94.002086147827441, 40.585016587886258 ], [ -94.89849138057842, 40.583440456701354 ], [ -95.79649858273045, 40.583957221024278 ], [ -95.862101813524987, 40.764928086910416 ], [ -95.834067349006645, 40.943806057288739 ], [ -95.855745612353076, 41.116301988279019 ], [ -95.958426683317043, 41.404708156899957 ], [ -96.02508928097356, 41.524287421223349 ], [ -96.097048712939994, 41.556559353189627 ], [ -96.104464280973872, 41.787811387695768 ], [ -96.167432013721523, 41.953434353191213 ], [ -96.348945482146718, 42.141820787111243 ], [ -96.346826748422757, 42.22437388769751 ], [ -96.410311245493318, 42.389480088870044 ], [ -96.455295579803391, 42.488957221031896 ], [ -96.4537194486185, 42.58050202083696 ], [ -96.615647549205079, 42.691632188480625 ], [ -96.535213182342773, 42.855679022791179 ], [ -96.483355882537893, 43.016005153976721 ], [ -96.459533047251341, 43.124499823573501 ], [ -96.587070482147681, 43.257308254563625 ], [ -96.586011115285686, 43.501246853197401 ], [ -96.452660081756505, 43.501789455736471 ], [ -95.359936082728709, 43.50018748633542 ], [ -94.001026780965461, 43.513416653002139 ], [ -92.540004848993476, 43.51977285417405 ], [ -91.228198615264262, 43.501246853197401 ], [ -91.213910081735548, 43.446754055345622 ], [ -91.083737148792324, 43.288004055344999 ], [ -91.173163214873426, 43.212323920253539 ], [ -91.169985114287471, 43.002233384770932 ], [ -91.12923824742532, 42.91283315690599 ], [ -91.064694383492764, 42.754083156905352 ], [ -90.738176846056575, 42.65827505143622 ], [ -90.640818447618685, 42.50536448828457 ], [ -90.582604946641879, 42.4291675888702 ], [ -90.464601813503393, 42.378369655927287 ], [ -90.416981981146435, 42.270417588869563 ], [ -90.259808112330703, 42.189983222007271 ], [ -90.156636115259971, 42.103735256512124 ] ] ] } }, 21 | { "type": "Feature", "properties": { "name": "Kansas", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "KS", "id": "USA-3530" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -94.604814215863712, 39.139859320627878 ], [ -94.615382046267399, 38.068839423162657 ], [ -94.622797614301277, 36.999912421205252 ], [ -95.500160081752711, 36.998853054343272 ], [ -97.29984351274949, 36.997276923158367 ], [ -99.10006954628534, 36.995158189434406 ], [ -100.10021521686225, 36.994098822572425 ], [ -101.09979244668396, 36.993039455710431 ], [ -102.04118201374501, 36.99198008884845 ], [ -102.04012264688303, 38.459874986315256 ], [ -102.05017371296381, 40.000814520826637 ], [ -102.04805497923984, 40.000814520826637 ], [ -100.30022884804795, 40.000814520826637 ], [ -99.00007564980055, 40.000814520826637 ], [ -96.699776780976251, 40.001357123365693 ], [ -95.322884080775424, 40.001357123365693 ], [ -95.085301683313546, 39.868006089836513 ], [ -94.95510291215416, 39.870124823560488 ], [ -94.926551683312908, 39.725120754549494 ], [ -95.06729244665982, 39.539912421215419 ], [ -94.991095547245465, 39.44467275650149 ], [ -94.867795579797047, 39.234582221018883 ], [ -94.604814215863712, 39.139859320627878 ] ] ] } }, 22 | { "type": "Feature", "properties": { "name": "Missouri", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "MO", "id": "USA-3531" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -94.61750077999136, 36.999912421205252 ], [ -94.622797614301277, 36.999912421205252 ], [ -94.615382046267399, 38.068839423162657 ], [ -94.604814215863712, 39.139859320627878 ], [ -94.867795579797047, 39.234582221018883 ], [ -94.991095547245465, 39.44467275650149 ], [ -95.06729244665982, 39.539912421215419 ], [ -94.926551683312908, 39.725120754549494 ], [ -94.95510291215416, 39.870124823560488 ], [ -95.085301683313546, 39.868006089836513 ], [ -95.322884080775424, 40.001357123365693 ], [ -95.452540249395753, 40.21514252375718 ], [ -95.60811214881042, 40.343170884760298 ], [ -95.776370612352764, 40.501404120438011 ], [ -95.79649858273045, 40.583957221024278 ], [ -94.89849138057842, 40.583440456701354 ], [ -94.002086147827441, 40.585016587886258 ], [ -92.851665412145763, 40.59243215592015 ], [ -91.758424648795028, 40.614110419266581 ], [ -91.567402716828127, 40.452208156896148 ], [ -91.43033098017392, 40.368595689447901 ], [ -91.517638312531034, 40.119877020827104 ], [ -91.428212246449959, 39.820903021802479 ], [ -91.262589280954501, 39.615049953767794 ], [ -91.0715673489876, 39.445189520824414 ], [ -90.841374681343439, 39.310779120433253 ], [ -90.749287278999333, 39.265278021800256 ], [ -90.665700649767217, 39.074772854156265 ], [ -90.649810146837467, 38.907547919259756 ], [ -90.535527716823992, 38.865767523751785 ], [ -90.346598680364906, 38.930311387684327 ], [ -90.156093512720901, 38.769442653959729 ], [ -90.212730882512801, 38.584776923164725 ], [ -90.305335049179831, 38.439256089830806 ], [ -90.369878913112387, 38.263556220038438 ], [ -90.228078782903481, 38.113281154933659 ], [ -90.030158047225612, 37.971997789047691 ], [ -89.916909145857971, 37.968277085922665 ], [ -89.654987148786617, 37.748678086898352 ], [ -89.5539080472237, 37.719041652978959 ], [ -89.479287278994235, 37.477221788069144 ], [ -89.51633928094752, 37.326920884748233 ], [ -89.388285081728256, 37.081406154929539 ], [ -89.280333014670532, 37.107347723940066 ], [ -89.10305701369326, 36.952292588848294 ], [ -89.134269578797557, 36.851756089824448 ], [ -89.115226813497998, 36.694582221008716 ], [ -89.273976813498621, 36.611512356099539 ], [ -89.498355882509941, 36.5061957870887 ], [ -89.524271613304322, 36.409354152973719 ], [ -89.585120612327998, 36.267011420225757 ], [ -89.662919481143419, 36.023072821591967 ], [ -90.315386115260608, 36.023072821591967 ], [ -90.253994513697862, 36.122549953753833 ], [ -90.141804979192216, 36.230502020811556 ], [ -90.029098680363632, 36.337937323546356 ], [ -90.112194383488969, 36.461754055317684 ], [ -91.251478848011743, 36.52314565688043 ], [ -92.30717668330243, 36.523662421203355 ], [ -93.412587246457889, 36.52629791925024 ], [ -94.628611212934118, 36.540586452778939 ], [ -94.61750077999136, 36.999912421205252 ] ] ] } }, 23 | { "type": "Feature", "properties": { "name": "Nebraska", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "NE", "id": "USA-3532" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -95.452540249395753, 40.21514252375718 ], [ -95.322884080775424, 40.001357123365693 ], [ -96.699776780976251, 40.001357123365693 ], [ -99.00007564980055, 40.000814520826637 ], [ -100.30022884804795, 40.000814520826637 ], [ -102.04805497923984, 40.000814520826637 ], [ -102.05017371296381, 40.000814520826637 ], [ -102.05017371296381, 40.033086452792915 ], [ -102.04805497923984, 41.004112453773359 ], [ -104.04514238159157, 41.004112453773359 ], [ -104.05255794962545, 43.000140489263117 ], [ -102.09991227904473, 43.000140489263117 ], [ -100.59974544961165, 43.000140489263117 ], [ -98.59418311236405, 43.000140489263117 ], [ -98.335955980201547, 42.873662421228758 ], [ -97.96820064979643, 42.794287421228432 ], [ -97.88192684608515, 42.839788519861429 ], [ -97.644344448623258, 42.836093654952563 ], [ -97.287156948621828, 42.846144721033326 ], [ -97.028387213920269, 42.717547919275006 ], [ -96.75426957882803, 42.63396129004289 ], [ -96.708768480195033, 42.550865586917567 ], [ -96.623037279022824, 42.502728990237685 ], [ -96.455295579803391, 42.488957221031896 ], [ -96.410311245493318, 42.389480088870044 ], [ -96.346826748422757, 42.22437388769751 ], [ -96.348945482146718, 42.141820787111243 ], [ -96.167432013721523, 41.953434353191213 ], [ -96.104464280973872, 41.787811387695768 ], [ -96.097048712939994, 41.556559353189627 ], [ -96.02508928097356, 41.524287421223349 ], [ -95.958426683317043, 41.404708156899957 ], [ -95.855745612353076, 41.116301988279019 ], [ -95.834067349006645, 40.943806057288739 ], [ -95.862101813524987, 40.764928086910416 ], [ -95.79649858273045, 40.583957221024278 ], [ -95.776370612352764, 40.501404120438011 ], [ -95.60811214881042, 40.343170884760298 ], [ -95.452540249395753, 40.21514252375718 ] ] ] } }, 24 | { "type": "Feature", "properties": { "name": "Oklahoma", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "OK", "id": "USA-3533" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -94.628611212934118, 36.540586452778939 ], [ -94.430173712933311, 35.483312486303348 ], [ -94.451361050172991, 34.510710354137998 ], [ -94.479912279014258, 33.635983384733464 ], [ -94.910144416060234, 33.831785386687372 ], [ -95.190592414108238, 33.938161322560191 ], [ -95.418123745489353, 33.870413519825547 ], [ -95.769497646857957, 33.881007188445381 ], [ -95.977469448616603, 33.879431057260476 ], [ -96.148906012744874, 33.797937323536189 ], [ -96.316130947641383, 33.756131089812072 ], [ -96.462711147837283, 33.805327053353935 ], [ -96.796618415091217, 33.751351019825066 ], [ -96.947952847057977, 33.918059190398651 ], [ -97.104067349011729, 33.773597723926727 ], [ -97.376583014702916, 33.838141587859269 ], [ -97.657031012750906, 33.993713487273951 ], [ -97.957090216853686, 33.893693752573043 ], [ -98.088322516658891, 34.134480088837023 ], [ -98.55397884804097, 34.110657253550471 ], [ -98.851893480203614, 34.164633287079326 ], [ -99.1874027168586, 34.235559190399925 ], [ -99.336075812562314, 34.442962551403355 ], [ -99.599083014711809, 34.376299953746837 ], [ -99.761527879621312, 34.457793687471124 ], [ -100.00019548216133, 34.565228990205938 ], [ -100.00019548216133, 35.519847723933708 ], [ -100.00019548216133, 36.499322821593879 ], [ -101.00083207884502, 36.499322821593879 ], [ -102.00149451374486, 36.499322821593879 ], [ -103.00161434610563, 36.499322821593879 ], [ -103.00321631550668, 36.995158189434406 ], [ -102.04118201374501, 36.99198008884845 ], [ -101.09979244668396, 36.993039455710431 ], [ -100.10021521686225, 36.994098822572425 ], [ -99.10006954628534, 36.995158189434406 ], [ -97.29984351274949, 36.997276923158367 ], [ -95.500160081752711, 36.998853054343272 ], [ -94.622797614301277, 36.999912421205252 ], [ -94.61750077999136, 36.999912421205252 ], [ -94.628611212934118, 36.540586452778939 ] ] ] } }, 25 | { "type": "Feature", "properties": { "name": "South Dakota", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "SD", "id": "USA-3534" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -96.75426957882803, 42.63396129004289 ], [ -97.028387213920269, 42.717547919275006 ], [ -97.287156948621828, 42.846144721033326 ], [ -97.644344448623258, 42.836093654952563 ], [ -97.88192684608515, 42.839788519861429 ], [ -97.96820064979643, 42.794287421228432 ], [ -98.335955980201547, 42.873662421228758 ], [ -98.59418311236405, 43.000140489263117 ], [ -100.59974544961165, 43.000140489263117 ], [ -102.09991227904473, 43.000140489263117 ], [ -104.05255794962545, 43.000140489263117 ], [ -104.07795691609692, 45.040610256523877 ], [ -104.02661638061494, 45.956600857113486 ], [ -102.11686214883646, 45.961355088884332 ], [ -100.06685807981785, 45.965566718116122 ], [ -98.44178931353531, 45.963447984392147 ], [ -96.539450649790723, 46.017966620460086 ], [ -96.556891445689217, 45.872445787126168 ], [ -96.780727912161467, 45.760798855159578 ], [ -96.834703945690336, 45.625329087906422 ], [ -96.735769416067541, 45.470816555353721 ], [ -96.560612148814243, 45.393017686538315 ], [ -96.439430915089787, 44.435763454763645 ], [ -96.452660081756505, 43.501789455736471 ], [ -96.586011115285686, 43.501246853197401 ], [ -96.587070482147681, 43.257308254563625 ], [ -96.459533047251341, 43.124499823573501 ], [ -96.483355882537893, 43.016005153976721 ], [ -96.535213182342773, 42.855679022791179 ], [ -96.615647549205079, 42.691632188480625 ], [ -96.4537194486185, 42.58050202083696 ], [ -96.455295579803391, 42.488957221031896 ], [ -96.623037279022824, 42.502728990237685 ], [ -96.708768480195033, 42.550865586917567 ], [ -96.75426957882803, 42.63396129004289 ] ] ] } }, 26 | { "type": "Feature", "properties": { "name": "Louisiana", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "LA", "id": "USA-3535" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -89.21767, 29.29108 ], [ -89.408387213889796, 29.159770819611367 ], [ -89.77928, 29.30714 ], [ -90.15463, 29.11743 ], [ -90.880225, 29.148535 ], [ -91.626785, 29.677000000000135 ], [ -92.49906, 29.5523 ], [ -93.22637, 29.783750000000111 ], [ -93.84842, 29.71363 ], [ -93.918473680379122, 29.821771755486566 ], [ -93.816877814493353, 29.968351955682351 ], [ -93.667119513711555, 30.100643622349651 ], [ -93.664484015664641, 30.300140489212254 ], [ -93.737502814492984, 30.366803086868799 ], [ -93.650195482135928, 30.605470689408889 ], [ -93.586168382526296, 30.713939520789552 ], [ -93.48984351273424, 31.079601955686883 ], [ -93.578236050169437, 31.216131089801934 ], [ -93.694120449584034, 31.443662421183035 ], [ -93.779309048217101, 31.675431220012229 ], [ -93.834861212930946, 31.829943752564816 ], [ -93.9989080472414, 31.942650051393343 ], [ -94.059757046265133, 33.012119655889819 ], [ -93.094027879594648, 33.010517686488811 ], [ -92.001303880566866, 33.043874823533145 ], [ -91.156239183297828, 33.010000922165887 ], [ -91.084796515654318, 32.952846788051033 ], [ -91.175798712920255, 32.808385321579181 ], [ -91.030820482125478, 32.602532253544439 ], [ -91.072084113310495, 32.478715521773211 ], [ -90.942970547229208, 32.30673635510567 ], [ -91.081618415068363, 32.204597886680858 ], [ -91.128178880563269, 32.015694688437918 ], [ -91.321319546254188, 31.859580186484266 ], [ -91.411288214874332, 31.650032253540701 ], [ -91.502290412140383, 31.408729152953811 ], [ -91.624531012726777, 31.297082220987079 ], [ -91.583784145864627, 31.047330023720519 ], [ -90.701667446642318, 31.015574856077194 ], [ -89.759218512719315, 31.013456122353261 ], [ -89.787795579776741, 30.847290554318647 ], [ -89.853941413110306, 30.683243720008136 ], [ -89.790456916039716, 30.556791490189937 ], [ -89.658682013695454, 30.440881252559336 ], [ -89.623231981143249, 30.275258287063821 ], [ -89.604705980166614, 30.176297919224851 ], [ -89.413735, 29.89419 ], [ -89.43, 29.48864 ], [ -89.21767, 29.29108 ] ] ] } }, 27 | { "type": "Feature", "properties": { "name": "Texas", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "TX", "id": "USA-3536" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -93.578236050169437, 31.216131089801934 ], [ -93.48984351273424, 31.079601955686883 ], [ -93.586168382526296, 30.713939520789552 ], [ -93.650195482135928, 30.605470689408889 ], [ -93.737502814492984, 30.366803086868799 ], [ -93.664484015664641, 30.300140489212254 ], [ -93.667119513711555, 30.100643622349651 ], [ -93.816877814493353, 29.968351955682351 ], [ -93.918473680379122, 29.821771755486566 ], [ -93.84842, 29.71363 ], [ -94.690002814496893, 29.479932155875701 ], [ -95.600179816453647, 28.738556220000362 ], [ -96.593943447642403, 28.307290554308565 ], [ -97.140034145886887, 27.829981187444673 ], [ -97.370226813530962, 27.380189520776185 ], [ -97.379761115288829, 26.690154120382829 ], [ -97.330022549207911, 26.210209255471909 ], [ -97.140034145886887, 25.869945787046277 ], [ -97.530036180393552, 25.839792588803959 ], [ -98.240173712948547, 26.059934190367358 ], [ -99.020177781962104, 26.370018622334726 ], [ -99.300109015687156, 26.839912421164684 ], [ -99.520224779034379, 27.539998887638831 ], [ -100.11026628294297, 28.109912421169724 ], [ -100.45580074746255, 28.696233221953378 ], [ -100.95744971393594, 29.380971788036732 ], [ -101.66229041218099, 29.779422919223236 ], [ -102.47986324747075, 29.759863389600753 ], [ -103.11010901570234, 28.969808254506461 ], [ -103.93982581258069, 29.269841620393095 ], [ -104.45682267944477, 29.571993720003775 ], [ -104.70554134806559, 30.121805121373143 ], [ -105.03732988159555, 30.644098822547051 ], [ -105.6315830147359, 31.083839423134748 ], [ -106.1427662829671, 31.399737453735042 ], [ -106.50734351278624, 31.754289455689502 ], [ -106.61953304729195, 31.914098822552091 ], [ -106.63012671591179, 31.999287421185329 ], [ -105.73000078003582, 31.999287421185329 ], [ -103.92977474649996, 31.999287421185329 ], [ -103.00161434610561, 31.999287421185329 ], [ -103.00161434610561, 33.879947821583414 ], [ -103.00161434610561, 36.499322821593978 ], [ -102.00149451374489, 36.499322821593978 ], [ -101.00083207884501, 36.499322821593978 ], [ -100.0001954821613, 36.499322821593978 ], [ -100.0001954821613, 35.519847723933651 ], [ -100.0001954821613, 34.565228990206037 ], [ -99.761527879621326, 34.457793687471167 ], [ -99.599083014711766, 34.376299953746866 ], [ -99.336075812562228, 34.442962551403411 ], [ -99.187402716858628, 34.235559190400011 ], [ -98.851893480203557, 34.164633287079425 ], [ -98.55397884804097, 34.110657253550414 ], [ -98.088322516658877, 34.134480088837108 ], [ -97.957090216853601, 33.893693752573142 ], [ -97.657031012750906, 33.993713487274078 ], [ -97.376583014702931, 33.838141587859297 ], [ -97.1040673490117, 33.773597723926855 ], [ -96.947952847057991, 33.918059190398708 ], [ -96.796618415091189, 33.751351019825051 ], [ -96.462711147837297, 33.805327053354006 ], [ -96.316130947641341, 33.756131089812186 ], [ -96.148906012744874, 33.797937323536246 ], [ -95.977469448616546, 33.87943105726049 ], [ -95.769497646857985, 33.881007188445381 ], [ -95.418123745489311, 33.870413519825547 ], [ -95.190592414108153, 33.938161322560234 ], [ -94.910144416060234, 33.8317853866875 ], [ -94.479912279014229, 33.635983384733493 ], [ -94.427538214886454, 33.570380153938913 ], [ -94.233338182333512, 33.583609320605774 ], [ -94.002086147827413, 33.57991445569678 ], [ -94.059757046265133, 33.012119655889819 ], [ -93.9989080472414, 31.942650051393343 ], [ -93.834861212930946, 31.829943752564816 ], [ -93.779309048217101, 31.675431220012229 ], [ -93.694120449584034, 31.443662421183035 ], [ -93.578236050169437, 31.216131089801934 ] ] ] } }, 28 | { "type": "Feature", "properties": { "name": "Connecticut", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "CT", "id": "USA-3537" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -72.876166347938181, 41.220559190427991 ], [ -73.647886531787208, 40.95323936094951 ], [ -73.656687181274719, 40.9850696884738 ], [ -73.692679816365967, 41.107310289060365 ], [ -73.475173712849426, 41.204668687498099 ], [ -73.553489345987771, 41.289857286131337 ], [ -73.49793718127404, 42.054513454754101 ], [ -72.732221645789139, 42.035987453777409 ], [ -71.800908983025067, 42.013249823569083 ], [ -71.792950812452148, 41.466616522785614 ], [ -71.853825649691998, 41.320036322589829 ], [ -72.295142381464473, 41.269755153969811 ], [ -72.876166347938181, 41.220559190427991 ] ] ] } }, 29 | { "type": "Feature", "properties": { "name": "Massachusetts", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "MA", "id": "USA-3513" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -69.88479855007472, 41.922764390625986 ], [ -69.965207078720866, 41.636993720051933 ], [ -70.63989457872357, 41.47506561946534 ], [ -71.120382046173404, 41.49465098730397 ], [ -71.147899746368836, 41.647587388671766 ], [ -71.305073615184568, 41.762412421224312 ], [ -71.379151780874963, 42.024360256511812 ], [ -71.800908983025096, 42.013249823569055 ], [ -72.732221645789224, 42.03598745377748 ], [ -73.497937181274068, 42.054513454754115 ], [ -73.28203304715862, 42.743489488285519 ], [ -72.457070482051151, 42.727082221032859 ], [ -71.248978847931738, 42.718090521814062 ], [ -71.145781012644861, 42.816508287113933 ], [ -70.933597581654425, 42.884256089848591 ], [ -70.815051845976882, 42.865187486332886 ], [ -70.825102912057645, 42.334961452802119 ], [ -70.494916347928722, 41.804735419271353 ], [ -70.080057949489557, 41.779879055338952 ], [ -70.184831915961325, 42.144998887697184 ], [ -69.88479855007472, 41.922764390625986 ] ] ] } }, 30 | { "type": "Feature", "properties": { "name": "New Hampshire", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "NH", "id": "USA-3538" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -71.50351111518529, 45.007795722018557 ], [ -71.505087246370238, 45.008312486341424 ], [ -71.405093349885419, 45.254912421238316 ], [ -71.08482, 45.30524 ], [ -70.944165412058055, 43.466339423184309 ], [ -70.981760016550368, 43.367895819668263 ], [ -70.797611050078274, 43.219739488287473 ], [ -70.75102474636725, 43.080032253586353 ], [ -70.645734015572486, 43.090083319667144 ], [ -70.815051845976882, 42.865187486332957 ], [ -70.933597581654396, 42.884256089848577 ], [ -71.145781012644875, 42.816508287114004 ], [ -71.248978847931767, 42.718090521814133 ], [ -72.457070482051108, 42.727082221032958 ], [ -72.537504848913386, 42.830796820642661 ], [ -72.458646613236056, 42.96045298926299 ], [ -72.434307013626551, 43.222917588873372 ], [ -72.403611212845192, 43.285368557298227 ], [ -72.369763149693938, 43.521891587898153 ], [ -72.260209113235248, 43.721388454760927 ], [ -72.17819861518808, 43.808695787117927 ], [ -72.059136115187584, 44.045761420256952 ], [ -72.03637264676297, 44.206630153981507 ], [ -72.003041347934698, 44.304014390635643 ], [ -71.809900682243892, 44.352150987315497 ], [ -71.585521613232572, 44.468035386729923 ], [ -71.546376715771373, 44.592394721040421 ], [ -71.620454881461853, 44.735796820650307 ], [ -71.50351111518529, 45.007795722018557 ] ] ] } }, 31 | { "type": "Feature", "properties": { "name": "Rhode Island", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "RI", "id": "USA-3539" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -71.147899746368836, 41.647587388671766 ], [ -71.120382046173404, 41.49465098730397 ], [ -71.85382564969197, 41.320036322589729 ], [ -71.792950812452148, 41.466616522785628 ], [ -71.800908983025096, 42.013249823569055 ], [ -71.379151780874963, 42.024360256511812 ], [ -71.305073615184568, 41.762412421224312 ], [ -71.147899746368836, 41.647587388671766 ] ] ] } }, 32 | { "type": "Feature", "properties": { "name": "Vermont", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "VT", "id": "USA-3540" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -71.503511115185347, 45.007795722018521 ], [ -71.620454881461868, 44.735796820650258 ], [ -71.546376715771459, 44.592394721040307 ], [ -71.585521613232558, 44.468035386729909 ], [ -71.809900682243864, 44.35215098731539 ], [ -72.003041347934754, 44.304014390635515 ], [ -72.036372646762999, 44.206630153981472 ], [ -72.059136115187584, 44.045761420256873 ], [ -72.178198615188052, 43.808695787117912 ], [ -72.260209113235248, 43.721388454760778 ], [ -72.369763149694023, 43.521891587898004 ], [ -72.403611212845206, 43.285368557298106 ], [ -72.434307013626579, 43.222917588873365 ], [ -72.458646613236056, 42.960452989262947 ], [ -72.537504848913443, 42.830796820642632 ], [ -72.457070482051151, 42.727082221032866 ], [ -73.28203304715862, 42.743489488285519 ], [ -73.239710049111579, 43.56793528907005 ], [ -73.383112148721523, 43.575350857103949 ], [ -73.401638149698158, 43.613436387703068 ], [ -73.33812781441145, 43.758440456714062 ], [ -73.4296726142165, 44.019845689462493 ], [ -73.329136115192654, 44.226732286143012 ], [ -73.384171515583503, 44.379151923187905 ], [ -73.407968512653909, 44.676007188488569 ], [ -73.368281012653753, 44.804603990246875 ], [ -73.347662116169289, 45.007253119479458 ], [ -71.505087246370266, 45.008312486341438 ], [ -71.503511115185347, 45.007795722018521 ] ] ] } }, 33 | { "type": "Feature", "properties": { "name": "Alabama", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "AL", "id": "USA-3541" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -85.05441524935415, 31.108695787067106 ], [ -85.005193447596127, 30.990692653928605 ], [ -87.045663214856901, 30.984879055295778 ], [ -87.617152879572728, 30.927724921180967 ], [ -87.633043382502478, 30.851528021766597 ], [ -87.404969448582307, 30.608648789994788 ], [ -87.457886115249181, 30.411270656855976 ], [ -87.530388149754685, 30.274198920201783 ], [ -88.417801683286882, 30.384812323522539 ], [ -88.44953101271409, 31.91198008882813 ], [ -88.273340216814944, 33.510047919238175 ], [ -88.095521613298601, 34.805989488253772 ], [ -88.166964280942125, 34.999672756483704 ], [ -86.90967668328085, 34.999130153944648 ], [ -85.625388149747053, 34.98590098727793 ], [ -85.365559048183513, 33.744478054330258 ], [ -85.12955278190654, 32.750714423141375 ], [ -84.986150682296582, 32.437968654910961 ], [ -84.898843349939455, 32.259116522748783 ], [ -85.063923712895843, 32.083416652956416 ], [ -85.119501715825763, 31.765399888632231 ], [ -85.065525682296908, 31.577013454712201 ], [ -85.090382046229294, 31.400280056273999 ], [ -85.117899746424712, 31.236233221963445 ], [ -85.05441524935415, 31.108695787067106 ] ] ] } }, 34 | { "type": "Feature", "properties": { "name": "Florida", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "FL", "id": "USA-3542" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -80.056539284977646, 26.88 ], [ -80.088015, 26.205765 ], [ -80.131559999999865, 25.816775000000121 ], [ -80.38103, 25.20616 ], [ -80.67979855011788, 25.079916490167989 ], [ -81.17191321483341, 25.201097723892417 ], [ -81.330120612294991, 25.639753119402087 ], [ -81.710071580720978, 25.869945787046277 ], [ -82.23978084992882, 26.729841620383013 ], [ -82.70515, 27.49504 ], [ -82.85526, 27.88624 ], [ -82.649885016597125, 28.550169786080289 ], [ -82.929999999999893, 29.100000000000136 ], [ -83.70959, 29.9365600000001 ], [ -84.099796515626394, 30.090049953729817 ], [ -85.10882, 29.6361500000001 ], [ -85.28784, 29.68612000000013 ], [ -85.7731, 30.15261 ], [ -86.400069546234533, 30.40016022391336 ], [ -87.530388149754629, 30.274198920201854 ], [ -87.457886115249096, 30.411270656856118 ], [ -87.404969448582278, 30.608648789994788 ], [ -87.633043382502478, 30.851528021766683 ], [ -87.617152879572643, 30.927724921181095 ], [ -87.045663214856859, 30.984879055295778 ], [ -85.005193447596014, 30.990692653928704 ], [ -84.853316413090226, 30.721355088823486 ], [ -83.847899746419671, 30.675311387651334 ], [ -82.226009080722918, 30.525553086869479 ], [ -82.151930915032608, 30.350938422155139 ], [ -82.022817348951321, 30.440364488236412 ], [ -82.020156012688346, 30.788017686479861 ], [ -81.899517381502903, 30.82189158784729 ], [ -81.701596645825134, 30.748330186479848 ], [ -81.490472581696565, 30.729830023719217 ], [ -81.31371, 30.035520000000133 ], [ -80.979831916004457, 29.179898789989068 ], [ -80.535585, 28.47213 ], [ -80.530040249336025, 28.04007172292728 ], [ -80.056539284977646, 26.88 ] ] ] } }, 35 | { "type": "Feature", "properties": { "name": "Georgia", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "GA", "id": "USA-3543" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -80.86500688345194, 32.033161322552587 ], [ -81.33629, 31.44049 ], [ -81.490472581696565, 30.729830023719217 ], [ -81.701596645825134, 30.748330186479848 ], [ -81.899517381502903, 30.82189158784729 ], [ -82.020156012688346, 30.788017686479861 ], [ -82.022817348951321, 30.440364488236412 ], [ -82.151930915032608, 30.350938422155139 ], [ -82.226009080722974, 30.525553086869479 ], [ -83.847899746419671, 30.675311387651334 ], [ -84.853316413090226, 30.721355088823486 ], [ -85.005193447596071, 30.990692653928704 ], [ -85.054415249354122, 31.108695787067234 ], [ -85.117899746424712, 31.23623322196346 ], [ -85.090382046229308, 31.400280056274084 ], [ -85.065525682296879, 31.577013454712187 ], [ -85.11950171582572, 31.765399888632203 ], [ -85.063923712895814, 32.08341665295643 ], [ -84.898843349939455, 32.259116522748855 ], [ -84.986150682296511, 32.43796865491106 ], [ -85.129552781906511, 32.750714423141403 ], [ -85.365559048183457, 33.74447805433033 ], [ -85.625388149746982, 34.985900987277944 ], [ -84.85437577995225, 34.976909288059176 ], [ -84.320971645835527, 34.98696035413991 ], [ -83.076370612301957, 34.979028021783108 ], [ -83.185924648760761, 34.895958156873974 ], [ -83.346250779946274, 34.706512356091935 ], [ -83.076370612301957, 34.540346788057377 ], [ -82.902815314449697, 34.479497789033701 ], [ -82.716547614253557, 34.163057155894535 ], [ -82.597485114253175, 33.98578115491722 ], [ -82.249289313470513, 33.748715521778195 ], [ -82.180507982090035, 33.624356187467924 ], [ -81.94344234895101, 33.461368720019209 ], [ -81.827015346997428, 33.223243720018388 ], [ -81.507396613272192, 33.021628119431512 ], [ -81.435953945628683, 32.793037421188387 ], [ -81.376706916006071, 32.682449856083849 ], [ -81.41109758169631, 32.608888454716407 ], [ -81.224829881500227, 32.499360256473778 ], [ -81.126412116200413, 32.312033189415729 ], [ -81.127988247385304, 32.121528021771724 ], [ -81.036443447580268, 32.084476019818396 ], [ -80.86500688345194, 32.033161322552587 ] ] ] } }, 36 | { "type": "Feature", "properties": { "name": "Mississippi", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "MS", "id": "USA-3544" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -88.166964280942125, 34.999672756483676 ], [ -88.095521613298615, 34.805989488253829 ], [ -88.273340216814915, 33.510047919238161 ], [ -88.44953101271409, 31.911980088828159 ], [ -88.417801683286882, 30.384812323522624 ], [ -89.18049, 30.31598 ], [ -89.593831178419748, 30.159994004836847 ], [ -89.623231981143249, 30.275258287063821 ], [ -89.658682013695454, 30.440881252559336 ], [ -89.790456916039716, 30.556791490189937 ], [ -89.853941413110306, 30.683243720008136 ], [ -89.787795579776741, 30.847290554318647 ], [ -89.759218512719315, 31.013456122353261 ], [ -90.701667446642318, 31.015574856077194 ], [ -91.583784145864627, 31.047330023720519 ], [ -91.624531012726777, 31.297082220987079 ], [ -91.502290412140383, 31.408729152953811 ], [ -91.411288214874332, 31.650032253540701 ], [ -91.321319546254188, 31.859580186484266 ], [ -91.128178880563269, 32.015694688437918 ], [ -91.081618415068363, 32.204597886680858 ], [ -90.942970547229208, 32.30673635510567 ], [ -91.072084113310495, 32.478715521773211 ], [ -91.030820482125478, 32.602532253544439 ], [ -91.175798712920255, 32.808385321579181 ], [ -91.084796515654318, 32.952846788051033 ], [ -91.156239183297828, 33.010000922165887 ], [ -91.108076748401743, 33.206836452765685 ], [ -91.223444383493359, 33.469326890592242 ], [ -91.200680915068745, 33.706392523731211 ], [ -90.982141282906412, 34.055105088836797 ], [ -90.876307949572663, 34.261474921194235 ], [ -90.699548712918329, 34.397461452770358 ], [ -90.584206916042888, 34.454098822562344 ], [ -90.450313279974694, 34.721860256482728 ], [ -90.446618415065814, 34.866838487277448 ], [ -90.268283047226532, 34.941459255507027 ], [ -90.249240281926973, 35.020834255507168 ], [ -89.263925747417773, 35.021351019830263 ], [ -88.166964280942125, 34.999672756483676 ] ] ] } }, 37 | { "type": "Feature", "properties": { "name": "South Carolina", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "SC", "id": "USA-3545" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -78.55411434600785, 33.861421820606893 ], [ -79.06067, 33.49395 ], [ -79.20357, 33.158390000000111 ], [ -80.301325, 32.509355 ], [ -80.86500688345194, 32.033161322552587 ], [ -81.036443447580268, 32.084476019818396 ], [ -81.127988247385304, 32.121528021771724 ], [ -81.126412116200413, 32.312033189415729 ], [ -81.224829881500227, 32.499360256473778 ], [ -81.41109758169631, 32.608888454716407 ], [ -81.376706916006071, 32.682449856083849 ], [ -81.435953945628683, 32.793037421188387 ], [ -81.507396613272192, 33.021628119431512 ], [ -81.827015346997428, 33.223243720018388 ], [ -81.94344234895101, 33.461368720019209 ], [ -82.180507982090035, 33.624356187467924 ], [ -82.249289313470513, 33.748715521778195 ], [ -82.597485114253175, 33.98578115491722 ], [ -82.716547614253557, 34.163057155894535 ], [ -82.902815314449697, 34.479497789033701 ], [ -83.076370612301957, 34.540346788057377 ], [ -83.346250779946274, 34.706512356091935 ], [ -83.185924648760761, 34.895958156873974 ], [ -83.076370612301957, 34.979028021783108 ], [ -82.976376715817196, 35.008664455702501 ], [ -82.436616380528505, 35.180101019830886 ], [ -81.514269578767085, 35.171651923150989 ], [ -81.045977749338135, 35.125608221979064 ], [ -81.038019578765102, 35.037241522759928 ], [ -80.937483079741298, 35.103387356093606 ], [ -80.780851813464665, 34.934043687473093 ], [ -80.783513149727696, 34.817642523735628 ], [ -79.672779914046089, 34.807565619438662 ], [ -78.55411434600785, 33.861421820606893 ] ] ] } }, 38 | { "type": "Feature", "properties": { "name": "Illinois", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "IL", "id": "USA-3546" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -90.640818447618685, 42.50536448828457 ], [ -89.620053880557307, 42.50536448828457 ], [ -88.576551683287505, 42.503245754560609 ], [ -87.806598680354739, 42.494254055341813 ], [ -87.806598680354739, 42.496889553388698 ], [ -87.489641282892535, 42.495313422203807 ], [ -87.039307013685004, 42.492652085940776 ], [ -87.084808112318001, 42.309562486330663 ], [ -87.130335049167144, 42.12701548925962 ], [ -87.17583614780014, 41.94390005143336 ], [ -87.221337246433137, 41.760836290039407 ], [ -87.371638149754034, 41.760836290039407 ], [ -87.520853847996818, 41.760836290039407 ], [ -87.521370612319743, 41.708436387695443 ], [ -87.526150682306735, 41.708436387695443 ], [ -87.52721004916873, 40.550083319656963 ], [ -87.52826941603071, 39.39227285415754 ], [ -87.642035081721275, 39.113943589833497 ], [ -87.559998745457918, 39.040382188466026 ], [ -87.507082078791044, 38.869462388660651 ], [ -87.515040249363992, 38.73505198826949 ], [ -87.598652716812239, 38.674202989245799 ], [ -87.671128913101597, 38.508580023750355 ], [ -87.878558112321173, 38.290557155910932 ], [ -88.018807949561321, 38.02173635512861 ], [ -88.051079881527585, 37.819603990218951 ], [ -88.044206916032778, 37.744983221989486 ], [ -88.157429979184272, 37.605818589827464 ], [ -88.071724616228195, 37.511612453759383 ], [ -88.247398647804417, 37.438593654930969 ], [ -88.473870612323566, 37.354981187482721 ], [ -88.435242479185376, 37.136441555320388 ], [ -88.566474778990596, 37.053888454734121 ], [ -88.807777879577486, 37.146492621401151 ], [ -89.073963182312937, 37.20046865493002 ], [ -89.141685146831435, 37.10362702081504 ], [ -89.10305701369326, 36.952292588848294 ], [ -89.280333014670532, 37.107347723940066 ], [ -89.388285081728256, 37.081406154929539 ], [ -89.51633928094752, 37.326920884748233 ], [ -89.479287278994235, 37.477221788069144 ], [ -89.5539080472237, 37.719041652978959 ], [ -89.654987148786617, 37.748678086898352 ], [ -89.916909145857971, 37.968277085922665 ], [ -90.030158047225612, 37.971997789047691 ], [ -90.228078782903481, 38.113281154933659 ], [ -90.369878913112387, 38.263556220038438 ], [ -90.305335049179831, 38.439256089830806 ], [ -90.212730882512801, 38.584776923164725 ], [ -90.156093512720901, 38.769442653959729 ], [ -90.346598680364906, 38.930311387684327 ], [ -90.535527716823992, 38.865767523751785 ], [ -90.649810146837467, 38.907547919259756 ], [ -90.665700649767217, 39.074772854156265 ], [ -90.749287278999333, 39.265278021800256 ], [ -90.841374681343439, 39.310779120433253 ], [ -91.0715673489876, 39.445189520824414 ], [ -91.262589280954501, 39.615049953767794 ], [ -91.428212246449959, 39.820903021802479 ], [ -91.517638312531034, 40.119877020827104 ], [ -91.43033098017392, 40.368595689447901 ], [ -91.410228848012395, 40.551142686518943 ], [ -91.154120449573867, 40.699841620438804 ], [ -91.087432013701203, 40.851718654944619 ], [ -90.956742316435054, 41.024757188473956 ], [ -90.999065314482095, 41.179812323565727 ], [ -91.123424648792479, 41.257585354164988 ], [ -91.033998582711405, 41.429564520832344 ], [ -90.690557013699618, 41.478786322590352 ], [ -90.461966315456507, 41.536457221028087 ], [ -90.395277879583844, 41.608416652994521 ], [ -90.21006954624977, 41.834914455729802 ], [ -90.156636115259971, 42.103735256512124 ], [ -90.259808112330703, 42.189983222007271 ], [ -90.416981981146435, 42.270417588869563 ], [ -90.464601813503393, 42.378369655927287 ], [ -90.582604946641879, 42.4291675888702 ], [ -90.640818447618685, 42.50536448828457 ] ] ] } }, 39 | { "type": "Feature", "properties": { "name": "Indiana", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "IN", "id": "USA-3547" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -84.806755947595349, 41.677740586914069 ], [ -84.809934048181304, 40.772860419267218 ], [ -84.817866380538106, 39.799741522778959 ], [ -84.823679979170933, 39.106528021799619 ], [ -84.881376715824814, 39.059424953765571 ], [ -84.799882982100527, 38.855173855131952 ], [ -84.843265347009549, 38.781095689441543 ], [ -85.011549648768039, 38.779493720040492 ], [ -85.167638312505645, 38.691127020821398 ], [ -85.404187181321703, 38.727119655912688 ], [ -85.42589128288428, 38.535038357083792 ], [ -85.566632046231206, 38.461993720039231 ], [ -85.698406948575467, 38.290014553371876 ], [ -85.83969031446145, 38.258801988267578 ], [ -86.059831916024834, 37.960887356104934 ], [ -86.262506883473563, 38.046618557277156 ], [ -86.325474616221214, 38.169375922186489 ], [ -86.499572516612531, 37.969879055323716 ], [ -86.61016008171714, 37.858748887680051 ], [ -86.825521613293517, 37.976235256495613 ], [ -87.055714280937678, 37.880969753565552 ], [ -87.131394416029124, 37.783611355127661 ], [ -87.439360114272546, 37.936005153956401 ], [ -87.653662278986943, 37.826476955713773 ], [ -87.911372646826521, 37.904249986313033 ], [ -87.921423712907284, 37.793662421208424 ], [ -88.051079881527585, 37.819603990218951 ], [ -88.018807949561321, 38.02173635512861 ], [ -87.878558112321173, 38.290557155910932 ], [ -87.671128913101597, 38.508580023750355 ], [ -87.598652716812239, 38.674202989245799 ], [ -87.515040249363992, 38.73505198826949 ], [ -87.507082078791044, 38.869462388660651 ], [ -87.559998745457918, 39.040382188466026 ], [ -87.642035081721275, 39.113943589833497 ], [ -87.52826941603071, 39.39227285415754 ], [ -87.52721004916873, 40.550083319656963 ], [ -87.526150682306735, 41.708436387695443 ], [ -87.521370612319743, 41.760836290039407 ], [ -87.221337246433137, 41.760836290039407 ], [ -86.918125779960562, 41.760836290039407 ], [ -86.824462246431551, 41.760836290039407 ], [ -86.824462246431551, 41.7560562200524 ], [ -85.7481455146564, 41.751301988281554 ], [ -84.807298550134419, 41.7560562200524 ], [ -84.806755947595349, 41.677740586914069 ] ] ] } }, 40 | { "type": "Feature", "properties": { "name": "Kentucky", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "KY", "id": "USA-3548" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -81.972536180331403, 37.53595205336886 ], [ -82.37258928091893, 37.238037421206201 ], [ -82.684792446610288, 37.121093654929695 ], [ -82.709132046219764, 37.040142523744478 ], [ -82.815507982092583, 36.93482595473364 ], [ -83.089083014645766, 36.815763454733158 ], [ -83.178509080726855, 36.718379218079122 ], [ -83.384362148761539, 36.656496690409611 ], [ -83.673285081705387, 36.599859320617711 ], [ -84.350091315432053, 36.567044786112376 ], [ -85.231148647792352, 36.609910386698488 ], [ -85.519012213874234, 36.59774058689375 ], [ -86.092620612314022, 36.625775051412091 ], [ -86.677882046235652, 36.63373322198504 ], [ -87.216583014662277, 36.63900421807881 ], [ -87.842048712906973, 36.610969753560468 ], [ -87.874346483089383, 36.656496690409611 ], [ -88.072783983090176, 36.654377956685636 ], [ -88.06960588250422, 36.497204087869903 ], [ -89.498355882509941, 36.5061957870887 ], [ -89.273976813498621, 36.611512356099539 ], [ -89.115226813497998, 36.694582221008716 ], [ -89.134269578797557, 36.851756089824448 ], [ -89.10305701369326, 36.952292588848294 ], [ -89.141685146831435, 37.10362702081504 ], [ -89.073963182312937, 37.20046865493002 ], [ -88.807777879577486, 37.146492621401151 ], [ -88.566474778990596, 37.053888454734121 ], [ -88.435242479185376, 37.136441555320388 ], [ -88.473870612323566, 37.354981187482721 ], [ -88.247398647804417, 37.438593654930969 ], [ -88.071724616228195, 37.511612453759383 ], [ -88.157429979184272, 37.605818589827464 ], [ -88.044206916032778, 37.744983221989486 ], [ -88.051079881527585, 37.819603990218951 ], [ -87.921423712907284, 37.793662421208424 ], [ -87.911372646826521, 37.904249986313033 ], [ -87.653662278986943, 37.826476955713773 ], [ -87.439360114272546, 37.936005153956401 ], [ -87.131394416029124, 37.783611355127661 ], [ -87.055714280937678, 37.880969753565552 ], [ -86.825521613293517, 37.976235256495613 ], [ -86.61016008171714, 37.858748887680051 ], [ -86.499572516612531, 37.969879055323716 ], [ -86.325474616221214, 38.169375922186489 ], [ -86.262506883473563, 38.046618557277156 ], [ -86.059831916024834, 37.960887356104934 ], [ -85.83969031446145, 38.258801988267578 ], [ -85.698406948575467, 38.290014553371876 ], [ -85.566632046231206, 38.461993720039231 ], [ -85.42589128288428, 38.535038357083792 ], [ -85.404187181321703, 38.727119655912688 ], [ -85.167638312505645, 38.691127020821398 ], [ -85.011549648768039, 38.779493720040492 ], [ -84.843265347009549, 38.781095689441543 ], [ -84.799882982100527, 38.855173855131952 ], [ -84.881376715824814, 39.059424953765571 ], [ -84.823679979170933, 39.106528021799619 ], [ -84.481323615237272, 39.083247789052123 ], [ -84.304590216799056, 38.986922919260081 ], [ -84.03894751660269, 38.760993557280003 ], [ -83.826738247396108, 38.690067653959417 ], [ -83.672742479166331, 38.609116522774187 ], [ -83.434617479165382, 38.637150987292529 ], [ -83.258943447589161, 38.579480088854808 ], [ -83.04464128287475, 38.634515489245643 ], [ -82.855195482092739, 38.651439520821242 ], [ -82.775277879553357, 38.51121552179724 ], [ -82.589010179357302, 38.415433254544254 ], [ -82.569967414057743, 38.320193589830325 ], [ -82.580561082677576, 38.113281154933659 ], [ -82.461498582677109, 37.957166652979922 ], [ -82.413336147781081, 37.805315456690252 ], [ -82.267298550124252, 37.675659288069937 ], [ -82.16727881542333, 37.554478054345495 ], [ -81.972536180331403, 37.53595205336886 ] ] ] } }, 41 | { "type": "Feature", "properties": { "name": "North Carolina", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "NC", "id": "USA-3549" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -75.868076748340798, 36.551180121398829 ], [ -75.727310146777768, 35.550517686499006 ], [ -76.363369513642226, 34.808624986300629 ], [ -77.397635, 34.51201 ], [ -78.05496, 33.92547 ], [ -78.55411434600785, 33.861421820606893 ], [ -79.672779914046089, 34.807565619438662 ], [ -80.783513149727696, 34.817642523735628 ], [ -80.780851813464665, 34.934043687473093 ], [ -80.937483079741298, 35.103387356093606 ], [ -81.038019578765102, 35.037241522759928 ], [ -81.045977749338135, 35.125608221979064 ], [ -81.514269578767085, 35.171651923150989 ], [ -82.436616380528505, 35.180101019830886 ], [ -82.976376715817196, 35.008664455702501 ], [ -83.076370612301957, 34.979028021783108 ], [ -84.320971645835527, 34.98696035413991 ], [ -84.298750779950069, 35.198627020807407 ], [ -84.087084113282515, 35.261594753555187 ], [ -84.017760179362938, 35.369004218073826 ], [ -83.875960049154116, 35.490211290014258 ], [ -83.67328508170533, 35.516669623347752 ], [ -83.438338182290352, 35.56268748630373 ], [ -83.209721645831053, 35.648961290014938 ], [ -83.110787116208371, 35.737327989234075 ], [ -82.920281948564309, 35.817219753557424 ], [ -82.925578782874254, 35.8897217880629 ], [ -82.674224616206573, 36.025191555315928 ], [ -82.593247646805253, 35.937341620419886 ], [ -82.223890346998985, 36.125728054339788 ], [ -82.051394416008748, 36.10614268650113 ], [ -81.897398647778971, 36.273910223936753 ], [ -81.693664313468219, 36.317292588845703 ], [ -81.704774746411033, 36.460152085916718 ], [ -81.679375779939619, 36.585570787089011 ], [ -79.992398647771324, 36.542188422180061 ], [ -77.999548712867522, 36.537434190409272 ], [ -76.941215379529979, 36.545883287088827 ], [ -75.868076748340798, 36.551180121398829 ] ] ] } }, 42 | { "type": "Feature", "properties": { "name": "Ohio", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "OH", "id": "USA-3550" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -82.210661180332352, 38.579480088854808 ], [ -82.340834113275577, 38.440832221015711 ], [ -82.589010179357302, 38.415433254544254 ], [ -82.775277879553357, 38.51121552179724 ], [ -82.855195482092739, 38.651439520821242 ], [ -83.04464128287475, 38.634515489245643 ], [ -83.258943447589161, 38.579480088854808 ], [ -83.434617479165382, 38.637150987292529 ], [ -83.672742479166331, 38.609116522774187 ], [ -83.826738247396108, 38.690067653959417 ], [ -84.03894751660269, 38.760993557280003 ], [ -84.304590216799056, 38.986922919260081 ], [ -84.481323615237272, 39.083247789052123 ], [ -84.823679979170933, 39.106528021799619 ], [ -84.817866380538106, 39.799741522778959 ], [ -84.809934048181304, 40.772860419267218 ], [ -84.806755947595349, 41.677740586914069 ], [ -84.295055915041218, 41.685156154947961 ], [ -83.839967414062841, 41.685156154947961 ], [ -83.462677781899856, 41.694147854166744 ], [ -83.14199968131264, 41.975681057292874 ], [ -83.1218975491511, 41.949739488282347 ], [ -83.029810146806994, 41.832795722005841 ], [ -82.866305915035497, 41.752878119466459 ], [ -82.690089280920205, 41.675105088867184 ], [ -82.439277716791594, 41.675105088867184 ], [ -82.213322516595383, 41.778819688476972 ], [ -81.974138149732454, 41.888890489258671 ], [ -81.760869513663891, 41.986791490235618 ], [ -81.507396613272249, 42.103735256512124 ], [ -81.277746548167158, 42.209025987306816 ], [ -81.027968512684396, 42.247137356122082 ], [ -80.682434048164779, 42.299511420249885 ], [ -80.520505947578201, 42.324393622398432 ], [ -80.516268480130265, 42.324910386721342 ], [ -80.516268480130265, 42.324393622398432 ], [ -80.518929816393296, 40.641111355139088 ], [ -80.657551846016247, 40.590830186519099 ], [ -80.615228847969206, 40.463835354161816 ], [ -80.661789313464169, 40.233642686517669 ], [ -80.764987148751061, 39.973296820631205 ], [ -80.861828782866013, 39.757392686515757 ], [ -80.878752814441611, 39.65422068944504 ], [ -81.150751715809889, 39.426146755524854 ], [ -81.266093512685345, 39.37744171808977 ], [ -81.401046515615576, 39.349407253571428 ], [ -81.522227749340018, 39.371628119456929 ], [ -81.745004848950288, 39.199648952789573 ], [ -81.785751715812424, 39.019220689442506 ], [ -81.816964280916721, 38.921836452788469 ], [ -81.905873582674886, 38.882148952788299 ], [ -81.918560146802548, 38.993795884754903 ], [ -82.05402991405569, 39.018161322580511 ], [ -82.194796515618748, 38.801197821603083 ], [ -82.210661180332352, 38.579480088854808 ] ] ] } }, 43 | { "type": "Feature", "properties": { "name": "Tennessee", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "TN", "id": "USA-3551" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -81.679375779939605, 36.585570787089011 ], [ -81.704774746411061, 36.460152085916633 ], [ -81.693664313468304, 36.317292588845746 ], [ -81.897398647779028, 36.273910223936724 ], [ -82.051394416008804, 36.106142686501158 ], [ -82.22389034699907, 36.125728054339774 ], [ -82.593247646805239, 35.937341620419758 ], [ -82.674224616206601, 36.025191555315942 ], [ -82.925578782874283, 35.889721788062786 ], [ -82.920281948564366, 35.817219753557296 ], [ -83.110787116208343, 35.737327989234061 ], [ -83.209721645831138, 35.648961290014952 ], [ -83.43833818229038, 35.562687486303673 ], [ -83.673285081705387, 35.516669623347752 ], [ -83.875960049154116, 35.490211290014315 ], [ -84.017760179363023, 35.369004218073727 ], [ -84.087084113282572, 35.261594753555073 ], [ -84.298750779950083, 35.198627020807422 ], [ -84.320971645835584, 34.98696035413991 ], [ -84.854375779952306, 34.976909288059147 ], [ -85.625388149747053, 34.98590098727793 ], [ -86.90967668328085, 34.999130153944648 ], [ -88.166964280942125, 34.999672756483704 ], [ -89.263925747417858, 35.021351019830149 ], [ -90.249240281927001, 35.020834255507239 ], [ -90.13493201369738, 35.113955186497193 ], [ -90.147101813502132, 35.404996853165017 ], [ -89.988894416040552, 35.536229152970236 ], [ -89.950266282902376, 35.701877956681827 ], [ -89.775109015649065, 35.799236355119717 ], [ -89.673513149763252, 35.94000295668279 ], [ -89.662919481143419, 36.023072821591967 ], [ -89.585120612327998, 36.267011420225757 ], [ -89.524271613304322, 36.409354152973719 ], [ -89.498355882509941, 36.5061957870887 ], [ -88.06960588250422, 36.497204087869903 ], [ -88.072783983090176, 36.654377956685636 ], [ -87.874346483089383, 36.656496690409611 ], [ -87.842048712906973, 36.610969753560468 ], [ -87.216583014662277, 36.63900421807881 ], [ -86.677882046235652, 36.63373322198504 ], [ -86.092620612314022, 36.625775051412091 ], [ -85.519012213874234, 36.59774058689375 ], [ -85.231148647792352, 36.609910386698488 ], [ -84.350091315432053, 36.567044786112376 ], [ -83.673285081705387, 36.599859320617711 ], [ -82.186321580722876, 36.565985419250396 ], [ -81.679375779939605, 36.585570787089011 ] ] ] } }, 44 | { "type": "Feature", "properties": { "name": "Virginia", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "VA", "id": "USA-3552" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -75.377538681030273, 38.015382766723633 ], [ -75.940034866333008, 37.216875076293945 ], [ -76.031063079833984, 37.256563186645508 ], [ -75.722049713134766, 37.937051773071289 ], [ -75.60984992980957, 38.000032424926758 ], [ -75.377538681030273, 38.015382766723633 ] ] ], [ [ [ -78.345624923706055, 39.40550422668457 ], [ -77.834983825683594, 39.134561538696289 ], [ -77.722795486450195, 39.322431564331055 ], [ -77.576215744018555, 39.28856086730957 ], [ -77.44340705871582, 39.213422775268555 ], [ -77.5169677734375, 39.105985641479492 ], [ -77.305818557739258, 39.045679092407227 ], [ -77.119550704956055, 38.93400764465332 ], [ -77.036479949951172, 38.848276138305664 ], [ -77.041234970092773, 38.789545059204102 ], [ -77.05921745300293, 38.708593368530273 ], [ -77.229621887207031, 38.614416122436523 ], [ -77.343387603759766, 38.391611099243164 ], [ -77.210578918457031, 38.337118148803711 ], [ -77.048107147216797, 38.380502700805664 ], [ -76.989894866943359, 38.23973274230957 ], [ -76.301618576049805, 37.917947769165039 ], [ -76.258739471435547, 36.966402053833008 ], [ -75.971799850463867, 36.897260665893555 ], [ -75.868076324462891, 36.551179885864258 ], [ -76.941215515136719, 36.54588508605957 ], [ -77.999547958374023, 36.537435531616211 ], [ -79.992397308349609, 36.54218864440918 ], [ -81.679374694824219, 36.585573196411133 ], [ -82.186321258544922, 36.565984725952148 ], [ -83.673284530639648, 36.599859237670898 ], [ -83.384361267089844, 36.656496047973633 ], [ -83.178508758544922, 36.718381881713867 ], [ -83.089082717895508, 36.815763473510742 ], [ -82.815507888793945, 36.93482780456543 ], [ -82.709131240844727, 37.040143966674805 ], [ -82.684791564941406, 37.121095657348633 ], [ -82.372589111328125, 37.238039016723633 ], [ -81.972536087036133, 37.535951614379883 ], [ -81.928094863891602, 37.366090774536133 ], [ -81.815387725830078, 37.275606155395508 ], [ -81.663511276245117, 37.195173263549805 ], [ -81.348129272460938, 37.315835952758789 ], [ -81.228008270263672, 37.245454788208008 ], [ -80.854928970336914, 37.329065322875977 ], [ -80.833251953125, 37.418493270874023 ], [ -80.720003128051758, 37.38304328918457 ], [ -80.596185684204102, 37.456060409545898 ], [ -80.456995010375977, 37.441774368286133 ], [ -80.298244476318359, 37.51902961730957 ], [ -80.276567459106445, 37.610574722290039 ], [ -80.292974472045898, 37.728059768676758 ], [ -80.157505035400391, 37.901098251342773 ], [ -79.964363098144531, 38.031789779663086 ], [ -79.915142059326172, 38.179426193237305 ], [ -79.743679046630859, 38.357221603393555 ], [ -79.647922515869141, 38.574728012084961 ], [ -79.51508903503418, 38.497446060180664 ], [ -79.366390228271484, 38.426027297973633 ], [ -79.222988128662109, 38.464632034301758 ], [ -79.174825668334961, 38.555658340454102 ], [ -79.076408386230469, 38.680017471313477 ], [ -78.965276718139648, 38.821817398071289 ], [ -78.892801284790039, 38.780038833618164 ], [ -78.744619369506836, 38.909151077270508 ], [ -78.548843383789063, 39.039838790893555 ], [ -78.424484252929688, 39.139318466186523 ], [ -78.345624923706055, 39.40550422668457 ] ] ] ] } }, 45 | { "type": "Feature", "properties": { "name": "Wisconsin", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "WI", "id": "USA-3553" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -86.481563279958806, 45.323176988295842 ], [ -86.264599778981392, 45.226877956719932 ], [ -86.40167151563557, 45.133214423190921 ], [ -86.536081916026745, 45.041669623385857 ], [ -86.714934048188923, 44.84641022397102 ], [ -86.822343512707576, 44.591335354178327 ], [ -86.918668382499618, 44.36168528907325 ], [ -87.032434048190183, 44.091288357106023 ], [ -87.083231981133096, 43.890189520842199 ], [ -87.141962246432811, 43.657878119474077 ], [ -87.145140347018753, 43.571087551439874 ], [ -87.15519141309953, 43.326632188483174 ], [ -87.11392778191447, 43.03029368750542 ], [ -87.07953711622423, 42.782117621423694 ], [ -87.039307013685004, 42.492652085940776 ], [ -87.489641282892535, 42.495313422203807 ], [ -87.806598680354739, 42.496889553388698 ], [ -87.806598680354739, 42.494254055341813 ], [ -88.576551683287505, 42.503245754560609 ], [ -89.620053880557307, 42.50536448828457 ], [ -90.640818447618685, 42.50536448828457 ], [ -90.738176846056575, 42.65827505143622 ], [ -91.064694383492764, 42.754083156905352 ], [ -91.12923824742532, 42.91283315690599 ], [ -91.169985114287471, 43.002233384770932 ], [ -91.173163214873426, 43.212323920253539 ], [ -91.083737148792324, 43.288004055344999 ], [ -91.213910081735548, 43.446754055345622 ], [ -91.228198615264262, 43.501246853197401 ], [ -91.254656948597699, 43.613978990242131 ], [ -91.257292446644584, 43.854739488289965 ], [ -91.289590216827008, 43.937292588876232 ], [ -91.627709113312733, 44.085448920257036 ], [ -91.879605882519471, 44.257428086924392 ], [ -91.949989183301, 44.364837551443046 ], [ -92.062152879590514, 44.432585354177689 ], [ -92.385492316440775, 44.574928086925667 ], [ -92.505071580764167, 44.583919786144449 ], [ -92.796655849971046, 44.776026923189491 ], [ -92.766476813512611, 44.996142686536714 ], [ -92.765417446650616, 45.267082221043012 ], [ -92.68922054723626, 45.518436387710679 ], [ -92.899827847041792, 45.705763454768729 ], [ -92.75696834997089, 45.889912421240822 ], [ -92.543699713902328, 45.985694688493808 ], [ -92.296583014682597, 46.096282253598417 ], [ -92.264827847039243, 46.095222886736437 ], [ -92.274878913120006, 46.656144721048577 ], [ -92.011897549186671, 46.711722723978482 ], [ -91.964794481152623, 46.729706122416047 ], [ -91.840977749381295, 46.778385321635 ], [ -91.716618415070911, 46.827607123393008 ], [ -91.592259080760499, 46.8762604843958 ], [ -91.468442348989186, 46.924965521830899 ], [ -91.264708014678462, 47.021264553406795 ], [ -91.060973680367766, 47.117046820659795 ], [ -90.857781948596113, 47.21282908791278 ], [ -90.654047614285403, 47.309128119488676 ], [ -90.479949713894086, 47.303857123394906 ], [ -90.305851813502755, 47.298017686545933 ], [ -90.131753913111439, 47.292746690452162 ], [ -89.957656012720122, 47.286907253603175 ], [ -90.014810146834918, 47.199599921246062 ], [ -90.071447516626819, 47.111749986349878 ], [ -90.128059048202573, 47.023900051453694 ], [ -90.185213182317383, 46.936075954773642 ], [ -90.241824713893124, 46.848226019877458 ], [ -90.298978848007948, 46.760918687520345 ], [ -90.355590379583688, 46.673068752624161 ], [ -90.395277879583844, 46.611677151061414 ], [ -90.410625779974538, 46.584185289082143 ], [ -90.396879848984895, 46.576252956725341 ], [ -90.334971483099224, 46.596871853209791 ], [ -90.333912116237244, 46.593693752623835 ], [ -90.176738247421511, 46.560879218118501 ], [ -90.096303880559219, 46.380993557310489 ], [ -89.221060146831746, 46.202115586932166 ], [ -88.644273647806017, 46.022204087908008 ], [ -88.361706916034052, 46.020627956723118 ], [ -88.166964280942125, 46.007915554379309 ], [ -88.111928880551275, 45.843351955745845 ], [ -87.875405849951363, 45.779841620459123 ], [ -87.787013312516123, 45.639617621435136 ], [ -87.847888149755946, 45.559183254572829 ], [ -87.893389248388942, 45.39671255144718 ], [ -87.673247646825558, 45.387746690444544 ], [ -87.747325812515953, 45.226877956719932 ], [ -87.613974778986773, 45.108874823581445 ], [ -87.612915412124806, 45.11045095476635 ], [ -87.459462246434072, 45.068127956719295 ], [ -87.419774746433916, 45.18401235613382 ], [ -87.244617479180619, 45.289845689467583 ], [ -87.115503913099374, 45.452290554377086 ], [ -86.942465379570024, 45.452290554377086 ], [ -86.774206916027694, 45.452290554377086 ], [ -86.481563279958806, 45.323176988295842 ] ] ] } }, 46 | { "type": "Feature", "properties": { "name": "West Virginia", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "WV", "id": "USA-3554" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -77.722795579728455, 39.322432155915067 ], [ -77.834985114234115, 39.134562486317961 ], [ -78.345625779926266, 39.405502020824258 ], [ -78.424484015603667, 39.139316718088807 ], [ -78.548843349914051, 39.039839585926956 ], [ -78.744619513651827, 38.909149888660806 ], [ -78.892801683248763, 38.780036322579562 ], [ -78.965277879538121, 38.821816718087547 ], [ -79.076408047181786, 38.68001658787864 ], [ -79.174825812481672, 38.555657253568242 ], [ -79.222988247377685, 38.464629218086117 ], [ -79.366390346987643, 38.426026923164088 ], [ -79.515089280907517, 38.497443752591451 ], [ -79.647923550113774, 38.574725857083948 ], [ -79.743679979150613, 38.357219753567449 ], [ -79.915142381495045, 38.179426988267267 ], [ -79.964364183253053, 38.031787421209387 ], [ -80.15750484894393, 37.901097723943238 ], [ -80.292974616197085, 37.728059190413902 ], [ -80.276567348944411, 37.610572821598325 ], [ -80.298245612290856, 37.519028021793275 ], [ -80.456995612291479, 37.441771755516925 ], [ -80.596186082669647, 37.456060289045624 ], [ -80.720002814440974, 37.383041490217209 ], [ -80.833251715808615, 37.418491522769429 ], [ -80.85492997915506, 37.32906545668834 ], [ -81.22800798208624, 37.245452989240093 ], [ -81.348129848948702, 37.315836290021622 ], [ -81.663511115226001, 37.195171820620104 ], [ -81.815388149731817, 37.275606187482396 ], [ -81.928094448560387, 37.366091620425465 ], [ -81.972536180331403, 37.53595205336886 ], [ -82.16727881542333, 37.554478054345495 ], [ -82.267298550124252, 37.675659288069937 ], [ -82.413336147781081, 37.805315456690252 ], [ -82.461498582677109, 37.957166652979922 ], [ -82.580561082677576, 38.113281154933659 ], [ -82.569967414057743, 38.320193589830325 ], [ -82.589010179357302, 38.415433254544254 ], [ -82.340834113275577, 38.440832221015711 ], [ -82.210661180332352, 38.579480088854808 ], [ -82.194796515618748, 38.801197821603083 ], [ -82.05402991405569, 39.018161322580511 ], [ -81.918560146802548, 38.993795884754903 ], [ -81.905873582674886, 38.882148952788299 ], [ -81.816964280916721, 38.921836452788469 ], [ -81.785751715812424, 39.019220689442506 ], [ -81.745004848950288, 39.199648952789573 ], [ -81.522227749340018, 39.371628119456929 ], [ -81.401046515615576, 39.349407253571428 ], [ -81.266093512685345, 39.37744171808977 ], [ -81.150751715809889, 39.426146755524854 ], [ -80.878752814441611, 39.65422068944504 ], [ -80.861828782866013, 39.757392686515757 ], [ -80.764987148751061, 39.973296820631205 ], [ -80.661789313464169, 40.233642686517669 ], [ -80.615228847969206, 40.463835354161816 ], [ -80.657551846016247, 40.590830186519099 ], [ -80.518929816393296, 40.641111355139088 ], [ -80.518929816393296, 39.720883287101557 ], [ -79.477520514631323, 39.720883287101557 ], [ -79.485995449527181, 39.213420721995362 ], [ -79.332516445620314, 39.302846788076451 ], [ -79.161079881492029, 39.418214423168052 ], [ -78.96315914581416, 39.457901923168208 ], [ -78.829291347962055, 39.562650051423844 ], [ -78.534012213846296, 39.522445787100764 ], [ -78.425000779926592, 39.596523952791159 ], [ -78.232402716774772, 39.672204087882605 ], [ -77.923351813453223, 39.592829087882293 ], [ -77.801653815405871, 39.44994375259526 ], [ -77.722795579728455, 39.322432155915067 ] ] ] } }, 47 | { "type": "Feature", "properties": { "name": "Delaware", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "DE", "id": "USA-3555" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -75.319867316372495, 38.959947821603691 ], [ -75.071834764789855, 38.782032230179311 ], [ -75.048385179327113, 38.448764553372541 ], [ -75.714623582650063, 38.449307155911583 ], [ -75.78764238147852, 39.72354462336466 ], [ -75.710902879525008, 39.802377020825929 ], [ -75.620960049121038, 39.847361355135945 ], [ -75.405572679328486, 39.795504055331094 ], [ -75.554271613248375, 39.691246853182292 ], [ -75.527813279914994, 39.498648790030359 ], [ -75.319867316372495, 38.959947821603691 ] ] ] } }, 48 | { "type": "Feature", "properties": { "name": "District of Columbia", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "DC", "id": "USA-3556" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -76.911578945610643, 38.878454087879433 ], [ -77.041235114230943, 38.789544786121269 ], [ -77.036480882460097, 38.848275051420984 ], [ -77.119550747369289, 38.934006252593193 ], [ -77.038599616184058, 38.982168687489221 ], [ -76.911578945610643, 38.878454087879433 ] ] ] } }, 49 | { "type": "Feature", "properties": { "name": "Maryland", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "MD", "id": "USA-3557" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -75.048385179327113, 38.448764553372541 ], [ -75.05673, 38.404120000000148 ], [ -75.377538214810158, 38.015380153956812 ], [ -75.609849616178337, 38.000032253566019 ], [ -75.72205, 37.937050000000113 ], [ -76.23287, 38.319215 ], [ -76.35, 39.15 ], [ -76.542725, 38.717615000000137 ], [ -76.32933, 38.08326 ], [ -76.989894578748931, 38.239733384751901 ], [ -77.048108079725694, 38.380499986314931 ], [ -77.210578782851428, 38.33711762140598 ], [ -77.343387213841538, 38.391610419257688 ], [ -77.229621548150988, 38.614413357084231 ], [ -77.059218512668508, 38.708593654936067 ], [ -77.041235114230915, 38.789544786121269 ], [ -76.911578945610586, 38.878454087879447 ], [ -77.038599616184001, 38.98216868748915 ], [ -77.11955074736926, 38.934006252593292 ], [ -77.305818447565287, 39.045679022776028 ], [ -77.516968349909916, 39.105985419260605 ], [ -77.443406948542474, 39.213420721995476 ], [ -77.576215379532528, 39.288558254547752 ], [ -77.72279557972837, 39.32243215591518 ], [ -77.801653815405814, 39.449943752595232 ], [ -77.923351813453223, 39.592829087882365 ], [ -78.2324027167748, 39.672204087882733 ], [ -78.425000779926506, 39.596523952791188 ], [ -78.534012213846268, 39.522445787100878 ], [ -78.829291347961998, 39.56265005142393 ], [ -78.963159145814188, 39.457901923168265 ], [ -79.161079881492014, 39.418214423168081 ], [ -79.332516445620172, 39.302846788076579 ], [ -79.485995449527195, 39.213420721995476 ], [ -79.477520514631351, 39.720883287101685 ], [ -78.549902716775989, 39.719823920239719 ], [ -78.232919481097667, 39.721400051424553 ], [ -77.523298712865596, 39.725663357088592 ], [ -76.668182949515881, 39.720883287101685 ], [ -75.78764238147852, 39.72354462336466 ], [ -75.714623582650006, 38.449307155911583 ], [ -75.048385179327113, 38.448764553372541 ] ] ] } }, 50 | { "type": "Feature", "properties": { "name": "New Jersey", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "NJ", "id": "USA-3558" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -73.912795579713247, 40.960187486325367 ], [ -73.952325, 40.75075 ], [ -74.256753913047874, 40.473369655919726 ], [ -73.96244, 40.42763 ], [ -74.178438279909528, 39.70925608983589 ], [ -74.906042446579136, 38.939303086903124 ], [ -74.980663214808601, 39.196496690419849 ], [ -75.2002622138329, 39.2483539902247 ], [ -75.527813279914994, 39.498648790030359 ], [ -75.554271613248375, 39.691246853182292 ], [ -75.405572679328486, 39.795504055331094 ], [ -75.200804816371999, 39.887048855136072 ], [ -75.128819546189447, 39.949499823560814 ], [ -74.891753913050479, 40.081791490228113 ], [ -74.763182949508234, 40.190777085931643 ], [ -75.078021613246449, 40.449546820633259 ], [ -75.095488247361118, 40.555380153966894 ], [ -75.20395707874178, 40.586618557287352 ], [ -75.199202846970934, 40.747461452795733 ], [ -75.082259080694485, 40.869702053382298 ], [ -75.135718349900401, 40.999874986325494 ], [ -74.975908983037755, 41.087724921221536 ], [ -74.801268480107353, 41.311561387693928 ], [ -74.679027879520959, 41.35548635514192 ], [ -73.912795579713247, 40.960187486325367 ] ] ] } }, 51 | { "type": "Feature", "properties": { "name": "New York", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "NY", "id": "USA-3559" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -74.679027879520959, 41.35548635514192 ], [ -74.840439215784613, 41.426386420246331 ], [ -75.010816413050975, 41.495710354166079 ], [ -75.075386115199535, 41.641231187499898 ], [ -75.048927781866212, 41.751301988281625 ], [ -75.167990281866594, 41.841787421224637 ], [ -75.38547054716696, 41.998961290040427 ], [ -76.743837246391138, 42.000537421225317 ], [ -78.200647549131361, 42.000020656902393 ], [ -79.760087246403259, 42.000020656902393 ], [ -79.760087246403259, 42.500067653974668 ], [ -79.77325657258632, 42.546893739506629 ], [ -78.939362148743669, 42.863611355148123 ], [ -78.919776780905124, 42.965207221033893 ], [ -79.009999999999877, 43.27 ], [ -79.171673550111848, 43.466339423184309 ], [ -79.002329881491391, 43.527188422207985 ], [ -78.845698615214644, 43.583283189460872 ], [ -78.720279914042351, 43.625089423184988 ], [ -76.82003414580555, 43.628784288093755 ], [ -76.696760016573307, 43.784898790047578 ], [ -76.586146613252538, 43.924063422209599 ], [ -76.5, 44.018458893758634 ], [ -76.374999999999886, 44.09631 ], [ -75.31826534697143, 44.816231187512585 ], [ -74.86689754911805, 45.000380153984793 ], [ -73.347662116169317, 45.007253119479458 ], [ -73.368281012653711, 44.80460399024696 ], [ -73.407968512653895, 44.676007188488597 ], [ -73.384171515583489, 44.379151923187919 ], [ -73.329136115192625, 44.226732286143033 ], [ -73.429672614216429, 44.0198456894625 ], [ -73.33812781441145, 43.758440456714084 ], [ -73.401638149698101, 43.613436387703189 ], [ -73.383112148721523, 43.57535085710407 ], [ -73.239710049111522, 43.567935289070135 ], [ -73.28203304715862, 42.743489488285491 ], [ -73.49793718127404, 42.054513454754101 ], [ -73.553489345987771, 41.289857286131337 ], [ -73.475173712849426, 41.204668687498099 ], [ -73.692679816365967, 41.107310289060365 ], [ -73.656687181274719, 40.9850696884738 ], [ -73.647886531787208, 40.954769276919933 ], [ -73.71, 40.931102351654488 ], [ -72.241166347935689, 41.119480088865089 ], [ -71.944827846957935, 40.93003428808305 ], [ -73.345000779906286, 40.630000922196473 ], [ -73.982119513632767, 40.62788218847237 ], [ -73.952325, 40.75075 ], [ -73.912795579713247, 40.960187486325367 ], [ -74.679027879520959, 41.35548635514192 ] ] ] } }, 52 | { "type": "Feature", "properties": { "name": "Pennsylvania", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "PA", "id": "USA-3560" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -74.891753913050479, 40.081791490228113 ], [ -75.128819546189447, 39.949499823560814 ], [ -75.200804816371999, 39.887048855136072 ], [ -75.405572679328486, 39.795504055331094 ], [ -75.620960049121038, 39.847361355135945 ], [ -75.710902879525008, 39.802377020825929 ], [ -75.78764238147852, 39.72354462336466 ], [ -76.668182949515881, 39.720883287101685 ], [ -77.523298712865596, 39.725663357088592 ], [ -78.232919481097667, 39.721400051424553 ], [ -78.549902716775989, 39.719823920239719 ], [ -79.477520514631351, 39.720883287101685 ], [ -80.518929816393268, 39.720883287101685 ], [ -80.518929816393268, 40.641111355139174 ], [ -80.516268480130293, 42.324393622398418 ], [ -80.516268480130293, 42.324910386721456 ], [ -80.247447679347943, 42.366199856122478 ], [ -79.772637598377287, 42.546274765297653 ], [ -79.760087246403259, 42.500067653974668 ], [ -79.760087246403259, 42.000020656902393 ], [ -78.200647549131361, 42.000020656902393 ], [ -76.743837246391138, 42.000537421225317 ], [ -75.38547054716696, 41.998961290040427 ], [ -75.167990281866594, 41.841787421224637 ], [ -75.048927781866212, 41.751301988281625 ], [ -75.075386115199535, 41.641231187499898 ], [ -75.010816413050975, 41.495710354166079 ], [ -74.840439215784613, 41.426386420246331 ], [ -74.679027879520959, 41.35548635514192 ], [ -74.801268480107353, 41.311561387693928 ], [ -74.975908983037755, 41.087724921221536 ], [ -75.135718349900401, 40.999874986325494 ], [ -75.082259080694485, 40.869702053382298 ], [ -75.199202846970934, 40.747461452795733 ], [ -75.20395707874178, 40.586618557287352 ], [ -75.095488247361061, 40.555380153966894 ], [ -75.078021613246449, 40.449546820633259 ], [ -74.763182949508234, 40.190777085931643 ], [ -74.891753913050479, 40.081791490228113 ] ] ] } }, 53 | { "type": "Feature", "properties": { "name": "Maine", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "ME", "id": "USA-3561" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -67.137343512628775, 45.137451890638886 ], [ -66.96466, 44.8097 ], [ -68.03252, 44.3252 ], [ -69.06, 43.98 ], [ -70.11617, 43.68405 ], [ -70.645734015572486, 43.090083319667144 ], [ -70.75102474636725, 43.080032253586353 ], [ -70.797611050078274, 43.219739488287473 ], [ -70.981760016550368, 43.367895819668263 ], [ -70.944165412058055, 43.466339423184309 ], [ -71.08482, 45.305240000000197 ], [ -70.6600225491012, 45.460222886733959 ], [ -70.304953782823759, 45.914794623389355 ], [ -70.000140346950161, 46.693170884785673 ], [ -69.237086147728348, 47.447775987327873 ], [ -68.904780849875465, 47.184794623394396 ], [ -68.234304979104536, 47.354629218121772 ], [ -67.790352749285091, 47.066248887716995 ], [ -67.791412116147058, 45.702585354182816 ], [ -67.137343512628775, 45.137451890638886 ] ] ] } }, 54 | { "type": "Feature", "properties": { "name": "Michigan", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "MI", "id": "USA-3562" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -90.395277879583773, 46.611677151061429 ], [ -90.355590379583703, 46.673068752624147 ], [ -90.298978848007891, 46.760918687520359 ], [ -90.241824713893152, 46.848226019877529 ], [ -90.185213182317341, 46.936075954773571 ], [ -90.128059048202545, 47.023900051453666 ], [ -90.07144751662679, 47.111749986349878 ], [ -90.014810146834861, 47.19959992124609 ], [ -89.957656012720122, 47.28690725360326 ], [ -89.842830980167548, 47.464725857119504 ], [ -89.728005947615031, 47.641976019880644 ], [ -89.613697679385382, 47.819252020857959 ], [ -89.522695482119275, 47.960535386743913 ], [ -89.488884557221013, 48.015263217835752 ], [ -89.272917446636654, 48.019808254582699 ], [ -89.185610114279484, 48.047325954778159 ], [ -88.378114183286698, 48.30291758889382 ], [ -87.494395514663381, 47.96159475360588 ], [ -87.208108079766419, 47.848371690454428 ], [ -86.92184648308546, 47.735122789086859 ], [ -86.672068447602783, 47.636162421247889 ], [ -86.495335049164623, 47.566838487328312 ], [ -86.428646613291846, 47.539837551455776 ], [ -86.234446580739075, 47.45994578713254 ], [ -86.040246548186246, 47.380054022809304 ], [ -85.846563279956285, 47.300136420269951 ], [ -85.6523632474034, 47.22021881773054 ], [ -85.458163214850458, 47.139810289084437 ], [ -85.263963182297687, 47.059892686545027 ], [ -85.070279914067783, 46.980000922221791 ], [ -84.876079881514841, 46.900083319682381 ], [ -84.826858079756903, 46.766732286153285 ], [ -84.779238247399917, 46.637101955749131 ], [ -84.543748745445839, 46.53868419044926 ], [ -84.543231981122972, 46.53868419044926 ], [ -84.6049, 46.4396 ], [ -84.3367, 46.408770000000118 ], [ -84.142119513673379, 46.512225857115766 ], [ -84.128373582683707, 46.483648790058339 ], [ -84.115144416017074, 46.370916653013637 ], [ -84.091851264161448, 46.27541860613826 ], [ -83.890765347005754, 46.116926988299156 ], [ -83.763227912109414, 46.108968817726122 ], [ -83.669047614257408, 46.122740586931855 ], [ -83.616130947590591, 46.116926988299156 ], [ -83.469550747394692, 45.994686387712591 ], [ -83.592850714843053, 45.816893622412408 ], [ -83.397048712889159, 45.72904368751631 ], [ -83.179051683265811, 45.632718817724196 ], [ -82.919222581702343, 45.517919623387911 ], [ -82.76047258170172, 45.447510484390193 ], [ -82.550924648758155, 45.347516587905318 ], [ -82.51547461620595, 45.204114488295431 ], [ -82.485295579747458, 45.083992621432969 ], [ -82.446667446609354, 44.915708319674422 ], [ -82.407522549148212, 44.743729153007109 ], [ -82.368351813471008, 44.572809353201762 ], [ -82.326545579746892, 44.391295884776582 ], [ -82.281044481113838, 44.192341620452908 ], [ -82.240840216790787, 44.015608222014635 ], [ -82.196372646803582, 43.822441718107655 ], [ -82.137642381503952, 43.571087551439803 ], [ -82.190559048170769, 43.474271755541167 ], [ -82.417031012689961, 43.017607123377843 ], [ -82.429743415033727, 42.980038357101591 ], [ -82.900179816402783, 42.430226955732223 ], [ -83.119778815427082, 42.079912421225629 ], [ -83.128770514645907, 42.068801988282928 ], [ -83.141999681312655, 41.975681057292832 ], [ -83.462677781899856, 41.694147854166715 ], [ -83.839967414062755, 41.685156154947947 ], [ -84.295055915041189, 41.685156154947947 ], [ -84.806755947595263, 41.677740586914183 ], [ -84.807298550134362, 41.756056220052528 ], [ -85.748145514656358, 41.751301988281625 ], [ -86.824462246431551, 41.756056220052528 ], [ -86.824462246431551, 41.760836290039492 ], [ -86.918125779960576, 41.760836290039492 ], [ -87.221337246433052, 41.760836290039492 ], [ -87.175836147800169, 41.943900051433502 ], [ -87.130335049167115, 42.127015489259747 ], [ -87.084808112317944, 42.309562486330719 ], [ -87.039307013685004, 42.492652085940904 ], [ -87.07953711622423, 42.782117621423708 ], [ -87.11392778191447, 43.030293687505434 ], [ -87.155191413099487, 43.326632188483245 ], [ -87.145140347018753, 43.571087551439803 ], [ -87.14196224643274, 43.657878119474105 ], [ -87.08323198113311, 43.890189520842341 ], [ -87.032434048190112, 44.091288357106009 ], [ -86.918668382499561, 44.361685289073364 ], [ -86.822343512707505, 44.591335354178455 ], [ -86.714934048188923, 44.846410223971077 ], [ -86.536081916026717, 45.041669623385985 ], [ -86.401671515635542, 45.133214423191021 ], [ -86.264599778981392, 45.226877956719932 ], [ -86.481563279958777, 45.323176988295927 ], [ -86.774206916027708, 45.452290554377157 ], [ -86.942465379569967, 45.452290554377157 ], [ -87.115503913099246, 45.452290554377157 ], [ -87.244617479180647, 45.289845689467711 ], [ -87.419774746433859, 45.184012356133906 ], [ -87.459462246434043, 45.068127956719309 ], [ -87.612915412124778, 45.110450954766463 ], [ -87.613974778986744, 45.108874823581402 ], [ -87.747325812515953, 45.226877956719932 ], [ -87.67324764682553, 45.387746690444544 ], [ -87.893389248388928, 45.396712551447308 ], [ -87.847888149755931, 45.559183254572929 ], [ -87.787013312516024, 45.639617621435264 ], [ -87.875405849951335, 45.779841620459194 ], [ -88.111928880551261, 45.843351955745902 ], [ -88.166964280942125, 46.007915554379451 ], [ -88.361706916034052, 46.020627956723217 ], [ -88.644273647806017, 46.022204087908051 ], [ -89.221060146831633, 46.202115586932223 ], [ -90.096303880559219, 46.380993557310546 ], [ -90.17673824742144, 46.560879218118544 ], [ -90.333912116237229, 46.593693752623835 ], [ -90.334971483099196, 46.596871853209905 ], [ -90.396879848984895, 46.576252956725284 ], [ -90.410625779974566, 46.584185289082143 ], [ -90.395277879583773, 46.611677151061429 ] ] ] } }, 55 | { "type": "Feature", "properties": { "name": "Alaska", "country": "United States of America", "ISO3166-1-Alpha-3": "USA", "state_code": "AK", "id": "USA-3563" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -153.22872941792107, 57.968968410872435 ], [ -152.56479061583511, 57.901427313867089 ], [ -152.14114722390633, 57.591058661522027 ], [ -153.00631405333689, 57.115842190166006 ], [ -154.0050902984581, 56.734676825581062 ], [ -154.51640275777007, 56.992748928446815 ], [ -154.67099280497115, 57.461195787172528 ], [ -153.76277950744145, 57.81657461204378 ], [ -153.22872941792107, 57.968968410872435 ] ] ], [ [ [ -166.46779212142462, 60.384169826897732 ], [ -165.67442969466367, 60.293606879306253 ], [ -165.57916419173358, 59.909986884187674 ], [ -166.19277014876727, 59.754440822988897 ], [ -166.848337368822, 59.94140615502107 ], [ -167.45527706609005, 60.213069159579391 ], [ -166.46779212142462, 60.384169826897732 ] ] ], [ [ [ -171.73165686753939, 63.782515367276005 ], [ -171.11443356024523, 63.592191067144995 ], [ -170.49111243394071, 63.694975490973547 ], [ -169.68250545965356, 63.43111562769127 ], [ -168.68943946030066, 63.297506212000599 ], [ -168.77194088445461, 63.188598130945479 ], [ -169.52943986720504, 62.976931464277982 ], [ -170.29055620021597, 63.194437567794409 ], [ -170.67138566799088, 63.375821845139001 ], [ -171.55306311753867, 63.31778921167512 ], [ -171.79111060289117, 63.405845852300502 ], [ -171.73165686753939, 63.782515367276005 ] ] ], [ [ [ -140.9859883290049, 69.711998399526237 ], [ -140.98598752156073, 69.711998399526237 ], [ -140.99249875202946, 66.000028591568707 ], [ -140.99776974812323, 60.3063967962986 ], [ -140.01299781615319, 60.276837877027617 ], [ -139.03900042031586, 60.000007229240055 ], [ -138.34087765826888, 59.56210114199871 ], [ -137.4525081107393, 58.904983628975231 ], [ -136.47972511106087, 59.463864244211834 ], [ -135.4758328991428, 59.787772121817284 ], [ -134.94498674842458, 59.270542711008034 ], [ -134.27110023312235, 58.861110337959417 ], [ -133.35554888220719, 58.410285142645193 ], [ -132.730420695661, 57.692887071353141 ], [ -131.70782161525324, 56.552103990293915 ], [ -130.00777034571519, 55.915812079484169 ], [ -129.97999426335826, 55.28499787049725 ], [ -130.53611018946725, 54.802753404349403 ], [ -131.08581823797215, 55.178906155001869 ], [ -131.96721146714231, 55.497775580459063 ], [ -132.25001074285956, 56.369996242897457 ], [ -133.53918108435641, 57.178887437562139 ], [ -134.07806292029613, 58.12306753196691 ], [ -135.03821103227915, 58.187714748763938 ], [ -136.62806230995477, 58.21220937767032 ], [ -137.80000627968599, 58.499995429103819 ], [ -139.86778704141301, 59.537761542389148 ], [ -140.825273817133, 59.727517401764885 ], [ -142.57444353556446, 60.084446519605024 ], [ -143.95888099487991, 59.999180406323433 ], [ -145.92555681682782, 60.458609727614316 ], [ -147.11437394914665, 60.884656073644635 ], [ -148.22430620012764, 60.672989406977024 ], [ -148.01806555885076, 59.978328965893638 ], [ -148.57082251686077, 59.914172675203133 ], [ -149.72785783587585, 59.705658270905587 ], [ -150.60824337461634, 59.368211168039522 ], [ -151.71639278868329, 59.155821031319988 ], [ -151.85943315326716, 59.744984035879611 ], [ -151.40971900124717, 60.725802720779427 ], [ -150.3469414947325, 61.033587551509868 ], [ -150.62111080625706, 61.284424953854455 ], [ -151.89583919981683, 60.727197984451323 ], [ -152.57832984109558, 60.061657212964292 ], [ -154.01917212625759, 59.350279446034278 ], [ -153.28751135965308, 58.86472768821983 ], [ -154.23249243875847, 58.146373602930566 ], [ -155.30749142151012, 57.727794501366361 ], [ -156.30833472392308, 57.42277435976365 ], [ -156.55609737854641, 56.979984849670643 ], [ -158.11721655986773, 56.463608099994019 ], [ -158.43332129619714, 55.994153550838575 ], [ -159.60332739971744, 55.56668610292013 ], [ -160.28971961163421, 55.643580634170405 ], [ -161.2230476552578, 55.364734605523495 ], [ -162.23776607974096, 55.024186916720112 ], [ -163.06944658104638, 54.689737046927178 ], [ -164.78556922102729, 54.404173082082195 ], [ -164.9422263255201, 54.572224839895341 ], [ -163.84833960676565, 55.03943146424615 ], [ -162.8700013906159, 55.348043117893212 ], [ -161.80417497459601, 55.894986477270436 ], [ -160.56360470278122, 56.008054511125067 ], [ -160.0705598622844, 56.418055324928787 ], [ -158.68444291891953, 57.016675116597867 ], [ -158.46109737855406, 57.216921291728909 ], [ -157.72277035218386, 57.570000515363063 ], [ -157.55027442119365, 58.328326321030261 ], [ -157.04167497457701, 58.918884589261722 ], [ -158.19473120830557, 58.615802313869835 ], [ -158.51721798402306, 58.787781480537319 ], [ -159.05860612692882, 58.424186102931685 ], [ -159.71166704001732, 58.931390285876375 ], [ -159.98128882550017, 58.572549140041644 ], [ -160.3552711659965, 59.07112335879367 ], [ -161.35500342511511, 58.670837714260756 ], [ -161.96889360252644, 58.671664537177378 ], [ -162.05498653872465, 59.26692536074745 ], [ -161.87417070213542, 59.63362132429063 ], [ -162.51805904849215, 59.989723619213919 ], [ -163.81834143782024, 59.798055731843419 ], [ -164.66221757714655, 60.267484442782688 ], [ -165.3463877024748, 60.507495632562438 ], [ -165.35083187565192, 61.073895168697504 ], [ -166.12137915755605, 61.500019029376233 ], [ -165.73445187077061, 62.074996853271841 ], [ -164.91917863671785, 62.63307648380794 ], [ -164.56250790103934, 63.14637848576308 ], [ -163.75333248599711, 63.219448961023602 ], [ -163.06722449445789, 63.059458726648018 ], [ -162.2605553863817, 63.541935736741209 ], [ -161.53444983624857, 63.455816962326764 ], [ -160.7725066803211, 63.766108100023303 ], [ -160.95833513084264, 64.222798570402801 ], [ -161.5180684072121, 64.402787584075327 ], [ -160.77777767641484, 64.788603827566419 ], [ -161.3919262359876, 64.777235012462143 ], [ -162.45305009666893, 64.559444688568078 ], [ -162.75778601789409, 64.338605455168818 ], [ -163.54639421288428, 64.559160468190498 ], [ -164.96082984114514, 64.44694509546872 ], [ -166.4252882558645, 64.68667206487072 ], [ -166.84500423893914, 65.088895575614572 ], [ -168.11056006576706, 65.669997056736747 ], [ -166.70527116602193, 66.088317776139434 ], [ -164.4747096425755, 66.576660061297503 ], [ -163.65251176659567, 66.576660061297503 ], [ -163.78860165103626, 66.077207343196505 ], [ -161.67777442121013, 66.116119696712417 ], [ -162.48971452538007, 66.735565090595117 ], [ -163.7197169667912, 67.116394558370132 ], [ -164.43099138085654, 67.616338202577822 ], [ -165.39028683170673, 68.042772121850248 ], [ -166.76444068099607, 68.358876858179713 ], [ -166.2047074046267, 68.883030910916204 ], [ -164.43081051334357, 68.915535386827742 ], [ -163.16861365461452, 69.371114813912925 ], [ -162.93056616926199, 69.858061835399269 ], [ -161.9088972646355, 70.333329983187639 ], [ -160.93479651593367, 70.447689927849581 ], [ -159.03917578838704, 70.891642157668969 ], [ -158.11972286683397, 70.824721177851075 ], [ -156.58082455139802, 71.35776357694175 ], [ -155.0677902903243, 71.147776394323728 ], [ -154.34416520894121, 70.696408596470235 ], [ -153.90000627339251, 70.889988511835725 ], [ -152.2100060699353, 70.829992173944675 ], [ -152.27000240782613, 70.600006212029882 ], [ -150.73999243874451, 70.430016588005742 ], [ -149.72000301816752, 70.530010484490447 ], [ -147.61336157935696, 70.214034939241799 ], [ -145.68998980022536, 70.120009670686784 ], [ -144.92001095907642, 69.989991767040294 ], [ -143.58944618042528, 70.152514146598321 ], [ -142.07251034871354, 69.851938178172645 ], [ -140.9859883290049, 69.711998399526237 ] ] ] ] } } 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /tests/test-package/data-8859-1.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rgieseke/pandas-datapackage-reader/56689d623b0996414f5d9fda37dfd2a3080a3b7a/tests/test-package/data-8859-1.csv -------------------------------------------------------------------------------- /tests/test-package/data.csv: -------------------------------------------------------------------------------- 1 | id,intvalue,value 2 | a,0,1.23 3 | b,,3.33 4 | c,2,NA 5 | -------------------------------------------------------------------------------- /tests/test-package/datapackage.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package", 3 | "resources": [ 4 | { 5 | "name": "data", 6 | "path": "data.csv", 7 | "format": "csv", 8 | "schema": { 9 | "fields": [ 10 | { 11 | "name": "id", 12 | "type": "string" 13 | }, 14 | { 15 | "name": "intvalue", 16 | "type": "integer" 17 | }, 18 | { 19 | "name": "value", 20 | "type": "number" 21 | } 22 | ], 23 | "missingValues": ["NA"], 24 | "primaryKey": "id" 25 | } 26 | }, 27 | { 28 | "name": "datawithoutindex", 29 | "path": "datawithints.csv", 30 | "format": "csv", 31 | "schema": { 32 | "fields": [ 33 | { 34 | "name": "intid", 35 | "type": "integer" 36 | }, 37 | { 38 | "name": "intvalue", 39 | "type": "integer" 40 | } 41 | ] 42 | } 43 | }, 44 | { 45 | "name": "datawithindex", 46 | "path": "datawithints.csv", 47 | "format": "csv", 48 | "schema": { 49 | "fields": [ 50 | { 51 | "name": "intid", 52 | "type": "integer" 53 | }, 54 | { 55 | "name": "intvalue", 56 | "type": "integer" 57 | } 58 | ], 59 | "primaryKey": "intid" 60 | } 61 | }, 62 | { 63 | "name": "datawithmixedtypes", 64 | "path": "datawithmixedtypes.csv", 65 | "format": "csv", 66 | "schema": { 67 | "fields": [ 68 | { 69 | "name": "id", 70 | "type": "integer" 71 | }, 72 | { 73 | "name": "zipcode", 74 | "type": "string" 75 | } 76 | ], 77 | "primaryKey": "id" 78 | } 79 | }, 80 | { 81 | "name": "moredata", 82 | "path": "moredata.csv", 83 | "format": "csv", 84 | "schema": { 85 | "fields": [ 86 | { 87 | "name": "id", 88 | "type": "string" 89 | }, 90 | { 91 | "name": "value", 92 | "type": "number" 93 | } 94 | ] 95 | } 96 | }, 97 | { 98 | "name": "datetimes", 99 | "path": "datetimes.csv", 100 | "format": "csv", 101 | "schema": { 102 | "fields": [ 103 | { 104 | "name": "year", 105 | "type": "year" 106 | }, 107 | { 108 | "name": "yearmonth", 109 | "type": "yearmonth" 110 | }, 111 | { 112 | "name": "datetime", 113 | "type": "datetime" 114 | }, 115 | { 116 | "name": "date", 117 | "type": "date" 118 | }, 119 | { 120 | "name": "time", 121 | "type": "time" 122 | }, 123 | { 124 | "name": "dayfirstdate", 125 | "type": "date", 126 | "format": "%d.%m.%Y" 127 | } 128 | ], 129 | "primaryKey": "year" 130 | } 131 | }, 132 | { 133 | "name": "europeandata", 134 | "path": "europeandata.csv", 135 | "format": "csv", 136 | "schema": { 137 | "fields": [ 138 | { 139 | "name": "id", 140 | "type": "integer" 141 | }, 142 | { 143 | "name": "value", 144 | "type": "number" 145 | } 146 | ], 147 | "primaryKey": "id", 148 | "decimalChar": "," 149 | } 150 | }, 151 | { 152 | "name": "datawiththousands", 153 | "path": "datawiththousands.csv", 154 | "format": "csv", 155 | "schema": { 156 | "fields": [ 157 | { 158 | "name": "id", 159 | "type": "integer" 160 | }, 161 | { 162 | "name": "value", 163 | "type": "number", 164 | "groupChar": "," 165 | } 166 | ], 167 | "primaryKey": "id" 168 | } 169 | }, 170 | { 171 | "name": "datawiththousands-field-level", 172 | "path": "datawiththousands.csv", 173 | "format": "csv", 174 | "schema": { 175 | "fields": [ 176 | { 177 | "name": "id", 178 | "type": "integer" 179 | }, 180 | { 181 | "name": "value", 182 | "type": "number", 183 | "groupChar": "," 184 | } 185 | ], 186 | "primaryKey": "id" 187 | } 188 | }, 189 | { 190 | "name": "json-only", 191 | "format": "json", 192 | "path": "only.json" 193 | }, 194 | { 195 | "name": "admin1-us", 196 | "path": "admin1-us.geojson", 197 | "format": "geojson", 198 | "mediatype": "application/json", 199 | "schema": { 200 | "fields": [ 201 | { 202 | "name": "name", 203 | "description": "Common name of the zone", 204 | "type": "string" 205 | }, 206 | { 207 | "name": "id", 208 | "description": "Code for the zone inside the country", 209 | "type": "string" 210 | }, 211 | { 212 | "name": "country", 213 | "description": "Name of the country", 214 | "type": "string" 215 | }, 216 | { 217 | "name": "ISO3166-1-Alpha-3", 218 | "description": "3 characters code for the country, according to ISO3166 standard", 219 | "type": "string" 220 | } 221 | ] 222 | } 223 | }, 224 | { 225 | "name": "data-8859-1", 226 | "path": "data-8859-1.csv", 227 | "format": "csv", 228 | "encoding": "iso-8859-1", 229 | "schema": { 230 | "fields": [ 231 | { 232 | "name": "id", 233 | "type": "integer" 234 | }, 235 | { 236 | "name": "character", 237 | "type": "string" 238 | } 239 | ], 240 | "primaryKey": "id" 241 | } 242 | } 243 | ] 244 | } 245 | -------------------------------------------------------------------------------- /tests/test-package/datawithints.csv: -------------------------------------------------------------------------------- 1 | intid,intvalue 2 | 1,0 3 | 2, 4 | 3,2 5 | -------------------------------------------------------------------------------- /tests/test-package/datawithmixedtypes.csv: -------------------------------------------------------------------------------- 1 | id,zipcode 2 | 1,12345 3 | 2,09876 4 | 3, 5 | 4,D-64711 6 | -------------------------------------------------------------------------------- /tests/test-package/datawiththousands.csv: -------------------------------------------------------------------------------- 1 | id,value 2 | 1,"1,000" 3 | 2,"2,000" 4 | 3,"3,000" 5 | -------------------------------------------------------------------------------- /tests/test-package/datetimes.csv: -------------------------------------------------------------------------------- 1 | year,yearmonth,datetime,date,time,dayfirstdate 2 | 2017,2017-01,2017-01-01 01:23:45,2017-01-01,01:23:45,13.12.2017 3 | -------------------------------------------------------------------------------- /tests/test-package/europeandata.csv: -------------------------------------------------------------------------------- 1 | id,value 2 | 1,"1,0" 3 | 2,"2,0" 4 | 3,"3,0" 5 | -------------------------------------------------------------------------------- /tests/test-package/moredata.csv: -------------------------------------------------------------------------------- 1 | id,value 2 | a,1.23 3 | b,3.33 4 | -------------------------------------------------------------------------------- /tests/test-package/only.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test" 3 | } 4 | -------------------------------------------------------------------------------- /tests/test_pandas_datapackage_reader.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pandas as pd 3 | import numpy as np 4 | import pytest 5 | import requests 6 | import sys 7 | 8 | from datetime import datetime, date, time 9 | from pandas_datapackage_reader import read_datapackage 10 | 11 | 12 | path = os.path.dirname(__file__) 13 | 14 | 15 | def test_local_package(): 16 | dp = read_datapackage(os.path.join(path, "test-package")) 17 | assert isinstance(dp, dict) 18 | assert "moredata" in dp.keys() 19 | assert "data" in dp.keys() 20 | 21 | 22 | def test_load_single_resource(): 23 | df = pd.read_csv(os.path.join(path, "test-package/moredata.csv")) 24 | moredata = read_datapackage(os.path.join(path, "test-package"), "moredata") 25 | assert df.equals(moredata) 26 | 27 | 28 | def test_load_multiple_resources(): 29 | dp = read_datapackage(os.path.join(path, "test-package"), ["data", "moredata"]) 30 | assert "data" in dp.keys() 31 | assert "moredata" in dp.keys() 32 | 33 | 34 | @pytest.mark.slow 35 | def test_remote_package(): 36 | url = ( 37 | "https://github.com/rgieseke/pandas-datapackage-reader/" 38 | "raw/main/tests/test-package/datapackage.json" 39 | ) 40 | dp = read_datapackage(url) 41 | assert isinstance(dp, dict) 42 | assert "moredata" in dp.keys() 43 | assert isinstance(dp["moredata"], pd.DataFrame) 44 | assert "data" in dp.keys() 45 | 46 | 47 | def test_not_existing_remote_package(): 48 | with pytest.raises(requests.exceptions.HTTPError): 49 | dp = read_datapackage("http://www.example.com") 50 | 51 | 52 | @pytest.mark.slow 53 | def test_github_url(): 54 | url = "https://github.com/datasets/country-codes" 55 | dp = read_datapackage(url) 56 | assert isinstance(dp, pd.DataFrame) 57 | 58 | 59 | @pytest.mark.slow 60 | def test_github_url_with_trailing_slash(): 61 | url = "https://github.com/datasets/country-codes/" 62 | dp = read_datapackage(url) 63 | assert isinstance(dp, pd.DataFrame) 64 | 65 | 66 | @pytest.mark.skipif(sys.version_info < (3, 4), reason="requires pathlib") 67 | def test_pathlib_posixpath(): 68 | from pathlib import Path 69 | 70 | path = Path(__file__).parents[0] 71 | dp = read_datapackage(path / "test-package") 72 | assert "data" in dp.keys() 73 | 74 | 75 | def test_ignore_default_missing_values(): 76 | df = read_datapackage(os.path.join(path, "test-package"), "datawithoutindex") 77 | assert pd.isna(df.iloc[1, 1]) 78 | 79 | 80 | def test_ignore_custom_missing_values(): 81 | df = read_datapackage(os.path.join(path, "test-package"), "data") 82 | assert pd.isna(df.loc["c"].value) 83 | 84 | 85 | def test_missing_integer_values(): 86 | df_wo_index = read_datapackage( 87 | os.path.join(path, "test-package"), "datawithoutindex" 88 | ) 89 | assert pd.isnull(df_wo_index.iloc[1].intvalue) 90 | assert df_wo_index["intvalue"].dtype == pd.Int64Dtype() 91 | 92 | 93 | def test_missing_integer_values_with_index(): 94 | df = read_datapackage(os.path.join(path, "test-package"), "datawithindex") 95 | assert pd.isnull(df.loc[2].intvalue) 96 | assert df["intvalue"].dtype == pd.Int64Dtype() 97 | 98 | 99 | def test_datetimes(): 100 | # Default test date/time '2017-01-01 01:23:45' 101 | df = read_datapackage(os.path.join(path, "test-package"), "datetimes") 102 | assert df["date"].iloc[0] == date(2017, 1, 1) 103 | assert df["datetime"].iloc[0] == datetime(2017, 1, 1, 1, 23, 45) 104 | assert df["time"].iloc[0] == time(1, 23, 45) 105 | assert df.reset_index()["year"].iloc[0] == 2017 106 | assert df["yearmonth"].iloc[0] == pd.Period("2017-01") 107 | assert df["yearmonth"].iloc[0] == pd.Period("2017-01") 108 | assert df["dayfirstdate"].iloc[0] == date(2017, 12, 13) 109 | 110 | def test_strings(): 111 | df = read_datapackage(os.path.join(path, "test-package"), "datawithmixedtypes") 112 | assert df["zipcode"].dtype == np.dtype(object) 113 | 114 | 115 | def test_metadata(): 116 | df = read_datapackage(os.path.join(path, "test-package"), "data") 117 | assert df._metadata["format"] == "csv" 118 | 119 | 120 | def test_geojson(): 121 | df = read_datapackage(os.path.join(path, "test-package"), "admin1-us") 122 | assert df._metadata["format"] == "geojson" 123 | assert "geometry" in df.columns 124 | 125 | 126 | def test_unsupported_format(): 127 | dp = read_datapackage(os.path.join(path, "test-package")) 128 | assert "json-only" not in dp.keys() 129 | 130 | 131 | def test_decimal_char(): 132 | df = read_datapackage(os.path.join(path, "test-package"), "europeandata") 133 | assert df['value'].dtype == float 134 | 135 | 136 | def test_group_char(): 137 | df = read_datapackage(os.path.join(path, "test-package"), "datawiththousands") 138 | assert df['value'].dtype == float 139 | 140 | 141 | def test_encoding(): 142 | df = read_datapackage(os.path.join(path, "test-package"), "data-8859-1") 143 | assert df['character'].iloc[0] == "à" 144 | 145 | -------------------------------------------------------------------------------- /versioneer.py: -------------------------------------------------------------------------------- 1 | 2 | # Version: 0.18 3 | 4 | """The Versioneer - like a rocketeer, but for versions. 5 | 6 | The Versioneer 7 | ============== 8 | 9 | * like a rocketeer, but for versions! 10 | * https://github.com/warner/python-versioneer 11 | * Brian Warner 12 | * License: Public Domain 13 | * Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, and pypy 14 | * [![Latest Version] 15 | (https://pypip.in/version/versioneer/badge.svg?style=flat) 16 | ](https://pypi.python.org/pypi/versioneer/) 17 | * [![Build Status] 18 | (https://travis-ci.org/warner/python-versioneer.png?branch=master) 19 | ](https://travis-ci.org/warner/python-versioneer) 20 | 21 | This is a tool for managing a recorded version number in distutils-based 22 | python projects. The goal is to remove the tedious and error-prone "update 23 | the embedded version string" step from your release process. Making a new 24 | release should be as easy as recording a new tag in your version-control 25 | system, and maybe making new tarballs. 26 | 27 | 28 | ## Quick Install 29 | 30 | * `pip install versioneer` to somewhere to your $PATH 31 | * add a `[versioneer]` section to your setup.cfg (see below) 32 | * run `versioneer install` in your source tree, commit the results 33 | 34 | ## Version Identifiers 35 | 36 | Source trees come from a variety of places: 37 | 38 | * a version-control system checkout (mostly used by developers) 39 | * a nightly tarball, produced by build automation 40 | * a snapshot tarball, produced by a web-based VCS browser, like github's 41 | "tarball from tag" feature 42 | * a release tarball, produced by "setup.py sdist", distributed through PyPI 43 | 44 | Within each source tree, the version identifier (either a string or a number, 45 | this tool is format-agnostic) can come from a variety of places: 46 | 47 | * ask the VCS tool itself, e.g. "git describe" (for checkouts), which knows 48 | about recent "tags" and an absolute revision-id 49 | * the name of the directory into which the tarball was unpacked 50 | * an expanded VCS keyword ($Id$, etc) 51 | * a `_version.py` created by some earlier build step 52 | 53 | For released software, the version identifier is closely related to a VCS 54 | tag. Some projects use tag names that include more than just the version 55 | string (e.g. "myproject-1.2" instead of just "1.2"), in which case the tool 56 | needs to strip the tag prefix to extract the version identifier. For 57 | unreleased software (between tags), the version identifier should provide 58 | enough information to help developers recreate the same tree, while also 59 | giving them an idea of roughly how old the tree is (after version 1.2, before 60 | version 1.3). Many VCS systems can report a description that captures this, 61 | for example `git describe --tags --dirty --always` reports things like 62 | "0.7-1-g574ab98-dirty" to indicate that the checkout is one revision past the 63 | 0.7 tag, has a unique revision id of "574ab98", and is "dirty" (it has 64 | uncommitted changes. 65 | 66 | The version identifier is used for multiple purposes: 67 | 68 | * to allow the module to self-identify its version: `myproject.__version__` 69 | * to choose a name and prefix for a 'setup.py sdist' tarball 70 | 71 | ## Theory of Operation 72 | 73 | Versioneer works by adding a special `_version.py` file into your source 74 | tree, where your `__init__.py` can import it. This `_version.py` knows how to 75 | dynamically ask the VCS tool for version information at import time. 76 | 77 | `_version.py` also contains `$Revision$` markers, and the installation 78 | process marks `_version.py` to have this marker rewritten with a tag name 79 | during the `git archive` command. As a result, generated tarballs will 80 | contain enough information to get the proper version. 81 | 82 | To allow `setup.py` to compute a version too, a `versioneer.py` is added to 83 | the top level of your source tree, next to `setup.py` and the `setup.cfg` 84 | that configures it. This overrides several distutils/setuptools commands to 85 | compute the version when invoked, and changes `setup.py build` and `setup.py 86 | sdist` to replace `_version.py` with a small static file that contains just 87 | the generated version data. 88 | 89 | ## Installation 90 | 91 | See [INSTALL.md](./INSTALL.md) for detailed installation instructions. 92 | 93 | ## Version-String Flavors 94 | 95 | Code which uses Versioneer can learn about its version string at runtime by 96 | importing `_version` from your main `__init__.py` file and running the 97 | `get_versions()` function. From the "outside" (e.g. in `setup.py`), you can 98 | import the top-level `versioneer.py` and run `get_versions()`. 99 | 100 | Both functions return a dictionary with different flavors of version 101 | information: 102 | 103 | * `['version']`: A condensed version string, rendered using the selected 104 | style. This is the most commonly used value for the project's version 105 | string. The default "pep440" style yields strings like `0.11`, 106 | `0.11+2.g1076c97`, or `0.11+2.g1076c97.dirty`. See the "Styles" section 107 | below for alternative styles. 108 | 109 | * `['full-revisionid']`: detailed revision identifier. For Git, this is the 110 | full SHA1 commit id, e.g. "1076c978a8d3cfc70f408fe5974aa6c092c949ac". 111 | 112 | * `['date']`: Date and time of the latest `HEAD` commit. For Git, it is the 113 | commit date in ISO 8601 format. This will be None if the date is not 114 | available. 115 | 116 | * `['dirty']`: a boolean, True if the tree has uncommitted changes. Note that 117 | this is only accurate if run in a VCS checkout, otherwise it is likely to 118 | be False or None 119 | 120 | * `['error']`: if the version string could not be computed, this will be set 121 | to a string describing the problem, otherwise it will be None. It may be 122 | useful to throw an exception in setup.py if this is set, to avoid e.g. 123 | creating tarballs with a version string of "unknown". 124 | 125 | Some variants are more useful than others. Including `full-revisionid` in a 126 | bug report should allow developers to reconstruct the exact code being tested 127 | (or indicate the presence of local changes that should be shared with the 128 | developers). `version` is suitable for display in an "about" box or a CLI 129 | `--version` output: it can be easily compared against release notes and lists 130 | of bugs fixed in various releases. 131 | 132 | The installer adds the following text to your `__init__.py` to place a basic 133 | version in `YOURPROJECT.__version__`: 134 | 135 | from ._version import get_versions 136 | __version__ = get_versions()['version'] 137 | del get_versions 138 | 139 | ## Styles 140 | 141 | The setup.cfg `style=` configuration controls how the VCS information is 142 | rendered into a version string. 143 | 144 | The default style, "pep440", produces a PEP440-compliant string, equal to the 145 | un-prefixed tag name for actual releases, and containing an additional "local 146 | version" section with more detail for in-between builds. For Git, this is 147 | TAG[+DISTANCE.gHEX[.dirty]] , using information from `git describe --tags 148 | --dirty --always`. For example "0.11+2.g1076c97.dirty" indicates that the 149 | tree is like the "1076c97" commit but has uncommitted changes (".dirty"), and 150 | that this commit is two revisions ("+2") beyond the "0.11" tag. For released 151 | software (exactly equal to a known tag), the identifier will only contain the 152 | stripped tag, e.g. "0.11". 153 | 154 | Other styles are available. See [details.md](details.md) in the Versioneer 155 | source tree for descriptions. 156 | 157 | ## Debugging 158 | 159 | Versioneer tries to avoid fatal errors: if something goes wrong, it will tend 160 | to return a version of "0+unknown". To investigate the problem, run `setup.py 161 | version`, which will run the version-lookup code in a verbose mode, and will 162 | display the full contents of `get_versions()` (including the `error` string, 163 | which may help identify what went wrong). 164 | 165 | ## Known Limitations 166 | 167 | Some situations are known to cause problems for Versioneer. This details the 168 | most significant ones. More can be found on Github 169 | [issues page](https://github.com/warner/python-versioneer/issues). 170 | 171 | ### Subprojects 172 | 173 | Versioneer has limited support for source trees in which `setup.py` is not in 174 | the root directory (e.g. `setup.py` and `.git/` are *not* siblings). The are 175 | two common reasons why `setup.py` might not be in the root: 176 | 177 | * Source trees which contain multiple subprojects, such as 178 | [Buildbot](https://github.com/buildbot/buildbot), which contains both 179 | "master" and "slave" subprojects, each with their own `setup.py`, 180 | `setup.cfg`, and `tox.ini`. Projects like these produce multiple PyPI 181 | distributions (and upload multiple independently-installable tarballs). 182 | * Source trees whose main purpose is to contain a C library, but which also 183 | provide bindings to Python (and perhaps other langauges) in subdirectories. 184 | 185 | Versioneer will look for `.git` in parent directories, and most operations 186 | should get the right version string. However `pip` and `setuptools` have bugs 187 | and implementation details which frequently cause `pip install .` from a 188 | subproject directory to fail to find a correct version string (so it usually 189 | defaults to `0+unknown`). 190 | 191 | `pip install --editable .` should work correctly. `setup.py install` might 192 | work too. 193 | 194 | Pip-8.1.1 is known to have this problem, but hopefully it will get fixed in 195 | some later version. 196 | 197 | [Bug #38](https://github.com/warner/python-versioneer/issues/38) is tracking 198 | this issue. The discussion in 199 | [PR #61](https://github.com/warner/python-versioneer/pull/61) describes the 200 | issue from the Versioneer side in more detail. 201 | [pip PR#3176](https://github.com/pypa/pip/pull/3176) and 202 | [pip PR#3615](https://github.com/pypa/pip/pull/3615) contain work to improve 203 | pip to let Versioneer work correctly. 204 | 205 | Versioneer-0.16 and earlier only looked for a `.git` directory next to the 206 | `setup.cfg`, so subprojects were completely unsupported with those releases. 207 | 208 | ### Editable installs with setuptools <= 18.5 209 | 210 | `setup.py develop` and `pip install --editable .` allow you to install a 211 | project into a virtualenv once, then continue editing the source code (and 212 | test) without re-installing after every change. 213 | 214 | "Entry-point scripts" (`setup(entry_points={"console_scripts": ..})`) are a 215 | convenient way to specify executable scripts that should be installed along 216 | with the python package. 217 | 218 | These both work as expected when using modern setuptools. When using 219 | setuptools-18.5 or earlier, however, certain operations will cause 220 | `pkg_resources.DistributionNotFound` errors when running the entrypoint 221 | script, which must be resolved by re-installing the package. This happens 222 | when the install happens with one version, then the egg_info data is 223 | regenerated while a different version is checked out. Many setup.py commands 224 | cause egg_info to be rebuilt (including `sdist`, `wheel`, and installing into 225 | a different virtualenv), so this can be surprising. 226 | 227 | [Bug #83](https://github.com/warner/python-versioneer/issues/83) describes 228 | this one, but upgrading to a newer version of setuptools should probably 229 | resolve it. 230 | 231 | ### Unicode version strings 232 | 233 | While Versioneer works (and is continually tested) with both Python 2 and 234 | Python 3, it is not entirely consistent with bytes-vs-unicode distinctions. 235 | Newer releases probably generate unicode version strings on py2. It's not 236 | clear that this is wrong, but it may be surprising for applications when then 237 | write these strings to a network connection or include them in bytes-oriented 238 | APIs like cryptographic checksums. 239 | 240 | [Bug #71](https://github.com/warner/python-versioneer/issues/71) investigates 241 | this question. 242 | 243 | 244 | ## Updating Versioneer 245 | 246 | To upgrade your project to a new release of Versioneer, do the following: 247 | 248 | * install the new Versioneer (`pip install -U versioneer` or equivalent) 249 | * edit `setup.cfg`, if necessary, to include any new configuration settings 250 | indicated by the release notes. See [UPGRADING](./UPGRADING.md) for details. 251 | * re-run `versioneer install` in your source tree, to replace 252 | `SRC/_version.py` 253 | * commit any changed files 254 | 255 | ## Future Directions 256 | 257 | This tool is designed to make it easily extended to other version-control 258 | systems: all VCS-specific components are in separate directories like 259 | src/git/ . The top-level `versioneer.py` script is assembled from these 260 | components by running make-versioneer.py . In the future, make-versioneer.py 261 | will take a VCS name as an argument, and will construct a version of 262 | `versioneer.py` that is specific to the given VCS. It might also take the 263 | configuration arguments that are currently provided manually during 264 | installation by editing setup.py . Alternatively, it might go the other 265 | direction and include code from all supported VCS systems, reducing the 266 | number of intermediate scripts. 267 | 268 | 269 | ## License 270 | 271 | To make Versioneer easier to embed, all its code is dedicated to the public 272 | domain. The `_version.py` that it creates is also in the public domain. 273 | Specifically, both are released under the Creative Commons "Public Domain 274 | Dedication" license (CC0-1.0), as described in 275 | https://creativecommons.org/publicdomain/zero/1.0/ . 276 | 277 | """ 278 | 279 | from __future__ import print_function 280 | try: 281 | import configparser 282 | except ImportError: 283 | import ConfigParser as configparser 284 | import errno 285 | import json 286 | import os 287 | import re 288 | import subprocess 289 | import sys 290 | 291 | 292 | class VersioneerConfig: 293 | """Container for Versioneer configuration parameters.""" 294 | 295 | 296 | def get_root(): 297 | """Get the project root directory. 298 | 299 | We require that all commands are run from the project root, i.e. the 300 | directory that contains setup.py, setup.cfg, and versioneer.py . 301 | """ 302 | root = os.path.realpath(os.path.abspath(os.getcwd())) 303 | setup_py = os.path.join(root, "setup.py") 304 | versioneer_py = os.path.join(root, "versioneer.py") 305 | if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): 306 | # allow 'python path/to/setup.py COMMAND' 307 | root = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0]))) 308 | setup_py = os.path.join(root, "setup.py") 309 | versioneer_py = os.path.join(root, "versioneer.py") 310 | if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): 311 | err = ("Versioneer was unable to run the project root directory. " 312 | "Versioneer requires setup.py to be executed from " 313 | "its immediate directory (like 'python setup.py COMMAND'), " 314 | "or in a way that lets it use sys.argv[0] to find the root " 315 | "(like 'python path/to/setup.py COMMAND').") 316 | raise VersioneerBadRootError(err) 317 | try: 318 | # Certain runtime workflows (setup.py install/develop in a setuptools 319 | # tree) execute all dependencies in a single python process, so 320 | # "versioneer" may be imported multiple times, and python's shared 321 | # module-import table will cache the first one. So we can't use 322 | # os.path.dirname(__file__), as that will find whichever 323 | # versioneer.py was first imported, even in later projects. 324 | me = os.path.realpath(os.path.abspath(__file__)) 325 | me_dir = os.path.normcase(os.path.splitext(me)[0]) 326 | vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0]) 327 | if me_dir != vsr_dir: 328 | print("Warning: build in %s is using versioneer.py from %s" 329 | % (os.path.dirname(me), versioneer_py)) 330 | except NameError: 331 | pass 332 | return root 333 | 334 | 335 | def get_config_from_root(root): 336 | """Read the project setup.cfg file to determine Versioneer config.""" 337 | # This might raise EnvironmentError (if setup.cfg is missing), or 338 | # configparser.NoSectionError (if it lacks a [versioneer] section), or 339 | # configparser.NoOptionError (if it lacks "VCS="). See the docstring at 340 | # the top of versioneer.py for instructions on writing your setup.cfg . 341 | setup_cfg = os.path.join(root, "setup.cfg") 342 | parser = configparser.SafeConfigParser() 343 | with open(setup_cfg, "r") as f: 344 | parser.readfp(f) 345 | VCS = parser.get("versioneer", "VCS") # mandatory 346 | 347 | def get(parser, name): 348 | if parser.has_option("versioneer", name): 349 | return parser.get("versioneer", name) 350 | return None 351 | cfg = VersioneerConfig() 352 | cfg.VCS = VCS 353 | cfg.style = get(parser, "style") or "" 354 | cfg.versionfile_source = get(parser, "versionfile_source") 355 | cfg.versionfile_build = get(parser, "versionfile_build") 356 | cfg.tag_prefix = get(parser, "tag_prefix") 357 | if cfg.tag_prefix in ("''", '""'): 358 | cfg.tag_prefix = "" 359 | cfg.parentdir_prefix = get(parser, "parentdir_prefix") 360 | cfg.verbose = get(parser, "verbose") 361 | return cfg 362 | 363 | 364 | class NotThisMethod(Exception): 365 | """Exception raised if a method is not valid for the current scenario.""" 366 | 367 | 368 | # these dictionaries contain VCS-specific tools 369 | LONG_VERSION_PY = {} 370 | HANDLERS = {} 371 | 372 | 373 | def register_vcs_handler(vcs, method): # decorator 374 | """Decorator to mark a method as the handler for a particular VCS.""" 375 | def decorate(f): 376 | """Store f in HANDLERS[vcs][method].""" 377 | if vcs not in HANDLERS: 378 | HANDLERS[vcs] = {} 379 | HANDLERS[vcs][method] = f 380 | return f 381 | return decorate 382 | 383 | 384 | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, 385 | env=None): 386 | """Call the given command(s).""" 387 | assert isinstance(commands, list) 388 | p = None 389 | for c in commands: 390 | try: 391 | dispcmd = str([c] + args) 392 | # remember shell=False, so use git.cmd on windows, not just git 393 | p = subprocess.Popen([c] + args, cwd=cwd, env=env, 394 | stdout=subprocess.PIPE, 395 | stderr=(subprocess.PIPE if hide_stderr 396 | else None)) 397 | break 398 | except EnvironmentError: 399 | e = sys.exc_info()[1] 400 | if e.errno == errno.ENOENT: 401 | continue 402 | if verbose: 403 | print("unable to run %s" % dispcmd) 404 | print(e) 405 | return None, None 406 | else: 407 | if verbose: 408 | print("unable to find command, tried %s" % (commands,)) 409 | return None, None 410 | stdout = p.communicate()[0].strip() 411 | if sys.version_info[0] >= 3: 412 | stdout = stdout.decode() 413 | if p.returncode != 0: 414 | if verbose: 415 | print("unable to run %s (error)" % dispcmd) 416 | print("stdout was %s" % stdout) 417 | return None, p.returncode 418 | return stdout, p.returncode 419 | 420 | 421 | LONG_VERSION_PY['git'] = ''' 422 | # This file helps to compute a version number in source trees obtained from 423 | # git-archive tarball (such as those provided by githubs download-from-tag 424 | # feature). Distribution tarballs (built by setup.py sdist) and build 425 | # directories (produced by setup.py build) will contain a much shorter file 426 | # that just contains the computed version number. 427 | 428 | # This file is released into the public domain. Generated by 429 | # versioneer-0.18 (https://github.com/warner/python-versioneer) 430 | 431 | """Git implementation of _version.py.""" 432 | 433 | import errno 434 | import os 435 | import re 436 | import subprocess 437 | import sys 438 | 439 | 440 | def get_keywords(): 441 | """Get the keywords needed to look up the version information.""" 442 | # these strings will be replaced by git during git-archive. 443 | # setup.py/versioneer.py will grep for the variable names, so they must 444 | # each be defined on a line of their own. _version.py will just call 445 | # get_keywords(). 446 | git_refnames = "%(DOLLAR)sFormat:%%d%(DOLLAR)s" 447 | git_full = "%(DOLLAR)sFormat:%%H%(DOLLAR)s" 448 | git_date = "%(DOLLAR)sFormat:%%ci%(DOLLAR)s" 449 | keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} 450 | return keywords 451 | 452 | 453 | class VersioneerConfig: 454 | """Container for Versioneer configuration parameters.""" 455 | 456 | 457 | def get_config(): 458 | """Create, populate and return the VersioneerConfig() object.""" 459 | # these strings are filled in when 'setup.py versioneer' creates 460 | # _version.py 461 | cfg = VersioneerConfig() 462 | cfg.VCS = "git" 463 | cfg.style = "%(STYLE)s" 464 | cfg.tag_prefix = "%(TAG_PREFIX)s" 465 | cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s" 466 | cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s" 467 | cfg.verbose = False 468 | return cfg 469 | 470 | 471 | class NotThisMethod(Exception): 472 | """Exception raised if a method is not valid for the current scenario.""" 473 | 474 | 475 | LONG_VERSION_PY = {} 476 | HANDLERS = {} 477 | 478 | 479 | def register_vcs_handler(vcs, method): # decorator 480 | """Decorator to mark a method as the handler for a particular VCS.""" 481 | def decorate(f): 482 | """Store f in HANDLERS[vcs][method].""" 483 | if vcs not in HANDLERS: 484 | HANDLERS[vcs] = {} 485 | HANDLERS[vcs][method] = f 486 | return f 487 | return decorate 488 | 489 | 490 | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, 491 | env=None): 492 | """Call the given command(s).""" 493 | assert isinstance(commands, list) 494 | p = None 495 | for c in commands: 496 | try: 497 | dispcmd = str([c] + args) 498 | # remember shell=False, so use git.cmd on windows, not just git 499 | p = subprocess.Popen([c] + args, cwd=cwd, env=env, 500 | stdout=subprocess.PIPE, 501 | stderr=(subprocess.PIPE if hide_stderr 502 | else None)) 503 | break 504 | except EnvironmentError: 505 | e = sys.exc_info()[1] 506 | if e.errno == errno.ENOENT: 507 | continue 508 | if verbose: 509 | print("unable to run %%s" %% dispcmd) 510 | print(e) 511 | return None, None 512 | else: 513 | if verbose: 514 | print("unable to find command, tried %%s" %% (commands,)) 515 | return None, None 516 | stdout = p.communicate()[0].strip() 517 | if sys.version_info[0] >= 3: 518 | stdout = stdout.decode() 519 | if p.returncode != 0: 520 | if verbose: 521 | print("unable to run %%s (error)" %% dispcmd) 522 | print("stdout was %%s" %% stdout) 523 | return None, p.returncode 524 | return stdout, p.returncode 525 | 526 | 527 | def versions_from_parentdir(parentdir_prefix, root, verbose): 528 | """Try to determine the version from the parent directory name. 529 | 530 | Source tarballs conventionally unpack into a directory that includes both 531 | the project name and a version string. We will also support searching up 532 | two directory levels for an appropriately named parent directory 533 | """ 534 | rootdirs = [] 535 | 536 | for i in range(3): 537 | dirname = os.path.basename(root) 538 | if dirname.startswith(parentdir_prefix): 539 | return {"version": dirname[len(parentdir_prefix):], 540 | "full-revisionid": None, 541 | "dirty": False, "error": None, "date": None} 542 | else: 543 | rootdirs.append(root) 544 | root = os.path.dirname(root) # up a level 545 | 546 | if verbose: 547 | print("Tried directories %%s but none started with prefix %%s" %% 548 | (str(rootdirs), parentdir_prefix)) 549 | raise NotThisMethod("rootdir doesn't start with parentdir_prefix") 550 | 551 | 552 | @register_vcs_handler("git", "get_keywords") 553 | def git_get_keywords(versionfile_abs): 554 | """Extract version information from the given file.""" 555 | # the code embedded in _version.py can just fetch the value of these 556 | # keywords. When used from setup.py, we don't want to import _version.py, 557 | # so we do it with a regexp instead. This function is not used from 558 | # _version.py. 559 | keywords = {} 560 | try: 561 | f = open(versionfile_abs, "r") 562 | for line in f.readlines(): 563 | if line.strip().startswith("git_refnames ="): 564 | mo = re.search(r'=\s*"(.*)"', line) 565 | if mo: 566 | keywords["refnames"] = mo.group(1) 567 | if line.strip().startswith("git_full ="): 568 | mo = re.search(r'=\s*"(.*)"', line) 569 | if mo: 570 | keywords["full"] = mo.group(1) 571 | if line.strip().startswith("git_date ="): 572 | mo = re.search(r'=\s*"(.*)"', line) 573 | if mo: 574 | keywords["date"] = mo.group(1) 575 | f.close() 576 | except EnvironmentError: 577 | pass 578 | return keywords 579 | 580 | 581 | @register_vcs_handler("git", "keywords") 582 | def git_versions_from_keywords(keywords, tag_prefix, verbose): 583 | """Get version information from git keywords.""" 584 | if not keywords: 585 | raise NotThisMethod("no keywords at all, weird") 586 | date = keywords.get("date") 587 | if date is not None: 588 | # git-2.2.0 added "%%cI", which expands to an ISO-8601 -compliant 589 | # datestamp. However we prefer "%%ci" (which expands to an "ISO-8601 590 | # -like" string, which we must then edit to make compliant), because 591 | # it's been around since git-1.5.3, and it's too difficult to 592 | # discover which version we're using, or to work around using an 593 | # older one. 594 | date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) 595 | refnames = keywords["refnames"].strip() 596 | if refnames.startswith("$Format"): 597 | if verbose: 598 | print("keywords are unexpanded, not using") 599 | raise NotThisMethod("unexpanded keywords, not a git-archive tarball") 600 | refs = set([r.strip() for r in refnames.strip("()").split(",")]) 601 | # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of 602 | # just "foo-1.0". If we see a "tag: " prefix, prefer those. 603 | TAG = "tag: " 604 | tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) 605 | if not tags: 606 | # Either we're using git < 1.8.3, or there really are no tags. We use 607 | # a heuristic: assume all version tags have a digit. The old git %%d 608 | # expansion behaves like git log --decorate=short and strips out the 609 | # refs/heads/ and refs/tags/ prefixes that would let us distinguish 610 | # between branches and tags. By ignoring refnames without digits, we 611 | # filter out many common branch names like "release" and 612 | # "stabilization", as well as "HEAD" and "master". 613 | tags = set([r for r in refs if re.search(r'\d', r)]) 614 | if verbose: 615 | print("discarding '%%s', no digits" %% ",".join(refs - tags)) 616 | if verbose: 617 | print("likely tags: %%s" %% ",".join(sorted(tags))) 618 | for ref in sorted(tags): 619 | # sorting will prefer e.g. "2.0" over "2.0rc1" 620 | if ref.startswith(tag_prefix): 621 | r = ref[len(tag_prefix):] 622 | if verbose: 623 | print("picking %%s" %% r) 624 | return {"version": r, 625 | "full-revisionid": keywords["full"].strip(), 626 | "dirty": False, "error": None, 627 | "date": date} 628 | # no suitable tags, so version is "0+unknown", but full hex is still there 629 | if verbose: 630 | print("no suitable tags, using unknown + full revision id") 631 | return {"version": "0+unknown", 632 | "full-revisionid": keywords["full"].strip(), 633 | "dirty": False, "error": "no suitable tags", "date": None} 634 | 635 | 636 | @register_vcs_handler("git", "pieces_from_vcs") 637 | def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): 638 | """Get version from 'git describe' in the root of the source tree. 639 | 640 | This only gets called if the git-archive 'subst' keywords were *not* 641 | expanded, and _version.py hasn't already been rewritten with a short 642 | version string, meaning we're inside a checked out source tree. 643 | """ 644 | GITS = ["git"] 645 | if sys.platform == "win32": 646 | GITS = ["git.cmd", "git.exe"] 647 | 648 | out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, 649 | hide_stderr=True) 650 | if rc != 0: 651 | if verbose: 652 | print("Directory %%s not under git control" %% root) 653 | raise NotThisMethod("'git rev-parse --git-dir' returned error") 654 | 655 | # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] 656 | # if there isn't one, this yields HEX[-dirty] (no NUM) 657 | describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", 658 | "--always", "--long", 659 | "--match", "%%s*" %% tag_prefix], 660 | cwd=root) 661 | # --long was added in git-1.5.5 662 | if describe_out is None: 663 | raise NotThisMethod("'git describe' failed") 664 | describe_out = describe_out.strip() 665 | full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) 666 | if full_out is None: 667 | raise NotThisMethod("'git rev-parse' failed") 668 | full_out = full_out.strip() 669 | 670 | pieces = {} 671 | pieces["long"] = full_out 672 | pieces["short"] = full_out[:7] # maybe improved later 673 | pieces["error"] = None 674 | 675 | # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] 676 | # TAG might have hyphens. 677 | git_describe = describe_out 678 | 679 | # look for -dirty suffix 680 | dirty = git_describe.endswith("-dirty") 681 | pieces["dirty"] = dirty 682 | if dirty: 683 | git_describe = git_describe[:git_describe.rindex("-dirty")] 684 | 685 | # now we have TAG-NUM-gHEX or HEX 686 | 687 | if "-" in git_describe: 688 | # TAG-NUM-gHEX 689 | mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) 690 | if not mo: 691 | # unparseable. Maybe git-describe is misbehaving? 692 | pieces["error"] = ("unable to parse git-describe output: '%%s'" 693 | %% describe_out) 694 | return pieces 695 | 696 | # tag 697 | full_tag = mo.group(1) 698 | if not full_tag.startswith(tag_prefix): 699 | if verbose: 700 | fmt = "tag '%%s' doesn't start with prefix '%%s'" 701 | print(fmt %% (full_tag, tag_prefix)) 702 | pieces["error"] = ("tag '%%s' doesn't start with prefix '%%s'" 703 | %% (full_tag, tag_prefix)) 704 | return pieces 705 | pieces["closest-tag"] = full_tag[len(tag_prefix):] 706 | 707 | # distance: number of commits since tag 708 | pieces["distance"] = int(mo.group(2)) 709 | 710 | # commit: short hex revision ID 711 | pieces["short"] = mo.group(3) 712 | 713 | else: 714 | # HEX: no tags 715 | pieces["closest-tag"] = None 716 | count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], 717 | cwd=root) 718 | pieces["distance"] = int(count_out) # total number of commits 719 | 720 | # commit date: see ISO-8601 comment in git_versions_from_keywords() 721 | date = run_command(GITS, ["show", "-s", "--format=%%ci", "HEAD"], 722 | cwd=root)[0].strip() 723 | pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) 724 | 725 | return pieces 726 | 727 | 728 | def plus_or_dot(pieces): 729 | """Return a + if we don't already have one, else return a .""" 730 | if "+" in pieces.get("closest-tag", ""): 731 | return "." 732 | return "+" 733 | 734 | 735 | def render_pep440(pieces): 736 | """Build up version string, with post-release "local version identifier". 737 | 738 | Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you 739 | get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty 740 | 741 | Exceptions: 742 | 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] 743 | """ 744 | if pieces["closest-tag"]: 745 | rendered = pieces["closest-tag"] 746 | if pieces["distance"] or pieces["dirty"]: 747 | rendered += plus_or_dot(pieces) 748 | rendered += "%%d.g%%s" %% (pieces["distance"], pieces["short"]) 749 | if pieces["dirty"]: 750 | rendered += ".dirty" 751 | else: 752 | # exception #1 753 | rendered = "0+untagged.%%d.g%%s" %% (pieces["distance"], 754 | pieces["short"]) 755 | if pieces["dirty"]: 756 | rendered += ".dirty" 757 | return rendered 758 | 759 | 760 | def render_pep440_pre(pieces): 761 | """TAG[.post.devDISTANCE] -- No -dirty. 762 | 763 | Exceptions: 764 | 1: no tags. 0.post.devDISTANCE 765 | """ 766 | if pieces["closest-tag"]: 767 | rendered = pieces["closest-tag"] 768 | if pieces["distance"]: 769 | rendered += ".post.dev%%d" %% pieces["distance"] 770 | else: 771 | # exception #1 772 | rendered = "0.post.dev%%d" %% pieces["distance"] 773 | return rendered 774 | 775 | 776 | def render_pep440_post(pieces): 777 | """TAG[.postDISTANCE[.dev0]+gHEX] . 778 | 779 | The ".dev0" means dirty. Note that .dev0 sorts backwards 780 | (a dirty tree will appear "older" than the corresponding clean one), 781 | but you shouldn't be releasing software with -dirty anyways. 782 | 783 | Exceptions: 784 | 1: no tags. 0.postDISTANCE[.dev0] 785 | """ 786 | if pieces["closest-tag"]: 787 | rendered = pieces["closest-tag"] 788 | if pieces["distance"] or pieces["dirty"]: 789 | rendered += ".post%%d" %% pieces["distance"] 790 | if pieces["dirty"]: 791 | rendered += ".dev0" 792 | rendered += plus_or_dot(pieces) 793 | rendered += "g%%s" %% pieces["short"] 794 | else: 795 | # exception #1 796 | rendered = "0.post%%d" %% pieces["distance"] 797 | if pieces["dirty"]: 798 | rendered += ".dev0" 799 | rendered += "+g%%s" %% pieces["short"] 800 | return rendered 801 | 802 | 803 | def render_pep440_old(pieces): 804 | """TAG[.postDISTANCE[.dev0]] . 805 | 806 | The ".dev0" means dirty. 807 | 808 | Eexceptions: 809 | 1: no tags. 0.postDISTANCE[.dev0] 810 | """ 811 | if pieces["closest-tag"]: 812 | rendered = pieces["closest-tag"] 813 | if pieces["distance"] or pieces["dirty"]: 814 | rendered += ".post%%d" %% pieces["distance"] 815 | if pieces["dirty"]: 816 | rendered += ".dev0" 817 | else: 818 | # exception #1 819 | rendered = "0.post%%d" %% pieces["distance"] 820 | if pieces["dirty"]: 821 | rendered += ".dev0" 822 | return rendered 823 | 824 | 825 | def render_git_describe(pieces): 826 | """TAG[-DISTANCE-gHEX][-dirty]. 827 | 828 | Like 'git describe --tags --dirty --always'. 829 | 830 | Exceptions: 831 | 1: no tags. HEX[-dirty] (note: no 'g' prefix) 832 | """ 833 | if pieces["closest-tag"]: 834 | rendered = pieces["closest-tag"] 835 | if pieces["distance"]: 836 | rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"]) 837 | else: 838 | # exception #1 839 | rendered = pieces["short"] 840 | if pieces["dirty"]: 841 | rendered += "-dirty" 842 | return rendered 843 | 844 | 845 | def render_git_describe_long(pieces): 846 | """TAG-DISTANCE-gHEX[-dirty]. 847 | 848 | Like 'git describe --tags --dirty --always -long'. 849 | The distance/hash is unconditional. 850 | 851 | Exceptions: 852 | 1: no tags. HEX[-dirty] (note: no 'g' prefix) 853 | """ 854 | if pieces["closest-tag"]: 855 | rendered = pieces["closest-tag"] 856 | rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"]) 857 | else: 858 | # exception #1 859 | rendered = pieces["short"] 860 | if pieces["dirty"]: 861 | rendered += "-dirty" 862 | return rendered 863 | 864 | 865 | def render(pieces, style): 866 | """Render the given version pieces into the requested style.""" 867 | if pieces["error"]: 868 | return {"version": "unknown", 869 | "full-revisionid": pieces.get("long"), 870 | "dirty": None, 871 | "error": pieces["error"], 872 | "date": None} 873 | 874 | if not style or style == "default": 875 | style = "pep440" # the default 876 | 877 | if style == "pep440": 878 | rendered = render_pep440(pieces) 879 | elif style == "pep440-pre": 880 | rendered = render_pep440_pre(pieces) 881 | elif style == "pep440-post": 882 | rendered = render_pep440_post(pieces) 883 | elif style == "pep440-old": 884 | rendered = render_pep440_old(pieces) 885 | elif style == "git-describe": 886 | rendered = render_git_describe(pieces) 887 | elif style == "git-describe-long": 888 | rendered = render_git_describe_long(pieces) 889 | else: 890 | raise ValueError("unknown style '%%s'" %% style) 891 | 892 | return {"version": rendered, "full-revisionid": pieces["long"], 893 | "dirty": pieces["dirty"], "error": None, 894 | "date": pieces.get("date")} 895 | 896 | 897 | def get_versions(): 898 | """Get version information or return default if unable to do so.""" 899 | # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have 900 | # __file__, we can work backwards from there to the root. Some 901 | # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which 902 | # case we can only use expanded keywords. 903 | 904 | cfg = get_config() 905 | verbose = cfg.verbose 906 | 907 | try: 908 | return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, 909 | verbose) 910 | except NotThisMethod: 911 | pass 912 | 913 | try: 914 | root = os.path.realpath(__file__) 915 | # versionfile_source is the relative path from the top of the source 916 | # tree (where the .git directory might live) to this file. Invert 917 | # this to find the root from __file__. 918 | for i in cfg.versionfile_source.split('/'): 919 | root = os.path.dirname(root) 920 | except NameError: 921 | return {"version": "0+unknown", "full-revisionid": None, 922 | "dirty": None, 923 | "error": "unable to find root of source tree", 924 | "date": None} 925 | 926 | try: 927 | pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) 928 | return render(pieces, cfg.style) 929 | except NotThisMethod: 930 | pass 931 | 932 | try: 933 | if cfg.parentdir_prefix: 934 | return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) 935 | except NotThisMethod: 936 | pass 937 | 938 | return {"version": "0+unknown", "full-revisionid": None, 939 | "dirty": None, 940 | "error": "unable to compute version", "date": None} 941 | ''' 942 | 943 | 944 | @register_vcs_handler("git", "get_keywords") 945 | def git_get_keywords(versionfile_abs): 946 | """Extract version information from the given file.""" 947 | # the code embedded in _version.py can just fetch the value of these 948 | # keywords. When used from setup.py, we don't want to import _version.py, 949 | # so we do it with a regexp instead. This function is not used from 950 | # _version.py. 951 | keywords = {} 952 | try: 953 | f = open(versionfile_abs, "r") 954 | for line in f.readlines(): 955 | if line.strip().startswith("git_refnames ="): 956 | mo = re.search(r'=\s*"(.*)"', line) 957 | if mo: 958 | keywords["refnames"] = mo.group(1) 959 | if line.strip().startswith("git_full ="): 960 | mo = re.search(r'=\s*"(.*)"', line) 961 | if mo: 962 | keywords["full"] = mo.group(1) 963 | if line.strip().startswith("git_date ="): 964 | mo = re.search(r'=\s*"(.*)"', line) 965 | if mo: 966 | keywords["date"] = mo.group(1) 967 | f.close() 968 | except EnvironmentError: 969 | pass 970 | return keywords 971 | 972 | 973 | @register_vcs_handler("git", "keywords") 974 | def git_versions_from_keywords(keywords, tag_prefix, verbose): 975 | """Get version information from git keywords.""" 976 | if not keywords: 977 | raise NotThisMethod("no keywords at all, weird") 978 | date = keywords.get("date") 979 | if date is not None: 980 | # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant 981 | # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 982 | # -like" string, which we must then edit to make compliant), because 983 | # it's been around since git-1.5.3, and it's too difficult to 984 | # discover which version we're using, or to work around using an 985 | # older one. 986 | date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) 987 | refnames = keywords["refnames"].strip() 988 | if refnames.startswith("$Format"): 989 | if verbose: 990 | print("keywords are unexpanded, not using") 991 | raise NotThisMethod("unexpanded keywords, not a git-archive tarball") 992 | refs = set([r.strip() for r in refnames.strip("()").split(",")]) 993 | # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of 994 | # just "foo-1.0". If we see a "tag: " prefix, prefer those. 995 | TAG = "tag: " 996 | tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) 997 | if not tags: 998 | # Either we're using git < 1.8.3, or there really are no tags. We use 999 | # a heuristic: assume all version tags have a digit. The old git %d 1000 | # expansion behaves like git log --decorate=short and strips out the 1001 | # refs/heads/ and refs/tags/ prefixes that would let us distinguish 1002 | # between branches and tags. By ignoring refnames without digits, we 1003 | # filter out many common branch names like "release" and 1004 | # "stabilization", as well as "HEAD" and "master". 1005 | tags = set([r for r in refs if re.search(r'\d', r)]) 1006 | if verbose: 1007 | print("discarding '%s', no digits" % ",".join(refs - tags)) 1008 | if verbose: 1009 | print("likely tags: %s" % ",".join(sorted(tags))) 1010 | for ref in sorted(tags): 1011 | # sorting will prefer e.g. "2.0" over "2.0rc1" 1012 | if ref.startswith(tag_prefix): 1013 | r = ref[len(tag_prefix):] 1014 | if verbose: 1015 | print("picking %s" % r) 1016 | return {"version": r, 1017 | "full-revisionid": keywords["full"].strip(), 1018 | "dirty": False, "error": None, 1019 | "date": date} 1020 | # no suitable tags, so version is "0+unknown", but full hex is still there 1021 | if verbose: 1022 | print("no suitable tags, using unknown + full revision id") 1023 | return {"version": "0+unknown", 1024 | "full-revisionid": keywords["full"].strip(), 1025 | "dirty": False, "error": "no suitable tags", "date": None} 1026 | 1027 | 1028 | @register_vcs_handler("git", "pieces_from_vcs") 1029 | def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): 1030 | """Get version from 'git describe' in the root of the source tree. 1031 | 1032 | This only gets called if the git-archive 'subst' keywords were *not* 1033 | expanded, and _version.py hasn't already been rewritten with a short 1034 | version string, meaning we're inside a checked out source tree. 1035 | """ 1036 | GITS = ["git"] 1037 | if sys.platform == "win32": 1038 | GITS = ["git.cmd", "git.exe"] 1039 | 1040 | out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, 1041 | hide_stderr=True) 1042 | if rc != 0: 1043 | if verbose: 1044 | print("Directory %s not under git control" % root) 1045 | raise NotThisMethod("'git rev-parse --git-dir' returned error") 1046 | 1047 | # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] 1048 | # if there isn't one, this yields HEX[-dirty] (no NUM) 1049 | describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", 1050 | "--always", "--long", 1051 | "--match", "%s*" % tag_prefix], 1052 | cwd=root) 1053 | # --long was added in git-1.5.5 1054 | if describe_out is None: 1055 | raise NotThisMethod("'git describe' failed") 1056 | describe_out = describe_out.strip() 1057 | full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) 1058 | if full_out is None: 1059 | raise NotThisMethod("'git rev-parse' failed") 1060 | full_out = full_out.strip() 1061 | 1062 | pieces = {} 1063 | pieces["long"] = full_out 1064 | pieces["short"] = full_out[:7] # maybe improved later 1065 | pieces["error"] = None 1066 | 1067 | # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] 1068 | # TAG might have hyphens. 1069 | git_describe = describe_out 1070 | 1071 | # look for -dirty suffix 1072 | dirty = git_describe.endswith("-dirty") 1073 | pieces["dirty"] = dirty 1074 | if dirty: 1075 | git_describe = git_describe[:git_describe.rindex("-dirty")] 1076 | 1077 | # now we have TAG-NUM-gHEX or HEX 1078 | 1079 | if "-" in git_describe: 1080 | # TAG-NUM-gHEX 1081 | mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) 1082 | if not mo: 1083 | # unparseable. Maybe git-describe is misbehaving? 1084 | pieces["error"] = ("unable to parse git-describe output: '%s'" 1085 | % describe_out) 1086 | return pieces 1087 | 1088 | # tag 1089 | full_tag = mo.group(1) 1090 | if not full_tag.startswith(tag_prefix): 1091 | if verbose: 1092 | fmt = "tag '%s' doesn't start with prefix '%s'" 1093 | print(fmt % (full_tag, tag_prefix)) 1094 | pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" 1095 | % (full_tag, tag_prefix)) 1096 | return pieces 1097 | pieces["closest-tag"] = full_tag[len(tag_prefix):] 1098 | 1099 | # distance: number of commits since tag 1100 | pieces["distance"] = int(mo.group(2)) 1101 | 1102 | # commit: short hex revision ID 1103 | pieces["short"] = mo.group(3) 1104 | 1105 | else: 1106 | # HEX: no tags 1107 | pieces["closest-tag"] = None 1108 | count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], 1109 | cwd=root) 1110 | pieces["distance"] = int(count_out) # total number of commits 1111 | 1112 | # commit date: see ISO-8601 comment in git_versions_from_keywords() 1113 | date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], 1114 | cwd=root)[0].strip() 1115 | pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) 1116 | 1117 | return pieces 1118 | 1119 | 1120 | def do_vcs_install(manifest_in, versionfile_source, ipy): 1121 | """Git-specific installation logic for Versioneer. 1122 | 1123 | For Git, this means creating/changing .gitattributes to mark _version.py 1124 | for export-subst keyword substitution. 1125 | """ 1126 | GITS = ["git"] 1127 | if sys.platform == "win32": 1128 | GITS = ["git.cmd", "git.exe"] 1129 | files = [manifest_in, versionfile_source] 1130 | if ipy: 1131 | files.append(ipy) 1132 | try: 1133 | me = __file__ 1134 | if me.endswith(".pyc") or me.endswith(".pyo"): 1135 | me = os.path.splitext(me)[0] + ".py" 1136 | versioneer_file = os.path.relpath(me) 1137 | except NameError: 1138 | versioneer_file = "versioneer.py" 1139 | files.append(versioneer_file) 1140 | present = False 1141 | try: 1142 | f = open(".gitattributes", "r") 1143 | for line in f.readlines(): 1144 | if line.strip().startswith(versionfile_source): 1145 | if "export-subst" in line.strip().split()[1:]: 1146 | present = True 1147 | f.close() 1148 | except EnvironmentError: 1149 | pass 1150 | if not present: 1151 | f = open(".gitattributes", "a+") 1152 | f.write("%s export-subst\n" % versionfile_source) 1153 | f.close() 1154 | files.append(".gitattributes") 1155 | run_command(GITS, ["add", "--"] + files) 1156 | 1157 | 1158 | def versions_from_parentdir(parentdir_prefix, root, verbose): 1159 | """Try to determine the version from the parent directory name. 1160 | 1161 | Source tarballs conventionally unpack into a directory that includes both 1162 | the project name and a version string. We will also support searching up 1163 | two directory levels for an appropriately named parent directory 1164 | """ 1165 | rootdirs = [] 1166 | 1167 | for i in range(3): 1168 | dirname = os.path.basename(root) 1169 | if dirname.startswith(parentdir_prefix): 1170 | return {"version": dirname[len(parentdir_prefix):], 1171 | "full-revisionid": None, 1172 | "dirty": False, "error": None, "date": None} 1173 | else: 1174 | rootdirs.append(root) 1175 | root = os.path.dirname(root) # up a level 1176 | 1177 | if verbose: 1178 | print("Tried directories %s but none started with prefix %s" % 1179 | (str(rootdirs), parentdir_prefix)) 1180 | raise NotThisMethod("rootdir doesn't start with parentdir_prefix") 1181 | 1182 | 1183 | SHORT_VERSION_PY = """ 1184 | # This file was generated by 'versioneer.py' (0.18) from 1185 | # revision-control system data, or from the parent directory name of an 1186 | # unpacked source archive. Distribution tarballs contain a pre-generated copy 1187 | # of this file. 1188 | 1189 | import json 1190 | 1191 | version_json = ''' 1192 | %s 1193 | ''' # END VERSION_JSON 1194 | 1195 | 1196 | def get_versions(): 1197 | return json.loads(version_json) 1198 | """ 1199 | 1200 | 1201 | def versions_from_file(filename): 1202 | """Try to determine the version from _version.py if present.""" 1203 | try: 1204 | with open(filename) as f: 1205 | contents = f.read() 1206 | except EnvironmentError: 1207 | raise NotThisMethod("unable to read _version.py") 1208 | mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", 1209 | contents, re.M | re.S) 1210 | if not mo: 1211 | mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", 1212 | contents, re.M | re.S) 1213 | if not mo: 1214 | raise NotThisMethod("no version_json in _version.py") 1215 | return json.loads(mo.group(1)) 1216 | 1217 | 1218 | def write_to_version_file(filename, versions): 1219 | """Write the given version number to the given _version.py file.""" 1220 | os.unlink(filename) 1221 | contents = json.dumps(versions, sort_keys=True, 1222 | indent=1, separators=(",", ": ")) 1223 | with open(filename, "w") as f: 1224 | f.write(SHORT_VERSION_PY % contents) 1225 | 1226 | print("set %s to '%s'" % (filename, versions["version"])) 1227 | 1228 | 1229 | def plus_or_dot(pieces): 1230 | """Return a + if we don't already have one, else return a .""" 1231 | if "+" in pieces.get("closest-tag", ""): 1232 | return "." 1233 | return "+" 1234 | 1235 | 1236 | def render_pep440(pieces): 1237 | """Build up version string, with post-release "local version identifier". 1238 | 1239 | Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you 1240 | get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty 1241 | 1242 | Exceptions: 1243 | 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] 1244 | """ 1245 | if pieces["closest-tag"]: 1246 | rendered = pieces["closest-tag"] 1247 | if pieces["distance"] or pieces["dirty"]: 1248 | rendered += plus_or_dot(pieces) 1249 | rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) 1250 | if pieces["dirty"]: 1251 | rendered += ".dirty" 1252 | else: 1253 | # exception #1 1254 | rendered = "0+untagged.%d.g%s" % (pieces["distance"], 1255 | pieces["short"]) 1256 | if pieces["dirty"]: 1257 | rendered += ".dirty" 1258 | return rendered 1259 | 1260 | 1261 | def render_pep440_pre(pieces): 1262 | """TAG[.post.devDISTANCE] -- No -dirty. 1263 | 1264 | Exceptions: 1265 | 1: no tags. 0.post.devDISTANCE 1266 | """ 1267 | if pieces["closest-tag"]: 1268 | rendered = pieces["closest-tag"] 1269 | if pieces["distance"]: 1270 | rendered += ".post.dev%d" % pieces["distance"] 1271 | else: 1272 | # exception #1 1273 | rendered = "0.post.dev%d" % pieces["distance"] 1274 | return rendered 1275 | 1276 | 1277 | def render_pep440_post(pieces): 1278 | """TAG[.postDISTANCE[.dev0]+gHEX] . 1279 | 1280 | The ".dev0" means dirty. Note that .dev0 sorts backwards 1281 | (a dirty tree will appear "older" than the corresponding clean one), 1282 | but you shouldn't be releasing software with -dirty anyways. 1283 | 1284 | Exceptions: 1285 | 1: no tags. 0.postDISTANCE[.dev0] 1286 | """ 1287 | if pieces["closest-tag"]: 1288 | rendered = pieces["closest-tag"] 1289 | if pieces["distance"] or pieces["dirty"]: 1290 | rendered += ".post%d" % pieces["distance"] 1291 | if pieces["dirty"]: 1292 | rendered += ".dev0" 1293 | rendered += plus_or_dot(pieces) 1294 | rendered += "g%s" % pieces["short"] 1295 | else: 1296 | # exception #1 1297 | rendered = "0.post%d" % pieces["distance"] 1298 | if pieces["dirty"]: 1299 | rendered += ".dev0" 1300 | rendered += "+g%s" % pieces["short"] 1301 | return rendered 1302 | 1303 | 1304 | def render_pep440_old(pieces): 1305 | """TAG[.postDISTANCE[.dev0]] . 1306 | 1307 | The ".dev0" means dirty. 1308 | 1309 | Eexceptions: 1310 | 1: no tags. 0.postDISTANCE[.dev0] 1311 | """ 1312 | if pieces["closest-tag"]: 1313 | rendered = pieces["closest-tag"] 1314 | if pieces["distance"] or pieces["dirty"]: 1315 | rendered += ".post%d" % pieces["distance"] 1316 | if pieces["dirty"]: 1317 | rendered += ".dev0" 1318 | else: 1319 | # exception #1 1320 | rendered = "0.post%d" % pieces["distance"] 1321 | if pieces["dirty"]: 1322 | rendered += ".dev0" 1323 | return rendered 1324 | 1325 | 1326 | def render_git_describe(pieces): 1327 | """TAG[-DISTANCE-gHEX][-dirty]. 1328 | 1329 | Like 'git describe --tags --dirty --always'. 1330 | 1331 | Exceptions: 1332 | 1: no tags. HEX[-dirty] (note: no 'g' prefix) 1333 | """ 1334 | if pieces["closest-tag"]: 1335 | rendered = pieces["closest-tag"] 1336 | if pieces["distance"]: 1337 | rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) 1338 | else: 1339 | # exception #1 1340 | rendered = pieces["short"] 1341 | if pieces["dirty"]: 1342 | rendered += "-dirty" 1343 | return rendered 1344 | 1345 | 1346 | def render_git_describe_long(pieces): 1347 | """TAG-DISTANCE-gHEX[-dirty]. 1348 | 1349 | Like 'git describe --tags --dirty --always -long'. 1350 | The distance/hash is unconditional. 1351 | 1352 | Exceptions: 1353 | 1: no tags. HEX[-dirty] (note: no 'g' prefix) 1354 | """ 1355 | if pieces["closest-tag"]: 1356 | rendered = pieces["closest-tag"] 1357 | rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) 1358 | else: 1359 | # exception #1 1360 | rendered = pieces["short"] 1361 | if pieces["dirty"]: 1362 | rendered += "-dirty" 1363 | return rendered 1364 | 1365 | 1366 | def render(pieces, style): 1367 | """Render the given version pieces into the requested style.""" 1368 | if pieces["error"]: 1369 | return {"version": "unknown", 1370 | "full-revisionid": pieces.get("long"), 1371 | "dirty": None, 1372 | "error": pieces["error"], 1373 | "date": None} 1374 | 1375 | if not style or style == "default": 1376 | style = "pep440" # the default 1377 | 1378 | if style == "pep440": 1379 | rendered = render_pep440(pieces) 1380 | elif style == "pep440-pre": 1381 | rendered = render_pep440_pre(pieces) 1382 | elif style == "pep440-post": 1383 | rendered = render_pep440_post(pieces) 1384 | elif style == "pep440-old": 1385 | rendered = render_pep440_old(pieces) 1386 | elif style == "git-describe": 1387 | rendered = render_git_describe(pieces) 1388 | elif style == "git-describe-long": 1389 | rendered = render_git_describe_long(pieces) 1390 | else: 1391 | raise ValueError("unknown style '%s'" % style) 1392 | 1393 | return {"version": rendered, "full-revisionid": pieces["long"], 1394 | "dirty": pieces["dirty"], "error": None, 1395 | "date": pieces.get("date")} 1396 | 1397 | 1398 | class VersioneerBadRootError(Exception): 1399 | """The project root directory is unknown or missing key files.""" 1400 | 1401 | 1402 | def get_versions(verbose=False): 1403 | """Get the project version from whatever source is available. 1404 | 1405 | Returns dict with two keys: 'version' and 'full'. 1406 | """ 1407 | if "versioneer" in sys.modules: 1408 | # see the discussion in cmdclass.py:get_cmdclass() 1409 | del sys.modules["versioneer"] 1410 | 1411 | root = get_root() 1412 | cfg = get_config_from_root(root) 1413 | 1414 | assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg" 1415 | handlers = HANDLERS.get(cfg.VCS) 1416 | assert handlers, "unrecognized VCS '%s'" % cfg.VCS 1417 | verbose = verbose or cfg.verbose 1418 | assert cfg.versionfile_source is not None, \ 1419 | "please set versioneer.versionfile_source" 1420 | assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix" 1421 | 1422 | versionfile_abs = os.path.join(root, cfg.versionfile_source) 1423 | 1424 | # extract version from first of: _version.py, VCS command (e.g. 'git 1425 | # describe'), parentdir. This is meant to work for developers using a 1426 | # source checkout, for users of a tarball created by 'setup.py sdist', 1427 | # and for users of a tarball/zipball created by 'git archive' or github's 1428 | # download-from-tag feature or the equivalent in other VCSes. 1429 | 1430 | get_keywords_f = handlers.get("get_keywords") 1431 | from_keywords_f = handlers.get("keywords") 1432 | if get_keywords_f and from_keywords_f: 1433 | try: 1434 | keywords = get_keywords_f(versionfile_abs) 1435 | ver = from_keywords_f(keywords, cfg.tag_prefix, verbose) 1436 | if verbose: 1437 | print("got version from expanded keyword %s" % ver) 1438 | return ver 1439 | except NotThisMethod: 1440 | pass 1441 | 1442 | try: 1443 | ver = versions_from_file(versionfile_abs) 1444 | if verbose: 1445 | print("got version from file %s %s" % (versionfile_abs, ver)) 1446 | return ver 1447 | except NotThisMethod: 1448 | pass 1449 | 1450 | from_vcs_f = handlers.get("pieces_from_vcs") 1451 | if from_vcs_f: 1452 | try: 1453 | pieces = from_vcs_f(cfg.tag_prefix, root, verbose) 1454 | ver = render(pieces, cfg.style) 1455 | if verbose: 1456 | print("got version from VCS %s" % ver) 1457 | return ver 1458 | except NotThisMethod: 1459 | pass 1460 | 1461 | try: 1462 | if cfg.parentdir_prefix: 1463 | ver = versions_from_parentdir(cfg.parentdir_prefix, root, verbose) 1464 | if verbose: 1465 | print("got version from parentdir %s" % ver) 1466 | return ver 1467 | except NotThisMethod: 1468 | pass 1469 | 1470 | if verbose: 1471 | print("unable to compute version") 1472 | 1473 | return {"version": "0+unknown", "full-revisionid": None, 1474 | "dirty": None, "error": "unable to compute version", 1475 | "date": None} 1476 | 1477 | 1478 | def get_version(): 1479 | """Get the short version string for this project.""" 1480 | return get_versions()["version"] 1481 | 1482 | 1483 | def get_cmdclass(): 1484 | """Get the custom setuptools/distutils subclasses used by Versioneer.""" 1485 | if "versioneer" in sys.modules: 1486 | del sys.modules["versioneer"] 1487 | # this fixes the "python setup.py develop" case (also 'install' and 1488 | # 'easy_install .'), in which subdependencies of the main project are 1489 | # built (using setup.py bdist_egg) in the same python process. Assume 1490 | # a main project A and a dependency B, which use different versions 1491 | # of Versioneer. A's setup.py imports A's Versioneer, leaving it in 1492 | # sys.modules by the time B's setup.py is executed, causing B to run 1493 | # with the wrong versioneer. Setuptools wraps the sub-dep builds in a 1494 | # sandbox that restores sys.modules to it's pre-build state, so the 1495 | # parent is protected against the child's "import versioneer". By 1496 | # removing ourselves from sys.modules here, before the child build 1497 | # happens, we protect the child from the parent's versioneer too. 1498 | # Also see https://github.com/warner/python-versioneer/issues/52 1499 | 1500 | cmds = {} 1501 | 1502 | # we add "version" to both distutils and setuptools 1503 | from distutils.core import Command 1504 | 1505 | class cmd_version(Command): 1506 | description = "report generated version string" 1507 | user_options = [] 1508 | boolean_options = [] 1509 | 1510 | def initialize_options(self): 1511 | pass 1512 | 1513 | def finalize_options(self): 1514 | pass 1515 | 1516 | def run(self): 1517 | vers = get_versions(verbose=True) 1518 | print("Version: %s" % vers["version"]) 1519 | print(" full-revisionid: %s" % vers.get("full-revisionid")) 1520 | print(" dirty: %s" % vers.get("dirty")) 1521 | print(" date: %s" % vers.get("date")) 1522 | if vers["error"]: 1523 | print(" error: %s" % vers["error"]) 1524 | cmds["version"] = cmd_version 1525 | 1526 | # we override "build_py" in both distutils and setuptools 1527 | # 1528 | # most invocation pathways end up running build_py: 1529 | # distutils/build -> build_py 1530 | # distutils/install -> distutils/build ->.. 1531 | # setuptools/bdist_wheel -> distutils/install ->.. 1532 | # setuptools/bdist_egg -> distutils/install_lib -> build_py 1533 | # setuptools/install -> bdist_egg ->.. 1534 | # setuptools/develop -> ? 1535 | # pip install: 1536 | # copies source tree to a tempdir before running egg_info/etc 1537 | # if .git isn't copied too, 'git describe' will fail 1538 | # then does setup.py bdist_wheel, or sometimes setup.py install 1539 | # setup.py egg_info -> ? 1540 | 1541 | # we override different "build_py" commands for both environments 1542 | if "setuptools" in sys.modules: 1543 | from setuptools.command.build_py import build_py as _build_py 1544 | else: 1545 | from distutils.command.build_py import build_py as _build_py 1546 | 1547 | class cmd_build_py(_build_py): 1548 | def run(self): 1549 | root = get_root() 1550 | cfg = get_config_from_root(root) 1551 | versions = get_versions() 1552 | _build_py.run(self) 1553 | # now locate _version.py in the new build/ directory and replace 1554 | # it with an updated value 1555 | if cfg.versionfile_build: 1556 | target_versionfile = os.path.join(self.build_lib, 1557 | cfg.versionfile_build) 1558 | print("UPDATING %s" % target_versionfile) 1559 | write_to_version_file(target_versionfile, versions) 1560 | cmds["build_py"] = cmd_build_py 1561 | 1562 | if "cx_Freeze" in sys.modules: # cx_freeze enabled? 1563 | from cx_Freeze.dist import build_exe as _build_exe 1564 | # nczeczulin reports that py2exe won't like the pep440-style string 1565 | # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. 1566 | # setup(console=[{ 1567 | # "version": versioneer.get_version().split("+", 1)[0], # FILEVERSION 1568 | # "product_version": versioneer.get_version(), 1569 | # ... 1570 | 1571 | class cmd_build_exe(_build_exe): 1572 | def run(self): 1573 | root = get_root() 1574 | cfg = get_config_from_root(root) 1575 | versions = get_versions() 1576 | target_versionfile = cfg.versionfile_source 1577 | print("UPDATING %s" % target_versionfile) 1578 | write_to_version_file(target_versionfile, versions) 1579 | 1580 | _build_exe.run(self) 1581 | os.unlink(target_versionfile) 1582 | with open(cfg.versionfile_source, "w") as f: 1583 | LONG = LONG_VERSION_PY[cfg.VCS] 1584 | f.write(LONG % 1585 | {"DOLLAR": "$", 1586 | "STYLE": cfg.style, 1587 | "TAG_PREFIX": cfg.tag_prefix, 1588 | "PARENTDIR_PREFIX": cfg.parentdir_prefix, 1589 | "VERSIONFILE_SOURCE": cfg.versionfile_source, 1590 | }) 1591 | cmds["build_exe"] = cmd_build_exe 1592 | del cmds["build_py"] 1593 | 1594 | if 'py2exe' in sys.modules: # py2exe enabled? 1595 | try: 1596 | from py2exe.distutils_buildexe import py2exe as _py2exe # py3 1597 | except ImportError: 1598 | from py2exe.build_exe import py2exe as _py2exe # py2 1599 | 1600 | class cmd_py2exe(_py2exe): 1601 | def run(self): 1602 | root = get_root() 1603 | cfg = get_config_from_root(root) 1604 | versions = get_versions() 1605 | target_versionfile = cfg.versionfile_source 1606 | print("UPDATING %s" % target_versionfile) 1607 | write_to_version_file(target_versionfile, versions) 1608 | 1609 | _py2exe.run(self) 1610 | os.unlink(target_versionfile) 1611 | with open(cfg.versionfile_source, "w") as f: 1612 | LONG = LONG_VERSION_PY[cfg.VCS] 1613 | f.write(LONG % 1614 | {"DOLLAR": "$", 1615 | "STYLE": cfg.style, 1616 | "TAG_PREFIX": cfg.tag_prefix, 1617 | "PARENTDIR_PREFIX": cfg.parentdir_prefix, 1618 | "VERSIONFILE_SOURCE": cfg.versionfile_source, 1619 | }) 1620 | cmds["py2exe"] = cmd_py2exe 1621 | 1622 | # we override different "sdist" commands for both environments 1623 | if "setuptools" in sys.modules: 1624 | from setuptools.command.sdist import sdist as _sdist 1625 | else: 1626 | from distutils.command.sdist import sdist as _sdist 1627 | 1628 | class cmd_sdist(_sdist): 1629 | def run(self): 1630 | versions = get_versions() 1631 | self._versioneer_generated_versions = versions 1632 | # unless we update this, the command will keep using the old 1633 | # version 1634 | self.distribution.metadata.version = versions["version"] 1635 | return _sdist.run(self) 1636 | 1637 | def make_release_tree(self, base_dir, files): 1638 | root = get_root() 1639 | cfg = get_config_from_root(root) 1640 | _sdist.make_release_tree(self, base_dir, files) 1641 | # now locate _version.py in the new base_dir directory 1642 | # (remembering that it may be a hardlink) and replace it with an 1643 | # updated value 1644 | target_versionfile = os.path.join(base_dir, cfg.versionfile_source) 1645 | print("UPDATING %s" % target_versionfile) 1646 | write_to_version_file(target_versionfile, 1647 | self._versioneer_generated_versions) 1648 | cmds["sdist"] = cmd_sdist 1649 | 1650 | return cmds 1651 | 1652 | 1653 | CONFIG_ERROR = """ 1654 | setup.cfg is missing the necessary Versioneer configuration. You need 1655 | a section like: 1656 | 1657 | [versioneer] 1658 | VCS = git 1659 | style = pep440 1660 | versionfile_source = src/myproject/_version.py 1661 | versionfile_build = myproject/_version.py 1662 | tag_prefix = 1663 | parentdir_prefix = myproject- 1664 | 1665 | You will also need to edit your setup.py to use the results: 1666 | 1667 | import versioneer 1668 | setup(version=versioneer.get_version(), 1669 | cmdclass=versioneer.get_cmdclass(), ...) 1670 | 1671 | Please read the docstring in ./versioneer.py for configuration instructions, 1672 | edit setup.cfg, and re-run the installer or 'python versioneer.py setup'. 1673 | """ 1674 | 1675 | SAMPLE_CONFIG = """ 1676 | # See the docstring in versioneer.py for instructions. Note that you must 1677 | # re-run 'versioneer.py setup' after changing this section, and commit the 1678 | # resulting files. 1679 | 1680 | [versioneer] 1681 | #VCS = git 1682 | #style = pep440 1683 | #versionfile_source = 1684 | #versionfile_build = 1685 | #tag_prefix = 1686 | #parentdir_prefix = 1687 | 1688 | """ 1689 | 1690 | INIT_PY_SNIPPET = """ 1691 | from ._version import get_versions 1692 | __version__ = get_versions()['version'] 1693 | del get_versions 1694 | """ 1695 | 1696 | 1697 | def do_setup(): 1698 | """Main VCS-independent setup function for installing Versioneer.""" 1699 | root = get_root() 1700 | try: 1701 | cfg = get_config_from_root(root) 1702 | except (EnvironmentError, configparser.NoSectionError, 1703 | configparser.NoOptionError) as e: 1704 | if isinstance(e, (EnvironmentError, configparser.NoSectionError)): 1705 | print("Adding sample versioneer config to setup.cfg", 1706 | file=sys.stderr) 1707 | with open(os.path.join(root, "setup.cfg"), "a") as f: 1708 | f.write(SAMPLE_CONFIG) 1709 | print(CONFIG_ERROR, file=sys.stderr) 1710 | return 1 1711 | 1712 | print(" creating %s" % cfg.versionfile_source) 1713 | with open(cfg.versionfile_source, "w") as f: 1714 | LONG = LONG_VERSION_PY[cfg.VCS] 1715 | f.write(LONG % {"DOLLAR": "$", 1716 | "STYLE": cfg.style, 1717 | "TAG_PREFIX": cfg.tag_prefix, 1718 | "PARENTDIR_PREFIX": cfg.parentdir_prefix, 1719 | "VERSIONFILE_SOURCE": cfg.versionfile_source, 1720 | }) 1721 | 1722 | ipy = os.path.join(os.path.dirname(cfg.versionfile_source), 1723 | "__init__.py") 1724 | if os.path.exists(ipy): 1725 | try: 1726 | with open(ipy, "r") as f: 1727 | old = f.read() 1728 | except EnvironmentError: 1729 | old = "" 1730 | if INIT_PY_SNIPPET not in old: 1731 | print(" appending to %s" % ipy) 1732 | with open(ipy, "a") as f: 1733 | f.write(INIT_PY_SNIPPET) 1734 | else: 1735 | print(" %s unmodified" % ipy) 1736 | else: 1737 | print(" %s doesn't exist, ok" % ipy) 1738 | ipy = None 1739 | 1740 | # Make sure both the top-level "versioneer.py" and versionfile_source 1741 | # (PKG/_version.py, used by runtime code) are in MANIFEST.in, so 1742 | # they'll be copied into source distributions. Pip won't be able to 1743 | # install the package without this. 1744 | manifest_in = os.path.join(root, "MANIFEST.in") 1745 | simple_includes = set() 1746 | try: 1747 | with open(manifest_in, "r") as f: 1748 | for line in f: 1749 | if line.startswith("include "): 1750 | for include in line.split()[1:]: 1751 | simple_includes.add(include) 1752 | except EnvironmentError: 1753 | pass 1754 | # That doesn't cover everything MANIFEST.in can do 1755 | # (http://docs.python.org/2/distutils/sourcedist.html#commands), so 1756 | # it might give some false negatives. Appending redundant 'include' 1757 | # lines is safe, though. 1758 | if "versioneer.py" not in simple_includes: 1759 | print(" appending 'versioneer.py' to MANIFEST.in") 1760 | with open(manifest_in, "a") as f: 1761 | f.write("include versioneer.py\n") 1762 | else: 1763 | print(" 'versioneer.py' already in MANIFEST.in") 1764 | if cfg.versionfile_source not in simple_includes: 1765 | print(" appending versionfile_source ('%s') to MANIFEST.in" % 1766 | cfg.versionfile_source) 1767 | with open(manifest_in, "a") as f: 1768 | f.write("include %s\n" % cfg.versionfile_source) 1769 | else: 1770 | print(" versionfile_source already in MANIFEST.in") 1771 | 1772 | # Make VCS-specific changes. For git, this means creating/changing 1773 | # .gitattributes to mark _version.py for export-subst keyword 1774 | # substitution. 1775 | do_vcs_install(manifest_in, cfg.versionfile_source, ipy) 1776 | return 0 1777 | 1778 | 1779 | def scan_setup_py(): 1780 | """Validate the contents of setup.py against Versioneer's expectations.""" 1781 | found = set() 1782 | setters = False 1783 | errors = 0 1784 | with open("setup.py", "r") as f: 1785 | for line in f.readlines(): 1786 | if "import versioneer" in line: 1787 | found.add("import") 1788 | if "versioneer.get_cmdclass()" in line: 1789 | found.add("cmdclass") 1790 | if "versioneer.get_version()" in line: 1791 | found.add("get_version") 1792 | if "versioneer.VCS" in line: 1793 | setters = True 1794 | if "versioneer.versionfile_source" in line: 1795 | setters = True 1796 | if len(found) != 3: 1797 | print("") 1798 | print("Your setup.py appears to be missing some important items") 1799 | print("(but I might be wrong). Please make sure it has something") 1800 | print("roughly like the following:") 1801 | print("") 1802 | print(" import versioneer") 1803 | print(" setup( version=versioneer.get_version(),") 1804 | print(" cmdclass=versioneer.get_cmdclass(), ...)") 1805 | print("") 1806 | errors += 1 1807 | if setters: 1808 | print("You should remove lines like 'versioneer.VCS = ' and") 1809 | print("'versioneer.versionfile_source = ' . This configuration") 1810 | print("now lives in setup.cfg, and should be removed from setup.py") 1811 | print("") 1812 | errors += 1 1813 | return errors 1814 | 1815 | 1816 | if __name__ == "__main__": 1817 | cmd = sys.argv[1] 1818 | if cmd == "setup": 1819 | errors = do_setup() 1820 | errors += scan_setup_py() 1821 | if errors: 1822 | sys.exit(1) 1823 | --------------------------------------------------------------------------------