pax_global_header 0000666 0000000 0000000 00000000064 14145330145 0014512 g ustar 00root root 0000000 0000000 52 comment=48d922ad57316eab45d15ccfe41595c1e5e97039
pyproj-3.3.0/ 0000775 0000000 0000000 00000000000 14145330145 0013040 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/.all-contributorsrc 0000664 0000000 0000000 00000027705 14145330145 0016704 0 ustar 00root root 0000000 0000000 {
"projectName": "pyproj",
"projectOwner": "pyproj4",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"commitConvention": "none",
"contributors": [
{
"login": "jswhit",
"name": "Jeff Whitaker",
"avatar_url": "https://avatars2.githubusercontent.com/u/579593?v=4",
"profile": "https://github.com/jswhit",
"contributions": [
"doc",
"test",
"code",
"example",
"ideas",
"review",
"question",
"maintenance",
"infra",
"bug"
]
},
{
"login": "snowman2",
"name": "Alan D. Snow",
"avatar_url": "https://avatars3.githubusercontent.com/u/8699967?v=4",
"profile": "https://github.com/snowman2",
"contributions": [
"doc",
"test",
"code",
"example",
"maintenance",
"infra",
"ideas",
"review",
"question",
"bug"
]
},
{
"login": "micahcochran",
"name": "Micah Cochran",
"avatar_url": "https://avatars0.githubusercontent.com/u/7433104?v=4",
"profile": "https://github.com/micahcochran",
"contributions": [
"doc",
"test",
"code",
"maintenance",
"infra",
"review",
"question",
"bug"
]
},
{
"login": "jorisvandenbossche",
"name": "Joris Van den Bossche",
"avatar_url": "https://avatars2.githubusercontent.com/u/1020496?v=4",
"profile": "https://jorisvandenbossche.github.io/",
"contributions": [
"doc",
"code",
"ideas",
"review",
"question",
"bug",
"test"
]
},
{
"login": "cjmayo",
"name": "Chris Mayo",
"avatar_url": "https://avatars1.githubusercontent.com/u/921089?v=4",
"profile": "https://github.com/cjmayo",
"contributions": [
"test"
]
},
{
"login": "cffk",
"name": "Charles Karney",
"avatar_url": "https://avatars1.githubusercontent.com/u/2298266?v=4",
"profile": "https://www.petrel.org",
"contributions": [
"code",
"test"
]
},
{
"login": "zippy1981",
"name": "Justin Dearing",
"avatar_url": "https://avatars3.githubusercontent.com/u/146930?v=4",
"profile": "http://www.justaprogrammer.net/profile/justin",
"contributions": [
"infra"
]
},
{
"login": "jdkloe",
"name": "Jos de Kloe",
"avatar_url": "https://avatars3.githubusercontent.com/u/1906112?v=4",
"profile": "https://github.com/jdkloe",
"contributions": [
"code",
"test",
"bug"
]
},
{
"login": "georgeouzou",
"name": "George Ouzounoudis",
"avatar_url": "https://avatars3.githubusercontent.com/u/16732042?v=4",
"profile": "https://github.com/georgeouzou",
"contributions": [
"code",
"ideas"
]
},
{
"login": "djhoese",
"name": "David Hoese",
"avatar_url": "https://avatars3.githubusercontent.com/u/1828519?v=4",
"profile": "https://github.com/djhoese",
"contributions": [
"review",
"ideas",
"platform",
"doc",
"test",
"code"
]
},
{
"login": "mitkin",
"name": "Mikhail Itkin",
"avatar_url": "https://avatars3.githubusercontent.com/u/3927849?v=4",
"profile": "http://mitkin.github.io",
"contributions": [
"code"
]
},
{
"login": "dopplershift",
"name": "Ryan May",
"avatar_url": "https://avatars2.githubusercontent.com/u/221526?v=4",
"profile": "http://dopplershift.github.io",
"contributions": [
"code"
]
},
{
"login": "artttt",
"name": "artttt",
"avatar_url": "https://avatars3.githubusercontent.com/u/4626281?v=4",
"profile": "https://github.com/artttt",
"contributions": [
"ideas"
]
},
{
"login": "ocefpaf",
"name": "Filipe",
"avatar_url": "https://avatars1.githubusercontent.com/u/950575?v=4",
"profile": "http://ocefpaf.github.io/python4oceanographers",
"contributions": [
"infra",
"code",
"platform"
]
},
{
"login": "heitorPB",
"name": "Heitor",
"avatar_url": "https://avatars2.githubusercontent.com/u/13461702?v=4",
"profile": "https://github.com/heitorPB",
"contributions": [
"doc"
]
},
{
"login": "sebastic",
"name": "Bas Couwenberg",
"avatar_url": "https://avatars3.githubusercontent.com/u/4605306?v=4",
"profile": "https://github.com/sebastic",
"contributions": [
"code",
"platform",
"test"
]
},
{
"login": "nickeubank",
"name": "Nick Eubank",
"avatar_url": "https://avatars0.githubusercontent.com/u/9683693?v=4",
"profile": "https://github.com/nickeubank",
"contributions": [
"code"
]
},
{
"login": "mdunphy",
"name": "Michael Dunphy",
"avatar_url": "https://avatars3.githubusercontent.com/u/9088426?v=4",
"profile": "https://www.math.uwaterloo.ca/~mdunphy/",
"contributions": [
"doc"
]
},
{
"login": "matthew-brett",
"name": "Matthew Brett",
"avatar_url": "https://avatars2.githubusercontent.com/u/67612?v=4",
"profile": "http://matthew.dynevor.org",
"contributions": [
"infra",
"platform"
]
},
{
"login": "jdemaeyer",
"name": "Jakob de Maeyer ",
"avatar_url": "https://avatars1.githubusercontent.com/u/10531844?v=4",
"profile": "https://naboa.de",
"contributions": [
"code"
]
},
{
"login": "gitter-badger",
"name": "The Gitter Badger",
"avatar_url": "https://avatars2.githubusercontent.com/u/8518239?v=4",
"profile": "https://gitter.im",
"contributions": [
"doc"
]
},
{
"login": "bmwiedemann",
"name": "Bernhard M. Wiedemann",
"avatar_url": "https://avatars3.githubusercontent.com/u/637990?v=4",
"profile": "http://lizards.opensuse.org/author/bmwiedemann/",
"contributions": [
"code"
]
},
{
"login": "ReallyNiceGuy",
"name": "Marco Aurélio da Costa",
"avatar_url": "https://avatars0.githubusercontent.com/u/6545730?v=4",
"profile": "https://github.com/ReallyNiceGuy",
"contributions": [
"code"
]
},
{
"login": "ChrisBarker-NOAA",
"name": "Christopher H. Barker",
"avatar_url": "https://avatars2.githubusercontent.com/u/916576?v=4",
"profile": "https://github.com/ChrisBarker-NOAA",
"contributions": [
"code"
]
},
{
"login": "kbevers",
"name": "Kristian Evers",
"avatar_url": "https://avatars3.githubusercontent.com/u/13132571?v=4",
"profile": "https://evers.dev/",
"contributions": [
"question",
"ideas",
"doc"
]
},
{
"login": "rouault",
"name": "Even Rouault",
"avatar_url": "https://avatars2.githubusercontent.com/u/1192433?v=4",
"profile": "http://www.spatialys.com/en/about/",
"contributions": [
"question"
]
},
{
"login": "cgohlke",
"name": "Christoph Gohlke",
"avatar_url": "https://avatars3.githubusercontent.com/u/483428?v=4",
"profile": "https://github.com/cgohlke",
"contributions": [
"platform",
"question",
"bug",
"test"
]
},
{
"login": "chrrrisw",
"name": "Chris Willoughby",
"avatar_url": "https://avatars0.githubusercontent.com/u/5555320?v=4",
"profile": "https://github.com/chrrrisw",
"contributions": [
"code"
]
},
{
"login": "glostis",
"name": "Guillaume Lostis",
"avatar_url": "https://avatars0.githubusercontent.com/u/25295717?v=4",
"profile": "https://github.com/glostis",
"contributions": [
"doc"
]
},
{
"login": "edpop",
"name": "Eduard Popov",
"avatar_url": "https://avatars3.githubusercontent.com/u/13479292?v=4",
"profile": "https://github.com/edpop",
"contributions": [
"doc"
]
},
{
"login": "jranalli",
"name": "Joe Ranalli",
"avatar_url": "https://avatars2.githubusercontent.com/u/7864460?v=4",
"profile": "http://www.personal.psu.edu/jar339",
"contributions": [
"bug",
"code",
"test"
]
},
{
"login": "gberardinelli",
"name": "Greg Berardinelli",
"avatar_url": "https://avatars0.githubusercontent.com/u/13799588?v=4",
"profile": "https://github.com/gberardinelli",
"contributions": [
"bug",
"code",
"ideas",
"test"
]
},
{
"login": "mraspaud",
"name": "Martin Raspaud",
"avatar_url": "https://avatars1.githubusercontent.com/u/167802?v=4",
"profile": "https://github.com/mraspaud",
"contributions": [
"bug",
"code",
"test",
"ideas"
]
},
{
"login": "mwtoews",
"name": "Mike Taves",
"avatar_url": "https://avatars1.githubusercontent.com/u/895458?v=4",
"profile": "https://sites.google.com/site/mwtoews/",
"contributions": [
"test"
]
},
{
"login": "habi",
"name": "David Haberthür",
"avatar_url": "https://avatars2.githubusercontent.com/u/1651235?v=4",
"profile": "http://davidhaberthür.ch",
"contributions": [
"doc"
]
},
{
"login": "mmodenesi",
"name": "mmodenesi",
"avatar_url": "https://avatars2.githubusercontent.com/u/5569789?v=4",
"profile": "https://github.com/mmodenesi",
"contributions": [
"bug",
"code",
"test"
]
},
{
"login": "jacob-indigo",
"name": "jacob-indigo",
"avatar_url": "https://avatars0.githubusercontent.com/u/48448372?v=4",
"profile": "https://www.indigoag.com/",
"contributions": [
"bug",
"code"
]
},
{
"login": "rahulporuri",
"name": "Poruri Sai Rahul",
"avatar_url": "https://avatars0.githubusercontent.com/u/1926457?v=4",
"profile": "https://rahulporuri.github.io",
"contributions": [
"test"
]
},
{
"login": "underchemist",
"name": "Yann-Sebastien Tremblay-Johnston",
"avatar_url": "https://avatars1.githubusercontent.com/u/5283998?v=4",
"profile": "https://medium.com/@underchemist",
"contributions": [
"doc"
]
},
{
"login": "odidev",
"name": "odidev",
"avatar_url": "https://avatars2.githubusercontent.com/u/40816837?v=4",
"profile": "https://github.com/odidev",
"contributions": [
"platform"
]
},
{
"login": "idanmiara",
"name": "Idan Miara",
"avatar_url": "https://avatars.githubusercontent.com/u/26349741?v=4",
"profile": "https://github.com/idanmiara",
"contributions": [
"code",
"doc",
"example",
"test"
]
},
{
"login": "direvus",
"name": "Brendan Jurd",
"avatar_url": "https://avatars.githubusercontent.com/u/312229?v=4",
"profile": "https://github.com/direvus",
"contributions": [
"doc",
"design"
]
},
{
"login": "bjlittle",
"name": "Bill Little",
"avatar_url": "https://avatars.githubusercontent.com/u/2051656?v=4",
"profile": "https://www.metoffice.gov.uk/",
"contributions": [
"doc"
]
},
{
"login": "gerritholl",
"name": "Gerrit Holl",
"avatar_url": "https://avatars.githubusercontent.com/u/500246?v=4",
"profile": "https://github.com/gerritholl",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7
}
pyproj-3.3.0/.coveragerc 0000664 0000000 0000000 00000000165 14145330145 0015163 0 ustar 00root root 0000000 0000000 [run]
plugins = Cython.Coverage
[report]
# number of decimal points to report for coverage percentage
precision = 2
pyproj-3.3.0/.github/ 0000775 0000000 0000000 00000000000 14145330145 0014400 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14145330145 0016563 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000003151 14145330145 0021255 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
labels: bug
---
#### Code Sample, a copy-pastable example if possible
A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you:
http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
```python
# Your code here
```
#### Problem description
[this should explain **why** the current behavior is a problem and why the expected output is a better solution.]
#### Expected Output
#### Environment Information
- Output from: `pyproj -v`
- Output from: `python -m pyproj -v`
- Output from: `python -c "import pyproj; pyproj.show_versions()"`
- pyproj version (`python -c "import pyproj; print(pyproj.__version__)"`)
- PROJ version (`python -c "import pyproj; print(pyproj.proj_version_str)"`)
- PROJ data directory (`python -c "import pyproj; print(pyproj.datadir.get_data_dir())"`)
- Python version (`python -c "import sys; print(sys.version.replace('\n', ' '))"`)
- Operation System Information (`python -c "import platform; print(platform.platform())"`)
#### Installation method
- conda, pip wheel, from source, etc...
#### Conda environment information (if you installed with conda):
Environment (conda list):
```
$ conda list proj
```
Details about conda and system ( conda info ):
```
$ conda info
```
pyproj-3.3.0/.github/ISSUE_TEMPLATE/config.yml 0000664 0000000 0000000 00000000567 14145330145 0020563 0 ustar 00root root 0000000 0000000 contact_links:
- name: Ask questions
url: https://github.com/pyproj4/pyproj/discussions
about: Please ask and answer questions here.
- name: Ask questions from the GIS community
url: https://gis.stackexchange.com/questions/tagged/pyproj
about: To get answers from questions in the GIS commminuty, please ask and answer questions here with the pyproj tag.
pyproj-3.3.0/.github/ISSUE_TEMPLATE/feature_request.md 0000664 0000000 0000000 00000000310 14145330145 0022302 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Suggest an idea for this project
labels: proposal
---
pyproj-3.3.0/.github/ISSUE_TEMPLATE/installation_issues.md 0000664 0000000 0000000 00000001372 14145330145 0023204 0 ustar 00root root 0000000 0000000 ---
name: Installation issues
about: Issues installing pyproj (http://pyproj4.github.io/pyproj/stable/installation.html)
labels: installation-issues
---
#### Installation method/steps
- Installation method (conda, pip wheel, from source, etc...)
- How did you install PROJ? Where is it installed?
- Please provide all commands/steps you used to install pyproj and PROJ.
#### Environment Information
- pyproj version you are attempting to install
- PROJ version (Execute `proj` command and give version here.)
- Python version (`python -c "import sys; print(sys.version.replace('\n', ' '))"`)
- Operation System Information (`python -c "import platform; print(platform.platform())"`)
pyproj-3.3.0/.github/PULL_REQUEST_TEMPLATE.md 0000664 0000000 0000000 00000000322 14145330145 0020176 0 ustar 00root root 0000000 0000000
- [ ] Closes #xxxx
- [ ] Tests added
- [ ] Fully documented, including `history.rst` for all changes and `api/*.rst` for new API
pyproj-3.3.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14145330145 0016435 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/.github/workflows/build_docs.yaml 0000664 0000000 0000000 00000002715 14145330145 0021435 0 ustar 00root root 0000000 0000000 name: Publish Docs
on:
push:
branches: [ master ]
release:
types: [ created ]
jobs:
docs:
name: Publish Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup Conda
uses: s-weigand/setup-conda@v1
with:
python-version: 3.9
conda-channels: conda-forge
- name: Install and Build
shell: bash
run: |
conda config --prepend channels conda-forge
conda config --set channel_priority strict
conda create -n docs python=3.9 cython proj
source activate docs
python -m pip install -e . --no-use-pep517 || python -m pip install -e .
python -m pip install -r requirements-docs.txt
sphinx-build -b html docs/ docs/_build/
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
if: ${{ github.event_name == 'release' }}
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/_build/
CLEAN: false
TARGET_FOLDER: ${{ github.ref }}
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
if: ${{ github.event_name == 'push' }}
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/_build/
CLEAN: false
TARGET_FOLDER: latest
pyproj-3.3.0/.github/workflows/test_proj_latest.yaml 0000664 0000000 0000000 00000002751 14145330145 0022713 0 ustar 00root root 0000000 0000000 name: Test PROJ Latest
on:
push:
branches: [ master ]
schedule:
- cron: '0 0 * * 0'
jobs:
test_proj_latest:
name: PROJ Latest
runs-on: ubuntu-latest
env:
PYPROJ_FULL_COVERAGE: YES
PROJ_DIR: ${{ github.workspace }}/proj_install
PROJ_LIB: ${{ github.workspace }}/proj_install/share/proj
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install PROJ
shell: bash
run: |
sudo apt-get update
sudo apt-get install -qq sqlite3 libsqlite3-dev libtiff-dev libcurl4-openssl-dev cmake
bash ci/proj-compile.sh git
- name: Install and Log Environment
shell: bash
run: |
python -V
python -m pip install cython
python -m pip install -e . --no-use-pep517 || python -m pip install -e .
python -m pip install -r requirements-test.txt
pyproj -v
- name: Test
shell: bash
run: |
py.test --cov-report term-missing --cov=pyproj --cov-report xml
- name: Test Network
shell: bash
env:
PROJ_NETWORK: ON
run: |
py.test
- name: Test Global Context
shell: bash
env:
PYPROJ_GLOBAL_CONTEXT: ON
run: |
py.test
- name: Test Grids
shell: bash
run: |
$PROJ_DIR/bin/projsync --quiet --bbox -175,0,-50,85
py.test
pyproj-3.3.0/.github/workflows/tests.yaml 0000664 0000000 0000000 00000010044 14145330145 0020462 0 ustar 00root root 0000000 0000000 name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 * * 0'
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: pre-commit/action@v2.0.0
- name: Install mypy
run: |
python -m pip install mypy types-certifi
- name: mypy
run: |
mypy pyproj
test:
needs: linting
name: ${{ matrix.os }}, ${{ matrix.python-implementation }}=${{ matrix.python-version }}, PROJ=${{ matrix.proj-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, '3.10']
python-implementation: [python]
proj-version: ['*']
env:
- PYPROJ_FULL_COVERAGE: YES
include:
- os: ubuntu-latest
python-version: 3.8
python-implementation: python
proj-version: 8.0
- os: ubuntu-latest
python-version: 3.8
python-implementation: python
proj-version: 8.1
# disabled until pypy has 3.8+ version
# - os: ubuntu-latest
# python-version: '*'
# python-implementation: pypy
# proj-version: '*'
steps:
- uses: actions/checkout@v2
- name: Setup Conda
uses: s-weigand/setup-conda@v1
with:
conda-channels: conda-forge
- name: Install Env
shell: bash
run: |
conda config --prepend channels conda-forge
conda config --set channel_priority strict
export INSTALL_DEPS='${{ matrix.python-implementation }}=${{ matrix.python-version }} cython proj=${{ matrix.proj-version }} numpy xarray pandas'
if [ "${{ matrix.os }}" = "macos-latest" -a "${{ matrix.python-version }}" = "3.10" ]; then
sed -i.bak '/shapely/d' requirements-test.txt;
else
export INSTALL_DEPS="${INSTALL_DEPS} shapely";
fi;
conda create -n test $INSTALL_DEPS
source activate test
python -m pip install -e . --no-use-pep517 || python -m pip install -e .
python -m pip install -r requirements-test.txt
- name: Check and Log Environment
shell: bash
run: |
source activate test
python -V
pyproj -v
conda info
- name: Install pylint
shell: bash
if: matrix.python-implementation == 'python'
run: |
source activate test
python -m pip install pylint
- name: pylint
shell: bash
if: matrix.python-implementation == 'python'
run: |
source activate test
pylint pyproj
- name: Test with Coverage
shell: bash
if: matrix.python-implementation == 'python'
run: |
source activate test
py.test --cov-report term-missing --cov=pyproj --cov-report xml
- name: Test
shell: bash
if: matrix.python-implementation == 'pypy'
run: |
source activate test
py.test
- name: Test Network
shell: bash
env:
PROJ_NETWORK: ON
run: |
source activate test
py.test
- name: Test Global Context
shell: bash
env:
PYPROJ_GLOBAL_CONTEXT: ON
run: |
source activate test
py.test
- name: Test Grids
shell: bash
run: |
source activate test
projsync --quiet --bbox -175,0,-50,85
py.test
- name: Test Build docs
shell: bash
if: contains(matrix.os, 'ubuntu') && matrix.python-implementation == 'python'
run: |
source activate test
python -m pip install -r requirements-docs.txt
sphinx-build -b html docs/ docs/_build/
sphinx-build -b man docs/ docs/_build/
- uses: codecov/codecov-action@v1
pyproj-3.3.0/.gitignore 0000664 0000000 0000000 00000002456 14145330145 0015037 0 ustar 00root root 0000000 0000000 pyproj/proj_dir/
pyproj/*.c
pyproj/*/*.c
pyproj/*/*.html
pyproj/*.html
proj-*/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
wheelhouse/
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# dotenv
.env
# virtualenv
.venv
venv/
ENV/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
# pycharm
.idea/
# pytest
.pytest_cache/
# vscode
.vscode/
pyproj-3.3.0/.isort.cfg 0000664 0000000 0000000 00000000067 14145330145 0014742 0 ustar 00root root 0000000 0000000 [settings]
known_first_party=pyproj,test
profile=black
pyproj-3.3.0/.pre-commit-config.yaml 0000664 0000000 0000000 00000001702 14145330145 0017321 0 ustar 00root root 0000000 0000000 repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
- repo: https://github.com/timothycrosley/isort
rev: 5.6.1
hooks:
- id: isort
args: [setup.py, pyproj/, test/, docs/]
- repo: https://github.com/asottile/blacken-docs
rev: v1.8.0
hooks:
- id: blacken-docs
args: [--skip-errors]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
additional_dependencies: [flake8-comprehensions>=3.1.0]
- id: flake8
name: flake8-pyx
files: \.(pyx|pxd)$
types:
- file
args: [--append-config=flake8/cython.cfg]
pyproj-3.3.0/.pylintrc 0000664 0000000 0000000 00000044322 14145330145 0014712 0 ustar 00root root 0000000 0000000 [MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=pyproj._crs,
pyproj._transformer,
pyproj._sync,
pyproj._network,
pyproj._geod,
pyproj._datadir,
pyproj._compat,
pyproj.database,
pyproj.list
# Specify a score threshold to be exceeded before program exits with error.
fail-under=10.0
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
ignore-patterns=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use.
jobs=1
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
# complex, nested conditions.
limit-inference-results=100
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
logging-fstring-interpolation,
too-few-public-methods,
too-many-arguments,
line-too-long,
protected-access,
fixme,
too-many-public-methods,
duplicate-code,
cyclic-import
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member
[REPORTS]
# Python expression which should return a score less than or equal to 10. You
# have access to the variables 'error', 'warning', 'refactor', and 'convention'
# which contain the number of messages in each category, as well as 'statement'
# which is the total number of statements analyzed. This score is used by the
# global evaluation report (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details.
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages.
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
# it will be considered as an explicit return statement and no message will be
# printed.
never-returning-functions=sys.exit
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,
XXX,
TODO
# Regular expression of note tags to take in consideration.
#notes-rgx=
[BASIC]
# Naming style matching correct argument names.
argument-naming-style=snake_case
# Regular expression matching correct argument names. Overrides argument-
# naming-style.
#argument-rgx=
# Naming style matching correct attribute names.
attr-naming-style=snake_case
# Regular expression matching correct attribute names. Overrides attr-naming-
# style.
#attr-rgx=
# Bad variable names which should always be refused, separated by a comma.
bad-names=foo,
bar,
baz,
toto,
tutu,
tata
# Bad variable names regexes, separated by a comma. If names match any regex,
# they will always be refused
bad-names-rgxs=
# Naming style matching correct class attribute names.
class-attribute-naming-style=any
# Regular expression matching correct class attribute names. Overrides class-
# attribute-naming-style.
#class-attribute-rgx=
# Naming style matching correct class names.
class-naming-style=PascalCase
# Regular expression matching correct class names. Overrides class-naming-
# style.
#class-rgx=
# Naming style matching correct constant names.
const-naming-style=UPPER_CASE
# Regular expression matching correct constant names. Overrides const-naming-
# style.
#const-rgx=
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming style matching correct function names.
function-naming-style=snake_case
# Regular expression matching correct function names. Overrides function-
# naming-style.
#function-rgx=
# Good variable names which should always be accepted, separated by a comma.
good-names=i,
j,
k,
ex,
Run,
_
# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted
good-names-rgxs=
# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
# Naming style matching correct inline iteration names.
inlinevar-naming-style=any
# Regular expression matching correct inline iteration names. Overrides
# inlinevar-naming-style.
#inlinevar-rgx=
# Naming style matching correct method names.
method-naming-style=snake_case
# Regular expression matching correct method names. Overrides method-naming-
# style.
#method-rgx=
# Naming style matching correct module names.
module-naming-style=snake_case
# Regular expression matching correct module names. Overrides module-naming-
# style.
#module-rgx=
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty
# Naming style matching correct variable names.
variable-naming-style=snake_case
# Regular expression matching correct variable names. Overrides variable-
# naming-style.
#variable-rgx=
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )??$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module.
max-module-lines=1300
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=no
# Minimum lines number of a similarity.
min-similarity-lines=4
[SPELLING]
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=4
# Spelling dictionary name. Available dictionaries: none. To make it work,
# install the python-enchant package.
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains the private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to the private dictionary (see the
# --spelling-private-dict-file option) instead of raising a message.
spelling-store-unknown-words=no
[STRING]
# This flag controls whether inconsistent-quotes generates a warning when the
# character used as a quote delimiter is used inconsistently within a module.
check-quote-consistency=no
# This flag controls whether the implicit-str-concat should generate a warning
# on implicit string concatenation in sequences defined over several lines.
check-str-concat-over-line-jumps=no
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid defining new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,
_cb
# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore.
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None.
ignore-none=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
# List of decorators that change the signature of a decorated function.
signature-mutators=
[LOGGING]
# The type of string formatting that logging methods do. `old` means using %
# formatting, `new` is for `{}` formatting.
logging-format-style=old
# Logging modules to check that the string format arguments are in logging
# function parameter format.
logging-modules=logging
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
setUp,
__post_init__
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,
_fields,
_replace,
_source,
_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=cls
[IMPORTS]
# List of modules that can be imported at any level, not just the top level
# one.
allow-any-import-level=
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma.
deprecated-modules=optparse,tkinter.tix
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled).
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled).
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled).
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
# Couples of modules and preferred modules, separated by a comma.
preferred-modules=
[DESIGN]
# Maximum number of arguments for function / method.
max-args=5
# Maximum number of attributes for a class (see R0902).
max-attributes=7
# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5
# Maximum number of branch for function / method body.
max-branches=12
# Maximum number of locals for function / method body.
max-locals=20
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body.
max-returns=6
# Maximum number of statements in function / method body.
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=2
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
pyproj-3.3.0/.stickler.yml 0000664 0000000 0000000 00000000137 14145330145 0015462 0 ustar 00root root 0000000 0000000 linters:
black:
config: ./pyproject.toml
flake8:
python: 3
max-line-length: 88
pyproj-3.3.0/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000006400 14145330145 0015637 0 ustar 00root root 0000000 0000000 # Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
pyproj-3.3.0/CONTRIBUTING.md 0000664 0000000 0000000 00000033122 14145330145 0015272 0 ustar 00root root 0000000 0000000 # Contributors Guide
Based on the guide from: https://github.com/Unidata/MetPy
Interested in helping build pyproj? Have code from your research that you believe others will find useful? Have a few minutes to tackle an issue? In this guide we will get you setup and integrated into contributing to pyproj!
## Introduction
First off, thank you for considering contributing to pyproj. pyproj is community-driven
project. It's people like you that make pyproj useful and successful. There are many ways
to contribute, from writing tutorials or examples, improvements to the documentation,
submitting bug reports and feature requests, or even writing code which can be incorporated into pyproj for everyone to use.
Following these guidelines helps to communicate that you respect the time of the
developers managing and developing this open source project. In return, they
should reciprocate that respect in addressing your issue, assessing changes, and
helping you finalize your pull requests.
So, please take a few minutes to read through this guide and get setup for success with your pyproj contributions. We're glad you're here!
## What Can I Do?
* Tackle any [issues](https://github.com/pyproj4/pyproj/issues) you wish! We have a special
label for issues that beginners might want to try. Have a look at our
[current beginner issues.](https://github.com/pyproj4/pyproj/issues?q=is%3Aopen+is%3Aissue+label%3A%22Difficulty%3A+Beginner%22)
Also have a look at if the issue is already assigned to someone - this helps us make sure that work is not duplicated if the issue is already being worked on by someone else.
* Contribute code you already have. It does not need to be perfect! We will help you clean
things up, test it, etc.
* Make a tutorial or example of how to do something.
* Improve documentation of a feature you found troublesome.
* File a new issue if you run into problems!
## Ground Rules
The goal is to maintain a diverse community that's pleasant for everyone. Please
be considerate and respectful of others by following our
[code of conduct](https://github.com/pyproj4/pyproj/blob/master/CODE_OF_CONDUCT.md).
Other items:
* Each pull request should consist of a logical collection of changes. You can
include multiple bug fixes in a single pull request, but they should be related.
For unrelated changes, please submit multiple pull requests.
* Do not commit changes to files that are irrelevant to your feature or bugfix
(eg: .gitignore).
* Be willing to accept criticism and work on improving your code; we don't want
to break other users' code, so care must be taken not to introduce bugs.
* Be aware that the pull request review process is not immediate, and is
generally proportional to the size of the pull request.
## Reporting a bug
The easiest way to get involved is to report issues you encounter when using pyproj or by
requesting something you think is missing.
* Head over to the [issues](https://github.com/pyproj4/pyproj/issues) page.
* Search to see if your issue already exists or has even been solved previously.
* If you indeed have a new issue or request, click the "New Issue" button.
* Fill in as much of the issue template as is relevant. Please be as specific as possible.
Include the version of the code you were using, as well as what operating system you
are running. If possible, include complete, minimal example code that reproduces the problem.
## Setting up your development environment
We recommend using the [conda](https://conda.io/docs/) package manager for your Python
environments. Our recommended setup for contributing is:
* Install [miniconda](https://docs.conda.io/en/latest/miniconda.html) on your system.
* Install git on your system if it is not already there (install XCode command line tools on
a Mac or git bash on Windows)
* Login to your GitHub account and make a fork of the
[pyproj repository](https://github.com/pyproj4/pyproj/) by clicking the "Fork" button.
* Clone your fork of the pyproj repository (in terminal on Mac/Linux or git shell/
GUI on Windows) in the location you'd like to keep it. We are partial to creating a
``git_repos`` directory in our home folder.
``git clone https://github.com/your-user-name/pyproj.git``
* Navigate to that folder in the terminal or in Anaconda Prompt if you're on Windows.
``cd pyproj``
* Connect your repository to the upstream (main project).
``git remote add upstream https://github.com/pyproj4/pyproj.git``
* Create the development environment by running ``conda create -n devel -c conda-forge cython proj numpy shapely xarray pandas``.
* If the minimum PROJ version is not yet available, you can build PROJ from source using:
```bash
export PROJ_DIR=$PWD/pyproj/proj_dir
mkdir $PROJ_DIR
bash ci/proj-compile.sh git
```
* Activate our new development environment ``conda activate devel`` on Mac/Linux or
``activate devel`` on Windows.
* Install development requirements ``pip install -r requirements-dev.txt``
* Make an editable install of pyproj by running ``pip install -e .``
* Setup pre-commit hooks ``pre-commit install`` and ``pre-commit autoupdate``
Now you're all set! You have an environment called ``devel`` that you can work in. You'll need
to make sure to activate that environment next time you want to use it after closing the
terminal or your system. If you want to get back to the root environment, just run
``source deactivate`` (just ``deactivate`` on Windows).
## Pull Requests
The changes to the pyproj source (and documentation) should be made via GitHub pull requests against ``master``, even for those with administration rights. While it's tempting to make changes directly to ``master`` and push them up, it is better to make a pull request so that others can give feedback. If nothing else, this gives a chance for the automated tests to run on the PR. This can eliminate "brown paper bag" moments with buggy commits on the master branch.
During the Pull Request process, before the final merge, it's a good idea to rebase the branch and squash together smaller commits. It's not necessary to flatten the entire branch, but it can be nice to eliminate small fixes and get the merge down to logically arranged commits. This can also be used to hide sins from history--this is the only chance, since once it hits ``master``, it's there forever!
**Working on your first Pull Request?** You can learn how from this *free* video series
[How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github), Aaron Meurer's [tutorial on the git workflow](https://www.asmeurer.com/git-workflow/), or the guide [“How to Contribute to Open Source"](https://opensource.guide/how-to-contribute/).
Commit the changes you made. Chris Beams has written a [guide](https://chris.beams.io/posts/git-commit/) on how to write good commit messages.
Push to your fork and [submit a pull request]( https://github.com/pyproj4/pyproj/compare/).
## Documentation
Now that you've made your awesome contribution, it's time to tell the world how to use it.
Writing documentation strings is really important to make sure others use your functionality properly. Didn't write new functions? That's fine, but be sure that the documentation for the code you touched is still in great shape. It is not uncommon to find some strange wording or clarification that you can take care of while you are here. If you added a new function make sure that it gets marked as included if appropriate in the GEMPAK conversion table.
You can write examples in the documentation if they are simple concepts to demonstrate. If
your feature is more complex, consider adding to the examples or tutorials for pyproj.
You can build the documentation locally to see how your changes will look.
* Install docs requirements: ``make install-docs``
* Build the docs: ``make docs``
* Or, to build and open in a browser: ``make docs-browser``
## Tests
Unit tests are the lifeblood of the project, as it ensures that we can continue to add and
change the code and stay confident that things have not broken. Running the tests requires
``pytest``, which is easily available through ``conda`` or ``pip``. It was also installed if you made our default ``devel`` environment.
### Running Tests
Running the tests can be done by running ``py.test``. Make sure you install the test requirements before running the tests ``pip install -r requirements-test.txt``.
Running the whole test suite isn't that slow, but can be a burden if you're working on just
one module or a specific test. It is easy to run tests on a single directory:
py.test pyproj/calc
A specific test can be run as:
py.test -k test_my_test_func_name
### Writing Tests
Tests should ideally hit all of the lines of code added or changed. We have automated
services that can help track down lines of code that are missed by tests. Watching the
coverage has even helped find sections of dead code that could be removed!
Let's say we are adding a simple function to add two numbers and return the result as a float or as a string. (This would be a silly function, but go with us here for demonstration purposes.)
def add_as_float_or_string(a, b, as_string=False):
res = a + b
if as_string:
return string(res)
return res
I can see two easy tests here: one for the results as a float and one for the results as a
string. If I had added this to the ``calc`` module, I'd add those two tests in
``tests/test_calc.py``.
def test_add_as_float_or_string_defaults():
res = add_as_float_or_string(3, 4)
assert(res, 7)
def test_add_as_float_or_string_string_return():
res = add_as_float_or_string(3, 4, as_string=True)
assert(res, '7')
There are plenty of more advanced testing concepts, like dealing with floating point
comparisons, parameterizing tests, testing that exceptions are raised, and more. Have a look at the existing tests to get an idea of some of the common patterns.
## Code Style
pyproj uses the Python code style outlined in [PEP8](https://pep8.org) and [black](https://github.com/python/black).
We enforce this style as code is added to keep everything clean and uniform. To this end, part of the automated testing for pyproj checks style. To check style
locally within the source directory you can use the ``flake8`` and ``black`` tools. Running it from the root of the source directory is as easy as running ``make lint`` in the base of the repository.
You can also just submit your PR and the kind robots will comment on all style violations as well. It can be a pain to make sure you have the right number of spaces around things, imports in order, and all of the other nits that the bots will find. It is very important though as this consistent style helps us keep pyproj readable, maintainable, and uniform.
## What happens after the pull request
You've make your changes, documented them, added some tests, and submitted a pull request.
What now?
### Automated Testing
First, our army of never sleeping robots will begin a series of automated checks.
The test suite, documentation, style, and more will be checked on various versions of Python with current and legacy packages. Travis CI will run testing on Linux and Mac, Appveyor will run tests on Windows. Other services will kick in and check if there is a drop in code coverage or any style variations that should be corrected. If you see a red mark by a service, something failed and clicking the "Details" link will give you more information. We're happy to help if you are stuck.
The robots can be difficult to satisfy, but they are there to help everyone write better code. In some cases, there will be exceptions to their suggestions, but these are rare. If you make changes to your code and push again, the tests will automatically run again.
### Code Review
At this point you're waiting on us. You should expect to hear at least a comment within a
couple of days. We may suggest some changes or improvements or alternatives.
Some things that will increase the chance that your pull request is accepted quickly:
* Write tests.
* Follow [PEP8](https://pep8.org) for style. (The `flake8` utility can help with this.)
* Use [black](https://github.com/python/black)
* Write a [good commit message](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
Pull requests will automatically have tests run by Travis. This includes
running both the unit tests as well as the `flake8` code linter.
### Merging
Once we're all happy with the pull request, it's time for it to get merged in. Only the
maintainers can merge pull requests and you should never merge a pull request you have commits on as it circumvents the code review. If this is your first or second pull request, we'll likely help by rebasing and cleaning up the commit history for you. As your developement skills increase, we'll help you learn how to do this.
## Allcontributors Recognition
We do our best to recognize contributions, but we may miss some. If we did, please let us know. Also, if you would prefer not to be recognized on the README, please let us know.
## More Questions?
If you're stuck somewhere or are interested in being a part of the community in
other ways, feel free to contact us:
* [pyproj's Gitter Channel](https://gitter.im/pyproj4-pyproj/community)
* ["pyproj" tag on GIS Stack Exchange](https://gis.stackexchange.com/questions/tagged/pyproj)
## Futher Reading
There are a ton of great resources out there on contributing to open source and on the
importance of writing tested and maintainable software.
* [GitHub's Contributing to Open Source Guide](https://guides.github.com/activities/contributing-to-open-source/)
* [Zen of Scientific Software Maintenance](https://jrleeman.github.io/ScientificSoftwareMaintenance/)
pyproj-3.3.0/HOW_TO_RELEASE.md 0000664 0000000 0000000 00000004751 14145330145 0015570 0 ustar 00root root 0000000 0000000 # Preparing a pyproj release
Preparing a pyproj release is a two-phase process.
## Phase 1: Release Candidate
In this phase, we want to ensure all the builds work on all platforms and methods
of distribution for the next release.
### Add the rc postfix
The first step in this phase is to update the version number `__version__` in `__init__.py`
to the next release `..`. Then, add the `rc` style posfix following the [PEP-440](https://www.python.org/dev/peps/pep-0440/#pre-releases) conventions.
### Create a tag on the repository
The next step is to create a tag with the same name as the version just added. This can be done using the git command line or from https://github.com/pyproj4/pyproj/tags.
### Test the release builds
1. Create a draft PR at https://github.com/pyproj4/pyproj-wheels and verify tests pass.
2. Create a draft PR at https://github.com/conda-forge/pyproj-feedstock and verify tests pass.
3. Verify Windows wheels built properly.
4. Verify Debian builds were succesful.
5. Verify the docs build successfully.
## Phase 2: Make the release
After the candidate has proven itself, it will be promoted to a final release.
### Remove the rc postfix
Remove the `rc` postfix from the the version number `__version__` in `__init__.py`.
### Create a tag on the repository
The next step is to create a tag with the name `..`. This can be done using the git command line or from https://github.com/pyproj4/pyproj/tags.
Next, go through the history and add release notes. Make sure to acknowledge contributions made by others in the release. A useful script for automating this task for code contributions is the [pandas announce script](https://github.com/pandas-dev/pandas/blob/bb6135880e5e453d7701764b9f2e4ad3356a68d7/doc/sphinxext/announce.py).
### The wheels
1. Update the PR at https://github.com/pyproj4/pyproj-wheels with the release tag, merge, and download wheels.
2. Retrieve Windows wheels from https://www.lfd.uci.edu/~gohlke/pythonlibs.
### Create the release sdist
1. Make sure the directory is clean and checkout the release tag.
2. `python setup.py sdist`
### Upload to pypi
Upload the wheels and the sdist `tar.gz` for the release to pypi.
### Verify conda-forge build is correct
A PR for `pyproj` will be generated automatically after you push to pypi.
Verify all is correct on the PR at https://github.com/conda-forge/pyproj-feedstock.
### Update the docs
On the `gh-pages` branch, update the stable symlink to point to the next version.
pyproj-3.3.0/LICENSE 0000664 0000000 0000000 00000002136 14145330145 0014047 0 ustar 00root root 0000000 0000000 Copyright (c) 2006-2018, Jeffrey Whitaker.
Copyright (c) 2019-2021, Open source contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pyproj-3.3.0/LICENSE_proj4 0000664 0000000 0000000 00000003270 14145330145 0015165 0 ustar 00root root 0000000 0000000
All source, data files and other contents of the PROJ.4 package are
available under the following terms. Note that the PROJ 4.3 and earlier
was "public domain" as is common with US government work, but apparently
this is not a well defined legal term in many countries. I am placing
everything under the following MIT style license because I believe it is
effectively the same as public domain, allowing anyone to use the code as
they wish, including making proprietary derivatives.
Though I have put my own name as copyright holder, I don't mean to imply
I did the work. Essentially all work was done by Gerald Evenden.
--------------
Copyright (c) 2000, Frank Warmerdam
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
pyproj-3.3.0/MANIFEST.in 0000664 0000000 0000000 00000000604 14145330145 0014576 0 ustar 00root root 0000000 0000000 include README.md
include MANIFEST.in
include pyproject.toml
include LICENSE
include Makefile
include pytest.ini
include pyproj/py.typed
include pyproj/*.pyd
include pyproj/*.pyx
include pyproj/*.pxd
include pyproj/*.pxi
include pyproj/*.pyi
include test/sample.out
include test/*.py
include test/*/*.py
exclude pyproj/*.c
recursive-include docs *
prune docs/_build
prune pyproj/proj_dir
pyproj-3.3.0/Makefile 0000664 0000000 0000000 00000005266 14145330145 0014511 0 ustar 00root root 0000000 0000000 # This was based on a Makefile by Kirk Hansen
.PHONY: clean clean-test clean-pyc clean-build clean-setup clean-cython docs help test
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python3 -c "$$BROWSER_PYSCRIPT"
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
clean: clean-build clean-pyc clean-test clean-setup clean-cython ## remove all build, test, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test: ## remove test and coverage artifacts
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
clean-setup: ## run python setup.py clean
python setup.py clean
clean-cython: ## clean the cython files
rm -f pyproj/*.so
rm -f pyproj/*/*.so
rm -f pyproj/*/*.c
rm -f pyproj/*.c
check-type:
mypy pyproj
check: check-type
pre-commit run --show-diff-on-failure --all-files
test: ## run tests
py.test
test-verbose: ## run tests with full verbosity
py.test -vv -s
test-coverage: ## run tests and generate coverage report
py.test --cov-report term-missing --cov=pyproj -v -s
install-docs: ## Install requirements for building documentation
python -m pip install -r requirements-docs.txt
docs: ## generate Sphinx HTML documentation, including API docs
$(MAKE) -C docs clean
$(MAKE) -C docs html
docs-browser: docs ## generate Sphinx HTML documentation, including API docs and open in a browser
$(BROWSER) docs/_build/html/index.html
docs-man: ## generate Sphinx man pages for CLI
$(MAKE) -C docs clean
$(MAKE) -C docs man
install: clean ## install the package to the active Python's site-packages
python setup.py install
install-dev: clean ## install development version to active Python's site-packages
python -m pip install -r requirements-dev.txt
pre-commit install
python -m pip install -r requirements-test.txt
PYPROJ_FULL_COVERAGE=YES python -m pip install -e . --no-use-pep517 || PYPROJ_FULL_COVERAGE=YES python -m pip install -e .
pyproj-3.3.0/README.md 0000664 0000000 0000000 00000052570 14145330145 0014330 0 ustar 00root root 0000000 0000000 
# pyproj
Python interface to [PROJ](http://proj.org) (cartographic projections and coordinate transformations library).
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
pyproj-3.3.0/appveyor.yml 0000664 0000000 0000000 00000011263 14145330145 0015433 0 ustar 00root root 0000000 0000000 platform:
- x64
# This is based on file and files in ci/appveyor are from
# https://github.com/ogrisel/python-appveyor-demo
environment:
global:
PROJ_BASE_DIR: "%APPVEYOR_BUILD_FOLDER%\\proj_install"
PROJ_NETWORK: "ON"
matrix:
# Pre-installed Python versions
# See: http://www.appveyor.com/docs/installed-software#python
# build is limited to 60 minutes, without caching each build takes 10-30 minutes
# with caching build takes less than 1 minute
# - PYTHON: "C:\\Python37-x64"
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
# PROJSOURCE: 8.1.1
# BUILD_SHARED_LIBS: ON
- PYTHON: "C:\\Python38-x64"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
PROJSOURCE: 8.1.1
BUILD_SHARED_LIBS: ON
# - PYTHON: "C:\\Python39-x64"
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
# PROJSOURCE: git
# BUILD_SHARED_LIBS: ON
# matrix:
# allow_failures:
# - PYTHON: "C:\\Python39-x64"
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
# PROJSOURCE: git
# BUILD_SHARED_LIBS: ON
shallow_clone: true
cache:
- C:\Tools\vcpkg\installed\ -> appveyor.yml
- C:\Users\appveyor\AppData\Local\pip\Cache\wheels -> appveyor.yml
- "%PROJ_BASE_DIR%"
build_script:
- set VCPKG_INSTALLED=C:\Tools\vcpkg\installed\%platform%-windows
# If cached directory does not exist, update vcpkg and install dependencies
- if not exist %VCPKG_INSTALLED%\bin (
cd "C:\Tools\vcpkg" &
git pull > nul &
.\bootstrap-vcpkg.bat -disableMetrics &
vcpkg install sqlite3[core,tool]:"%platform%"-windows &
vcpkg install tiff:"%platform%"-windows &
vcpkg install curl:"%platform%"-windows &
cd %APPVEYOR_BUILD_FOLDER%
)
- dir %VCPKG_INSTALLED%\bin
- set PATH=%VCPKG_INSTALLED%\bin;%PATH%
# See https://www.appveyor.com/docs/lang/cpp/
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019"
(call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %platform% )
# setup PROJ
- set PROJ_DIR=%PROJ_BASE_DIR%\proj-%PROJSOURCE:~0,5%
- if "%PROJSOURCE%" == "git" git clone https://github.com/OSGeo/PROJ.git proj-git
- if "%PROJSOURCE%" == "git" rmdir /s /q %PROJ_DIR%
- if not "%PROJSOURCE%" == "git" if not exist %PROJ_DIR% set BUILD_PROJ_STABLE=1
- if defined BUILD_PROJ_STABLE curl -o "proj-%PROJSOURCE:~0,5%.zip" "https://download.osgeo.org/proj/proj-%PROJSOURCE%.zip"
- if defined BUILD_PROJ_STABLE 7z x -aoa -y "proj-%PROJSOURCE:~0,5%.zip"
- if not exist %PROJ_DIR% cd "%APPVEYOR_BUILD_FOLDER%\proj-%PROJSOURCE:~0,5%"
- if "%PROJSOURCE%" == "git" set BUILD_PROJ=1
- if defined BUILD_PROJ_STABLE set BUILD_PROJ=1
- if defined BUILD_PROJ mkdir build
- if defined BUILD_PROJ cd build
- if defined BUILD_PROJ cmake -GNinja .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS="%BUILD_SHARED_LIBS%" -DCMAKE_C_FLAGS="/WX" -DCMAKE_CXX_FLAGS="/WX" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX="%PROJ_DIR%"
- if defined BUILD_PROJ ninja -v
- if defined BUILD_PROJ ninja install
- set PATH=%PROJ_DIR%\bin;%PATH%
- set PROJ_LIB=%PROJ_DIR%\share\proj
- cd %APPVEYOR_BUILD_FOLDER%
- proj
# Build and install pyproj wheel
- python -m pip install -r requirements-dev.txt
- mkdir pyproj\proj_dir\share\proj
- copy %PROJ_LIB%\* pyproj\proj_dir\share\proj
- set PROJ_WHEEL=true
- python setup.py bdist_wheel
- FOR %%F IN (dist\*.whl) DO (set PYPROJ_WHEEL=%%F)
- delvewheel repair %PYPROJ_WHEEL%
- FOR %%F IN (wheelhouse\*.whl) DO (set PYPROJ_WHEEL=%%F)
- python -m pip install %PYPROJ_WHEEL%
install:
# Prepend newly installed Python to the PATH of this build
- SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%
- SET BASE_PATH=%PATH%
# Check that we have the expected version and architecture for Python
- python --version
- python -c "import struct; print(struct.calcsize('P') * 8)"
# install wheel, caching
- python -m pip install --disable-pip-version-check --user --upgrade pip
- python -m pip install wheel delvewheel
test_script:
# reset environment variables for test
- set PROJ_LIB=
- set PROJ_DIR=
- SET PATH=%BASE_PATH%
# run the project tests
- python -m pip install -r requirements-test.txt
- RD /S /Q pyproj\ # make sure src does not impact installed wheel
- python -c "import pyproj; pyproj.Proj('epsg:4269')"
- py.test --cov-report term-missing --cov=pyproj -v -s
# cleanup for test dir
- rmdir /s /q dist\ 2>nul
- if %PROJSOURCE% == git rmdir /s /q wheelhouse\ 2>nul
artifacts:
# Archive the generated packages in the ci.appveyor.com build report.
- path: wheelhouse\*
#on_success:
# - TODO: upload the content of dist/*.whl to a public wheelhouse
#
pyproj-3.3.0/ci/ 0000775 0000000 0000000 00000000000 14145330145 0013433 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/ci/proj-compile.sh 0000775 0000000 0000000 00000001512 14145330145 0016371 0 ustar 00root root 0000000 0000000 #!/bin/bash
pushd .
echo "Building PROJ ($1) from source..."
BUILD_PROJ_DIR=proj-${1:0:5}
# Download PROJ
if [[ $1 == "git" ]]; then
git clone https://github.com/OSGeo/PROJ.git ${BUILD_PROJ_DIR}
else
curl https://download.osgeo.org/proj/proj-$1.tar.gz > ${BUILD_PROJ_DIR}.tar.gz
tar zxf ${BUILD_PROJ_DIR}.tar.gz
rm ${BUILD_PROJ_DIR}.tar.gz
fi
cd ${BUILD_PROJ_DIR}
mkdir build
cd build
# build using cmake
cmake .. \
-DCMAKE_INSTALL_PREFIX=$PROJ_DIR \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_IPO=ON \
-DBUILD_CCT:BOOL=OFF \
-DBUILD_CS2CS:BOOL=OFF \
-DBUILD_GEOD:BOOL=OFF \
-DBUILD_GIE:BOOL=OFF \
-DBUILD_GMOCK:BOOL=OFF \
-DBUILD_PROJINFO:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF
cmake --build . -j$(nproc)
cmake --install .
# cleanup
cd ../..
rm -rf ${BUILD_PROJ_DIR}
popd
pyproj-3.3.0/codecov.yml 0000664 0000000 0000000 00000000243 14145330145 0015204 0 ustar 00root root 0000000 0000000 coverage:
status:
project:
default:
target: 94% # the required coverage value
threshold: 0.2% # the leniency in hitting the target
pyproj-3.3.0/docs/ 0000775 0000000 0000000 00000000000 14145330145 0013770 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/docs/Makefile 0000664 0000000 0000000 00000001140 14145330145 0015424 0 ustar 00root root 0000000 0000000 # Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python3 -msphinx
SPHINXPROJ = pyproj
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
pyproj-3.3.0/docs/advanced_examples.rst 0000664 0000000 0000000 00000022652 14145330145 0020174 0 ustar 00root root 0000000 0000000 .. _advanced_examples:
Advanced Examples
=================
Optimize Transformations
------------------------
Here are a few tricks to try out if you want to optimize your transformations.
Repeated transformations
~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 2.1.0
If you use the same transform, using the :class:`pyproj.transformer.Transformer` can help
optimize your transformations.
.. code-block:: python
import numpy as np
from pyproj import Transformer, transform
transformer = Transformer.from_crs(2263, 4326)
x_coords = np.random.randint(80000, 120000)
y_coords = np.random.randint(200000, 250000)
Example with :func:`pyproj.transformer.transform`:
.. code-block:: python
transform(2263, 4326, x_coords, y_coords)
Results: 160 ms ± 3.68 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Example with :class:`pyproj.transformer.Transformer`:
.. code-block:: python
transformer.transform(x_coords, y_coords)
Results: 6.32 µs ± 49.7 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
Transforming with the same projections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pyproj skips `noop` transformations.
Transformation Group
--------------------
.. versionadded:: 2.3.0
The :class:`pyproj.transformer.TransformerGroup` provides both available
transformations as well as missing transformations.
1. Helpful if you want to use an alternate transformation and have a good reason for it.
.. code-block:: python
>>> from pyproj.transformer import TransformerGroup
>>> trans_group = TransformerGroup("epsg:4326","epsg:2964")
>>> trans_group
- transformers: 8
- unavailable_operations: 1
>>> trans_group.best_available
True
>>> trans_group.transformers[0].transform(66, -153)
(149661.2825058747, 5849322.174897663)
>>> trans_group.transformers[1].transform(66, -153)
(149672.928811047, 5849311.372139239)
>>> trans_group.transformers[2].transform(66, -153)
(149748.32734832275, 5849274.621409136)
2. Helpful if want to check that the best possible transformation exists.
And if not, how to get the missing grid.
.. code-block:: python
>>> from pyproj.transformer import TransformerGroup
>>> tg = TransformerGroup("epsg:4326", "+proj=aea +lat_0=50 +lon_0=-154 +lat_1=55 +lat_2=65 +x_0=0 +y_0=0 +datum=NAD27 +no_defs +type=crs +units=m", always_xy=True)
UserWarning: Best transformation is not available due to missing Grid(short_name=ntv2_0.gsb, full_name=, package_name=proj-datumgrid-north-america, url=https://download.osgeo.org/proj/proj-datumgrid-north-america-latest.zip, direct_download=True, open_license=True, available=False)
f"{operation.grids[0]!r}"
>>> tg
- transformers: 37
- unavailable_operations: 41
>>> tg.transformers[0].description
'axis order change (2D) + Inverse of NAD27 to WGS 84 (3) + axis order change (2D) + unknown'
>>> tg.unavailable_operations[0].name
'Inverse of NAD27 to WGS 84 (33) + axis order change (2D) + unknown'
>>> tg.unavailable_operations[0].grids[0].url
'https://download.osgeo.org/proj/proj-datumgrid-north-america-latest.zip'
Area of Interest
----------------
.. versionadded:: 2.3.0
Depending on the location of your transformation, using the area of interest may impact
which transformation operation is selected in the transformation.
.. code-block:: python
>>> from pyproj.transformer import Transformer, AreaOfInterest
>>> transformer = Transformer.from_crs("epsg:4326", "epsg:2694")
>>> transformer
Description: Inverse of Pulkovo 1995 to WGS 84 (2) + 3-degree Gauss-Kruger zone 60
Area of Use:
- name: Russia
- bounds: (18.92, 39.87, -168.97, 85.2)
>>> transformer = Transformer.from_crs(
... "epsg:4326",
... "epsg:2694",
... area_of_interest=AreaOfInterest(-136.46, 49.0, -60.72, 83.17),
... )
>>> transformer
Description: Inverse of NAD27 to WGS 84 (13) + Alaska Albers
Area of Use:
- name: Canada - NWT; Nunavut; Saskatchewan
- bounds: (-136.46, 49.0, -60.72, 83.17)
Promote CRS to 3D
-------------------
.. versionadded:: 3.1
In PROJ 6+ you neeed to explictly change your CRS to 3D if you have
2D CRS and you want the ellipsoidal height taken into account.
.. code-block:: python
>>> from pyproj import CRS, Transformer
>>> transformer = Transformer.from_crs("EPSG:4326", "EPSG:2056", always_xy=True)
>>> transformer.transform(8.37909, 47.01987, 1000)
(2671499.8913080636, 1208075.1135782297, 1000.0)
>>> transformer_3d = Transformer.from_crs(
... CRS("EPSG:4326").to_3d(),
... CRS("EPSG:2056").to_3d(),
... always_xy=True,
...)
>>> transformer_3d.transform(8.37909, 47.01987, 1000)
(2671499.8913080636, 1208075.1135782297, 951.4265527743846)
Projected CRS Bounds
----------------------
.. versionadded:: 3.1
The boundary of the CRS is given in geographic coordinates.
This is the recommended method for calculating the projected bounds.
.. code-block:: python
>>> from pyproj import CRS, Transformer
>>> crs = CRS("EPSG:3857")
>>> transformer = Transformer.from_crs(crs.geodetic_crs, crs, always_xy=True)
>>> transformer.transform_bounds(*crs.area_of_use.bounds)
(-20037508.342789244, -20048966.104014594, 20037508.342789244, 20048966.104014594)
Multithreading
--------------
As of version 3.1, these objects are thread-safe:
- :class:`pyproj.crs.CRS`
- :class:`pyproj.transformer.Transformer`
If you have pyproj<3.1, you will need to create create the object
within the thread that uses it.
Here is a simple demonstration:
.. code-block:: python
import concurrent.futures
from pyproj import Transformer
def transform_point(point):
transformer = Transformer.from_crs(4326, 3857)
return transformer.transform(point, point * 2)
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
for result in executor.map(transform_point, range(5)):
print(result)
Optimizing Single-Threaded Applications
----------------------------------------
If you have a single-threaded application that generates many objects,
enabling the use of the global context can provide performance enhancements.
For information about using the global context, see: :ref:`global_context`
Here is an example where enabling the global context can help:
.. code-block:: python
import pyproj
codes = pyproj.get_codes("EPSG", pyproj.enums.PJType.PROJECTED_CRS, False)
crs_list = [pyproj.CRS.from_epsg(code) for code in codes]
Caching pyproj objects
-----------------------
If you are likely to re-create pyproj objects such as :class:`pyproj.transformer.Transformer`
or :class:`pyproj.crs.CRS`, using a cache can help reduce the cost
of re-creating the objects.
Transformer
~~~~~~~~~~~~
.. code-block:: python
from functools import lru_cache
from pyproj import Transformer
TransformerFromCRS = lru_cache(Transformer.from_crs)
Transformer.from_crs(2263, 4326) # no cache
TransformerFromCRS(2263, 4326) # cache
Try it:
.. code-block:: python
from timeit import timeit
timeit(
"CachedTransformer(2263, 4326)",
setup=(
"from pyproj import Transformer; "
"from functools import lru_cache; "
"CachedTransformer = lru_cache(Transformer.from_crs)"
),
number=1000000,
)
timeit(
"Transformer.from_crs(2263, 4326)",
setup=("from pyproj import Transformer"),
number=100,
)
Without the cache, it takes around 2 seconds to do 100 iterations. With the cache,
it takes 0.1 seconds to do 1 million iterations.
CRS Example
~~~~~~~~~~~~
.. code-block:: python
from functools import lru_cache
from pyproj import CRS
CachedCRS = lru_cache(CRS)
crs = CRS(4326) # no cache
crs = CachedCRS(4326) # cache
Try it:
.. code-block:: python
from timeit import timeit
timeit(
"CachedCRS(4326)",
setup=(
"from pyproj import CRS; "
"from functools import lru_cache; "
"CachedCRS = lru_cache(CRS)"
),
number=1000000,
)
timeit(
"CRS(4326)",
setup=("from pyproj import CRS"),
number=1000,
)
Without the cache, it takes around 1 seconds to do 1000 iterations. With the cache,
it takes 0.1 seconds to do 1 million iterations.
.. _debugging-internal-proj:
Debugging Internal PROJ
------------------------
.. versionadded:: 3.0.0
To get more debugging information from the internal PROJ code:
1. Set the :envvar:`PROJ_DEBUG`
environment variable to the desired level.
2. Activate logging in `pyproj` with the devel `DEBUG`:
More information available here: https://docs.python.org/3/howto/logging.html
Here are examples to get started.
Add handler to the `pyproj` logger:
.. code-block:: python
import logging
console_handler = logging.StreamHandler()
formatter = logging.Formatter("%(levelname)s:%(message)s")
console_handler.setFormatter(formatter)
logger = logging.getLogger("pyproj")
logger.addHandler(console_handler)
logger.setLevel(logging.DEBUG)
Activate default logging config:
.. code-block:: python
import logging
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)
pyproj-3.3.0/docs/api/ 0000775 0000000 0000000 00000000000 14145330145 0014541 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/docs/api/aoi.rst 0000664 0000000 0000000 00000000626 14145330145 0016047 0 ustar 00root root 0000000 0000000 Area of Interest
==================
pyproj.aoi.AreaOfInterest
--------------------------
.. note:: The backwards compatible import is `pyproj.transformer.AreaOfInterest`
.. autoclass:: pyproj.aoi.AreaOfInterest
:members:
pyproj.aoi.AreaOfUse
---------------------
.. autoclass:: pyproj.aoi.AreaOfUse
:members:
pyproj.aoi.BBox
-----------------
.. autoclass:: pyproj.aoi.BBox
:members:
pyproj-3.3.0/docs/api/crs/ 0000775 0000000 0000000 00000000000 14145330145 0015330 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/docs/api/crs/coordinate_operation.rst 0000664 0000000 0000000 00000012026 14145330145 0022272 0 ustar 00root root 0000000 0000000 .. _coordinate_operation:
Coordinate Operations
=====================
CoordinateOperation
--------------------
.. autoclass:: pyproj.crs.CoordinateOperation
:members:
:inherited-members:
Param
------
.. autoclass:: pyproj._crs.Param
:members:
Grid
----
.. autoclass:: pyproj._crs.Grid
:members:
AlbersEqualAreaConversion
---------------------------
.. autoclass:: pyproj.crs.coordinate_operation.AlbersEqualAreaConversion
:members:
:show-inheritance:
:special-members: __new__
AzimuthalEquidistantConversion
-------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.AzimuthalEquidistantConversion
:members:
:show-inheritance:
:special-members: __new__
EquidistantCylindricalConversion
--------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.EquidistantCylindricalConversion
:members:
:show-inheritance:
:special-members: __new__
GeostationarySatelliteConversion
--------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.GeostationarySatelliteConversion
:members:
:show-inheritance:
:special-members: __new__
LambertAzimuthalEqualAreaConversion
-----------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.LambertAzimuthalEqualAreaConversion
:members:
:show-inheritance:
:special-members: __new__
LambertConformalConic1SPConversion
-----------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.LambertConformalConic1SPConversion
:members:
:show-inheritance:
:special-members: __new__
LambertConformalConic2SPConversion
-----------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.LambertConformalConic2SPConversion
:members:
:show-inheritance:
:special-members: __new__
LambertCylindricalEqualAreaConversion
-------------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.LambertCylindricalEqualAreaConversion
:members:
:show-inheritance:
:special-members: __new__
.. autoclass:: pyproj.crs.coordinate_operation.LambertCylindricalEqualAreaScaleConversion
:members:
:show-inheritance:
:special-members: __new__
MercatorAConversion
--------------------
.. autoclass:: pyproj.crs.coordinate_operation.MercatorAConversion
:members:
:show-inheritance:
:special-members: __new__
MercatorBConversion
-------------------
.. autoclass:: pyproj.crs.coordinate_operation.MercatorBConversion
:members:
:show-inheritance:
:special-members: __new__
HotineObliqueMercatorBConversion
---------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.HotineObliqueMercatorBConversion
:members:
:show-inheritance:
:special-members: __new__
OrthographicConversion
-----------------------
.. autoclass:: pyproj.crs.coordinate_operation.OrthographicConversion
:members:
:show-inheritance:
:special-members: __new__
PlateCarreeConversion
--------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.PlateCarreeConversion
:members:
:show-inheritance:
:special-members: __new__
PolarStereographicAConversion
-----------------------------
.. autoclass:: pyproj.crs.coordinate_operation.PolarStereographicAConversion
:members:
:show-inheritance:
:special-members: __new__
PolarStereographicBConversion
-----------------------------
.. autoclass:: pyproj.crs.coordinate_operation.PolarStereographicBConversion
:members:
:show-inheritance:
:special-members: __new__
SinusoidalConversion
---------------------
.. autoclass:: pyproj.crs.coordinate_operation.SinusoidalConversion
:members:
:show-inheritance:
:special-members: __new__
StereographicConversion
------------------------
.. autoclass:: pyproj.crs.coordinate_operation.StereographicConversion
:members:
:show-inheritance:
:special-members: __new__
UTMConversion
-------------
.. autoclass:: pyproj.crs.coordinate_operation.UTMConversion
:members:
:show-inheritance:
:special-members: __new__
TransverseMercatorConversion
----------------------------
.. autoclass:: pyproj.crs.coordinate_operation.TransverseMercatorConversion
:members:
:show-inheritance:
:special-members: __new__
VerticalPerspectiveConversion
-----------------------------
.. autoclass:: pyproj.crs.coordinate_operation.VerticalPerspectiveConversion
:members:
:show-inheritance:
:special-members: __new__
RotatedLatitudeLongitudeConversion
----------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.RotatedLatitudeLongitudeConversion
:members:
:show-inheritance:
:special-members: __new__
PoleRotationNetCDFCFConversion
----------------------------------
.. autoclass:: pyproj.crs.coordinate_operation.PoleRotationNetCDFCFConversion
:members:
:show-inheritance:
:special-members: __new__
ToWGS84Transformation
---------------------
.. autoclass:: pyproj.crs.coordinate_operation.ToWGS84Transformation
:members:
:show-inheritance:
:special-members: __new__
pyproj-3.3.0/docs/api/crs/coordinate_system.rst 0000664 0000000 0000000 00000001701 14145330145 0021614 0 ustar 00root root 0000000 0000000 .. _coordinate_system:
Coordinate Systems
==================
CoordinateSystem
------------------------
.. autoclass:: pyproj.crs.CoordinateSystem
:members:
:inherited-members:
Axis
------------------------
.. autoclass:: pyproj._crs.Axis
:members:
:inherited-members:
Ellipsoidal2DCS
------------------------
.. autoclass:: pyproj.crs.coordinate_system.Ellipsoidal2DCS
:members:
:show-inheritance:
:special-members: __new__
Ellipsoidal3DCS
------------------------
.. autoclass:: pyproj.crs.coordinate_system.Ellipsoidal3DCS
:members:
:show-inheritance:
:special-members: __new__
Cartesian2DCS
------------------------
.. autoclass:: pyproj.crs.coordinate_system.Cartesian2DCS
:members:
:show-inheritance:
:special-members: __new__
VerticalCS
------------------------
.. autoclass:: pyproj.crs.coordinate_system.VerticalCS
:members:
:show-inheritance:
:special-members: __new__
pyproj-3.3.0/docs/api/crs/crs.rst 0000664 0000000 0000000 00000002666 14145330145 0016663 0 ustar 00root root 0000000 0000000 .. _crs:
CRS
===
CRS
----
.. autoclass:: pyproj.crs.CRS
:members:
:inherited-members:
:special-members: __init__
GeographicCRS
------------------------
.. autoclass:: pyproj.crs.GeographicCRS
:members:
:show-inheritance:
:special-members: __init__
DerivedGeographicCRS
------------------------
.. autoclass:: pyproj.crs.DerivedGeographicCRS
:members:
:show-inheritance:
:special-members: __init__
GeocentricCRS
------------------------
.. autoclass:: pyproj.crs.GeocentricCRS
:members:
:show-inheritance:
:special-members: __init__
ProjectedCRS
-----------------------
.. autoclass:: pyproj.crs.ProjectedCRS
:members:
:show-inheritance:
:special-members: __init__
VerticalCRS
-----------------------
.. autoclass:: pyproj.crs.VerticalCRS
:members:
:show-inheritance:
:special-members: __init__
BoundCRS
-----------------------
.. autoclass:: pyproj.crs.BoundCRS
:members:
:show-inheritance:
:special-members: __init__
CompoundCRS
-----------------------
.. autoclass:: pyproj.crs.CompoundCRS
:members:
:show-inheritance:
:special-members: __init__
CustomConstructorCRS
------------------------
.. autoclass:: pyproj.crs.CustomConstructorCRS
:members:
:show-inheritance:
:special-members: __init__
is_wkt
-----------------
.. autofunction:: pyproj.crs.is_wkt
is_proj
------------------
.. autofunction:: pyproj.crs.is_proj
pyproj-3.3.0/docs/api/crs/datum.rst 0000664 0000000 0000000 00000001775 14145330145 0017206 0 ustar 00root root 0000000 0000000 .. _datum:
Datum
=====
.. note:: PROJ >= 7.0.0 will have better support for aliases for datum names.
Until then, you will need to use the full name of the datum. There is support
currently for the old PROJ names for datums such as WGS84 and NAD83.
Datum
---------
.. autoclass:: pyproj.crs.Datum
:members:
:inherited-members:
CustomDatum
------------
.. autoclass:: pyproj.crs.datum.CustomDatum
:members:
:show-inheritance:
:special-members: __new__
Ellipsoid
----------
.. autoclass:: pyproj.crs.Ellipsoid
:members:
:inherited-members:
CustomEllipsoid
----------------
.. autoclass:: pyproj.crs.datum.CustomEllipsoid
:members:
:show-inheritance:
:special-members: __new__
PrimeMeridian
--------------
.. autoclass:: pyproj.crs.PrimeMeridian
:members:
:inherited-members:
CustomPrimeMeridian
--------------------
.. autoclass:: pyproj.crs.datum.CustomPrimeMeridian
:members:
:show-inheritance:
:special-members: __new__
pyproj-3.3.0/docs/api/crs/enums.rst 0000664 0000000 0000000 00000001205 14145330145 0017207 0 ustar 00root root 0000000 0000000 Enumerations
============
DatumType
----------
.. autoclass:: pyproj.crs.enums.DatumType
:members:
CoordinateOperationType
------------------------
.. autoclass:: pyproj.crs.enums.CoordinateOperationType
:members:
Cartesian2DCSAxis
------------------
.. autoclass:: pyproj.crs.enums.Cartesian2DCSAxis
:members:
Ellipsoidal2DCSAxis
--------------------
.. autoclass:: pyproj.crs.enums.Ellipsoidal2DCSAxis
:members:
Ellipsoidal3DCSAxis
--------------------
.. autoclass:: pyproj.crs.enums.Ellipsoidal3DCSAxis
:members:
VerticalCSAxis
---------------
.. autoclass:: pyproj.crs.enums.VerticalCSAxis
:members:
pyproj-3.3.0/docs/api/crs/index.rst 0000664 0000000 0000000 00000000266 14145330145 0017175 0 ustar 00root root 0000000 0000000 CRS module API Documentation
============================
.. toctree::
:maxdepth: 2
:caption: Contents:
crs
coordinate_system
coordinate_operation
datum
enums
pyproj-3.3.0/docs/api/database.rst 0000664 0000000 0000000 00000002066 14145330145 0017043 0 ustar 00root root 0000000 0000000 .. _database:
Database
=========
Methods that query the PROJ database for information.
pyproj.database.get_units_map
-----------------------------
.. note:: The backwards compatible import is `pyproj.get_units_map`
.. autofunction:: pyproj.database.get_units_map
.. autoclass:: pyproj.database.Unit
pyproj.database.get_authorities
--------------------------------
.. note:: The backwards compatible import is `pyproj.get_authorities`
.. autofunction:: pyproj.database.get_authorities
pyproj.database.get_codes
--------------------------
.. note:: The backwards compatible import is `pyproj.get_codes`
.. autofunction:: pyproj.database.get_codes
pyproj.database.query_crs_info
-------------------------------
.. autofunction:: pyproj.database.query_crs_info
.. autoclass:: pyproj.database.CRSInfo
pyproj.database.query_utm_crs_info
-----------------------------------
.. autofunction:: pyproj.database.query_utm_crs_info
pyproj.database.get_database_metadata
---------------------------------------
.. autofunction:: pyproj.database.get_database_metadata
pyproj-3.3.0/docs/api/datadir.rst 0000664 0000000 0000000 00000000760 14145330145 0016706 0 ustar 00root root 0000000 0000000 .. _data_directory:
Data Directory
===============
pyproj.datadir.get_data_dir
---------------------------
.. autofunction:: pyproj.datadir.get_data_dir
pyproj.datadir.set_data_dir
---------------------------
.. autofunction:: pyproj.datadir.set_data_dir
pyproj.datadir.append_data_dir
------------------------------
.. autofunction:: pyproj.datadir.append_data_dir
pyproj.datadir.get_user_data_dir
---------------------------------
.. autofunction:: pyproj.datadir.get_user_data_dir
pyproj-3.3.0/docs/api/enums.rst 0000664 0000000 0000000 00000000472 14145330145 0016425 0 ustar 00root root 0000000 0000000 Enumerations
============
.. autoclass:: pyproj.enums.WktVersion
:members:
.. autoclass:: pyproj.enums.ProjVersion
:members:
.. autoclass:: pyproj.enums.TransformDirection
:members:
.. autoclass:: pyproj.enums.PJType
:members:
.. autoclass:: pyproj.enums.GeodIntermediateFlag
:members:
pyproj-3.3.0/docs/api/exceptions.rst 0000664 0000000 0000000 00000000107 14145330145 0017452 0 ustar 00root root 0000000 0000000 Exceptions
==========
.. automodule:: pyproj.exceptions
:members:
pyproj-3.3.0/docs/api/geod.rst 0000664 0000000 0000000 00000000334 14145330145 0016211 0 ustar 00root root 0000000 0000000 Geod
====
pyproj.Geod
-----------
.. autoclass:: pyproj.Geod
:members:
:show-inheritance:
:inherited-members:
:special-members: __init__
.. autoclass:: pyproj.geod.GeodIntermediateReturn
:members:
pyproj-3.3.0/docs/api/global_context.rst 0000664 0000000 0000000 00000001236 14145330145 0020301 0 ustar 00root root 0000000 0000000 .. _global_context:
Global Context
==============
If you have a single-threaded application that generates many objects,
enabling the use of the global context can provide performance enhancements.
.. warning:: The global context is not thread safe.
.. warning:: The global context maintains a connection to the database
through the duration of each python session and is closed
once the program terminates.
How to enable:
- Using :func:`pyproj.set_use_global_context`.
- Using the environment variable `PYPROJ_GLOBAL_CONTEXT`.
pyproj.set_use_global_context
-----------------------------
.. autofunction:: pyproj.set_use_global_context
pyproj-3.3.0/docs/api/index.rst 0000664 0000000 0000000 00000000371 14145330145 0016403 0 ustar 00root root 0000000 0000000 API Documentation
=================
.. toctree::
:maxdepth: 2
:caption: Contents:
crs/index
transformer
geod
proj
database
list
datadir
network
sync
global_context
enums
aoi
exceptions
show_versions
pyproj-3.3.0/docs/api/list.rst 0000664 0000000 0000000 00000001126 14145330145 0016246 0 ustar 00root root 0000000 0000000 Lists
=====
pyproj.list.get_proj_operations_map
-----------------------------------
.. note:: The backwards compatible import is `pyproj.get_proj_operations_map`
.. autofunction:: pyproj.list.get_proj_operations_map
pyproj.list.get_ellps_map
--------------------------
.. note:: The backwards compatible import is `pyproj.get_ellps_map`
.. autofunction:: pyproj.list.get_ellps_map
pyproj.list.get_prime_meridians_map
------------------------------------
.. note:: The backwards compatible import is `pyproj.get_prime_meridians_map`
.. autofunction:: pyproj.list.get_prime_meridians_map
pyproj-3.3.0/docs/api/network.rst 0000664 0000000 0000000 00000000666 14145330145 0016774 0 ustar 00root root 0000000 0000000 .. _network_api:
PROJ Network Settings
======================
pyproj.network.set_network_enabled
-----------------------------------
.. autofunction:: pyproj.network.set_network_enabled
pyproj.network.is_network_enabled
----------------------------------
.. autofunction:: pyproj.network.is_network_enabled
pyproj.network.set_ca_bundle_path
----------------------------------
.. autofunction:: pyproj.network.set_ca_bundle_path
pyproj-3.3.0/docs/api/proj.rst 0000664 0000000 0000000 00000000740 14145330145 0016246 0 ustar 00root root 0000000 0000000 Proj
====
`pyproj.Proj` is functionally equivalent to the `proj` command line tool in PROJ.
The PROJ docs say::
The `proj` program is limited to converting between geographic and
projection coordinates within one datum.
pyproj.Proj
-----------
.. autoclass:: pyproj.Proj
:members:
:inherited-members:
:special-members: __init__, __call__
:show-inheritance:
pyproj.proj.Factors
-------------------
.. autoclass:: pyproj.proj.Factors
:members:
pyproj-3.3.0/docs/api/show_versions.rst 0000664 0000000 0000000 00000000157 14145330145 0020206 0 ustar 00root root 0000000 0000000 Show Versions
=============
pyproj.show_versions
--------------------
.. autofunction:: pyproj.show_versions
pyproj-3.3.0/docs/api/sync.rst 0000664 0000000 0000000 00000000445 14145330145 0016252 0 ustar 00root root 0000000 0000000 Sync Transformation Grids
=========================
pyproj.sync.get_transform_grid_list
------------------------------------
.. autofunction:: pyproj.sync.get_transform_grid_list
pyproj.sync.get_proj_endpoint
------------------------------
.. autofunction:: pyproj.sync.get_proj_endpoint
pyproj-3.3.0/docs/api/transformer.rst 0000664 0000000 0000000 00000002471 14145330145 0017641 0 ustar 00root root 0000000 0000000 .. _transformer:
Transformer
===========
The `pyproj.Transformer` has the capabilities of performing 2D, 3D, and 4D (time)
transformations. It can do anything that the PROJ command line programs
:ref:`proj`, :ref:`cs2cs`, and :ref:`cct` can do.
This means that it allows translation between any pair of definable coordinate systems,
including support for datum transformation.
.. warning:: The axis order may be swapped if the source and destination
CRS's are defined as having the first coordinate component point in a
northerly direction (See PROJ FAQ on
`axis order `_).
You can check the axis order with the :class:`pyproj.crs.CRS` class. If you prefer to
keep your axis order as always x,y, you can use the `always_xy` option when
creating the :class:`pyproj.transformer.Transformer`.
pyproj.Transformer
------------------
.. autoclass:: pyproj.transformer.Transformer
:members:
pyproj.transformer.TransformerGroup
-----------------------------------
.. autoclass:: pyproj.transformer.TransformerGroup
:members:
:special-members: __init__
pyproj.transform
----------------
.. autofunction:: pyproj.transformer.transform
pyproj.itransform
-----------------
.. autofunction:: pyproj.transformer.itransform
pyproj-3.3.0/docs/build_crs.rst 0000664 0000000 0000000 00000012326 14145330145 0016474 0 ustar 00root root 0000000 0000000 Building a Coordinate Reference System
======================================
.. versionadded:: 2.5.0
PROJ strings have the potential to lose much of the information
about a coordinate reference system (CRS).
More information: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
However, PROJ strings make it really simple to construct a CRS.
This addition is meant to simplify the process of transitioning
from the PROJ form of the string to the WKT form WKT. The CRS
classes can be used in the :meth:`pyproj.transformer.Transformer.from_crs`
method just like the :class:`pyproj.crs.CRS` class.
The current set of classes does not cover every possible use case,
but hopefully it is enough to get you started.
If you notice something is missing that you need, feel free to open an issue on GitHub.
Here are links to the API docs for the pieces you need to get started:
- :ref:`crs`
- :ref:`coordinate_operation`
- :ref:`datum`
- :ref:`coordinate_system`
Geographic CRS
--------------
This is a simple example of creating a lonlat projection.
PROJ string::
+proj=longlat +datum=WGS84 +no_defs
.. code-block:: python
from pyproj.crs import GeographicCRS
geog_crs = GeographicCRS()
geog_wkt = geog_crs.to_wkt()
This example is meant to show off different initialization methods.
It can be simplified to not use the Ellipsoid or PrimeMeridian objects.
PROJ string::
+proj=longlat +ellps=airy +pm=lisbon +no_defs
.. code-block:: python
from pyproj.crs import Ellipsoid, GeographicCRS, PrimeMeridian
from pyproj.crs.datum import CustomDatum
cd = CustomDatum(
ellipsoid=Ellipsoid.from_epsg(7001),
prime_meridian=PrimeMeridian.from_name("Lisbon"),
)
geog_crs = GeographicCRS(datum=cd)
geog_wkt = geog_crs.to_wkt()
Projected CRS
-------------
Simple example using defaults.
PROJ string::
+proj=aea +lat_0=0 +lon_0=0 +lat_1=0 +lat_2=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
.. code-block:: python
from pyproj.crs import ProjectedCRS
from pyproj.crs.coordinate_operation import AlbersEqualAreaConversion
aeaop = AlbersEqualAreaConversion(0, 0)
proj_crs = ProjectedCRS(conversion=aeaop)
crs_wkt = proj_crs.to_wkt()
More complex example with custom parameters.
PROJ string::
+proj=utm +zone=14 +a=6378137 +b=6356752 +pm=lisbon +units=m +no_defs
.. code-block:: python
from pyproj.crs import GeographicCRS, ProjectedCRS
from pyproj.crs.coordinate_operation import UTMConversion
from pyproj.crs.datum import CustomDatum, CustomEllipsoid
ell = CustomEllipsoid(semi_major_axis=6378137, semi_minor_axis=6356752)
cd = CustomDatum(ellipsoid=ell, prime_meridian="Lisbon")
proj_crs = ProjectedCRS(
conversion=UTMConversion(14), geodetic_crs=GeographicCRS(datum=cd)
)
crs_wkt = proj_crs.to_wkt()
Bound CRS
---------
This is an example building a CRS with `towgs84`.
PROJ string::
+proj=tmerc +lat_0=0 +lon_0=15 +k=0.9996 +x_0=2520000 +y_0=0 +ellps=intl +towgs84=-122.74,-34.27,-22.83,-1.884,-3.4,-3.03,-15.62 +units=m +no_defs
.. code-block:: python
from pyproj.crs import BoundCRS, Ellipsoid, GeographicCRS, ProjectedCRS
from pyproj.crs.coordinate_operation import (
TransverseMercatorConversion,
ToWGS84Transformation,
)
from pyproj.crs.datum import CustomDatum
import pyproj
proj_crs = ProjectedCRS(
conversion=TransverseMercatorConversion(
latitude_natural_origin=0,
longitude_natural_origin=15,
false_easting=2520000,
false_northing=0,
scale_factor_natural_origin=0.9996,
),
geodetic_crs=GeographicCRS(
datum=CustomDatum(ellipsoid="International 1924 (Hayford 1909, 1910)")
),
)
bound_crs = BoundCRS(
source_crs=proj_crs,
target_crs="WGS 84",
transformation=ToWGS84Transformation(
proj_crs.geodetic_crs, -122.74, -34.27, -22.83, -1.884, -3.4, -3.03, -15.62
),
)
crs_wkt = bound_crs.to_wkt()
Compound CRS
-------------
The PROJ string is quite lossy in this example, so it is not provided.
.. code-block:: python
from pyproj.crs import CompoundCRS, GeographicCRS, ProjectedCRS, VerticalCRS
from pyproj.crs.coordinate_system import Cartesian2DCS, VerticalCS
from pyproj.crs.coordinate_operation import LambertConformalConic2SPConversion
vertcrs = VerticalCRS(
name="NAVD88 height",
datum="North American Vertical Datum 1988",
vertical_cs=VerticalCS(),
geoid_model="GEOID12B",
)
projcrs = ProjectedCRS(
name="NAD83 / Pennsylvania South",
conversion=LambertConformalConic2SPConversion(
latitude_false_origin=39.3333333333333,
longitude_false_origin=-77.75,
latitude_first_parallel=40.9666666666667,
latitude_second_parallel=39.9333333333333,
easting_false_origin=600000,
northing_false_origin=0,
),
geodetic_crs=GeographicCRS(datum="North American Datum 1983"),
cartesian_cs=Cartesian2DCS(),
)
compcrs = CompoundCRS(
name="NAD83 / Pennsylvania South + NAVD88 height", components=[projcrs, vertcrs]
)
crs_wkt = compcrs.to_wkt()
pyproj-3.3.0/docs/build_crs_cf.rst 0000664 0000000 0000000 00000013155 14145330145 0017145 0 ustar 00root root 0000000 0000000 .. _build_crs_cf:
Managing CRS to and from CF
============================
http://cfconventions.org/cf-conventions/cf-conventions.html
Exporting CRS to CF
--------------------
When exporting a CRS to the Climate and Forecast (CF) conventions,
you need both the grid mapping as well as the coordinate system.
If you don't use the coordinate system, then you will lose the units
of your projection.
In this example, this is the CRS we will use:
.. code-block:: python
from pyproj import CRS
crs = CRS("EPSG:4326")
To get the grid mapping you use :meth:`pyproj.crs.CRS.to_cf`:
.. versionadded:: 2.2.0
.. code-block:: python
cf_grid_mapping = crs.to_cf()
Contents of `cf_grid_mapping`::
{'crs_wkt': 'GEOGCRS["WGS 84",DATUM["World Geodetic System '
....,ID["EPSG",4326]]',
'geographic_crs_name': 'WGS 84',
'grid_mapping_name': 'latitude_longitude',
'inverse_flattening': 298.257223563,
'longitude_of_prime_meridian': 0.0,
'prime_meridian_name': 'Greenwich',
'reference_ellipsoid_name': 'WGS 84',
'semi_major_axis': 6378137.0,
'semi_minor_axis': 6356752.314245179}
To get the coordinate system, you use :meth:`pyproj.crs.CRS.cs_to_cf`:
.. versionadded:: 3.0.0
.. code-block:: python
cf_coordinate_system = crs.cs_to_cf()
Contents of `cf_coordinate_system`::
[{'long_name': 'geodetic latitude coordinate',
'standard_name': 'latitude',
'units': 'degrees_north',
'axis': 'Y'},
{'long_name': 'geodetic longitude coordinate',
'standard_name': 'longitude',
'units': 'degrees_east',
'axis': 'X'}]
Importing CRS from CF
----------------------
When importing a CRS from the Climate and Forecast (CF) conventions,
you need both the grid mapping as well as the coordinate system.
If you don't use the coordinate system, then you will lose the units
of your projection.
.. note:: If the CF `crs_wkt` attribute is available, the coordinate system is
inside of the WKT and can be used to create the CRS in a single step.
.. warning:: If building from grid mapping, be mindful of the axis order. https://github.com/cf-convention/cf-conventions/pull/224
Build the CRS from CF grid mapping:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this example, this is the grid mapping and coordinate system we will use::
variables:
double x(x) ;
x:standard_name = "projection_x_coordinate" ;
x:long_name = "Easting" ;
x:units = "m" ;
double y(y) ;
y:standard_name = "projection_y_coordinate" ;
y:long_name = "Northing" ;
y:units = "m" ;
int crsOSGB ;
crsOSGB:grid_mapping_name = "transverse_mercator";
crsOSGB:semi_major_axis = 6377563.396 ;
crsOSGB:inverse_flattening = 299.3249646 ;
crsOSGB:longitude_of_prime_meridian = 0.0 ;
crsOSGB:latitude_of_projection_origin = 49.0 ;
crsOSGB:longitude_of_central_meridian = -2.0 ;
crsOSGB:scale_factor_at_central_meridian = 0.9996012717 ;
crsOSGB:false_easting = 400000.0 ;
crsOSGB:false_northing = -100000.0 ;
.. note:: If the units are meters as in this example,
then no further changes are necessary.
.. code-block:: python
from pyproj import CRS
crs = CRS.from_cf(
{
"grid_mapping_name": "transverse_mercator",
"semi_major_axis": 6377563.396,
"inverse_flattening": 299.3249646,
"longitude_of_prime_meridian": 0.0,
"latitude_of_projection_origin": 49.0,
"longitude_of_central_meridian": -2.0,
"scale_factor_at_central_meridian": 0.9996012717,
"false_easting": 400000.0,
"false_northing": -100000.0,
}
)
Modify the CRS with coordinate system:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 3.0.0
.. note:: If the CF `crs_wkt` attribute is available, the coordinate system is
inside of the WKT and can be used to create the CRS in a single step.
.. warning:: Be mindful of the axis order. https://github.com/cf-convention/cf-conventions/pull/224
In this example, assume everything is the same as above.
However, the units are instead `US_Survey_Foot`::
variables:
double x(x) ;
x:standard_name = "projection_x_coordinate" ;
x:long_name = "Easting" ;
x:units = "US_Survey_Foot" ;
double y(y) ;
y:standard_name = "projection_y_coordinate" ;
y:long_name = "Northing" ;
y:units = "US_Survey_Foot" ;
...
In this case, you will need to get the unit conversion factor:
https://github.com/SciTools/cf-units
.. code-block:: python
from cf_units import Unit
from pyproj import CRS
cf_unit = Unit("US_Survey_Foot")
unit = {
"type": "LinearUnit",
"name": "US Survey Foot",
"conversion_factor": cf_unit.convert(1, "m"),
}
cartesian_cs = {
"$schema": "https://proj.org/schemas/v0.2/projjson.schema.json",
"type": "CoordinateSystem",
"subtype": "Cartesian",
"axis": [
{"name": "Easting", "abbreviation": "E", "direction": "east", "unit": unit},
{"name": "Northing", "abbreviation": "N", "direction": "north", "unit": unit},
],
}
crs = CRS.from_cf(
{
"grid_mapping_name": "transverse_mercator",
"semi_major_axis": 6377563.396,
"inverse_flattening": 299.3249646,
"longitude_of_prime_meridian": 0.0,
"latitude_of_projection_origin": 49.0,
"longitude_of_central_meridian": -2.0,
"scale_factor_at_central_meridian": 0.9996012717,
"false_easting": 400000.0,
"false_northing": -100000.0,
},
cartesian_cs=cartesian_cs,
)
pyproj-3.3.0/docs/cli.rst 0000664 0000000 0000000 00000000111 14145330145 0015262 0 ustar 00root root 0000000 0000000 CLI
====
.. argparse::
:ref: pyproj.__main__.parser
:prog: pyproj
pyproj-3.3.0/docs/conf.py 0000775 0000000 0000000 00000011750 14145330145 0015276 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
#
# pyproj documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#
import os
import sys
import pyproj
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ---------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx.ext.intersphinx",
"sphinxarg.ext",
]
intersphinx_mapping = {
"proj": ("https://proj.org/", None),
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "pyproj"
copyright = "2006-2018, Jeffrey Whitaker; 2019-2021, Open source contributors"
author = "Jeffrey Whitaker"
# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
# the built documents.
#
# The short X.Y version.
version = pyproj.__version__
# The full version, including alpha/beta/rc tags.
release = pyproj.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output -------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_logo = "media/logo.png"
html_favicon = "media/icon.png"
# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
"style_nav_header_background": "#353130",
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ["_static"]
# -- Options for HTMLHelp output ---------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = "pyprojdoc"
# -- Options for LaTeX output ------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, "pyproj.tex", "pyproj Documentation", "Delta", "manual")
]
# -- Options for manual page output ------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [("cli", "pyproj", "pyproj CLI", [author], 1)]
# -- Options for Texinfo output ----------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
"pyproj",
"pyproj Documentation",
author,
"pyproj",
"One line description of project.",
"Miscellaneous",
)
]
pyproj-3.3.0/docs/crs_compatibility.rst 0000664 0000000 0000000 00000016532 14145330145 0020251 0 ustar 00root root 0000000 0000000 CRS Compatibility Guide for Geospatial Python
==============================================
This is meant to be a guide to help you along the way of you use :class:`pyproj.crs.CRS`
with other Python Geospatial libraries.
.. note:: WKT2 is the best format for storing your CRS according to the
`PROJ FAQ `__.
osgeo/gdal
----------
https://github.com/osgeo/gdal
Converting from `osgeo.osr.SpatialReference` to `pyproj.crs.CRS`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
from osgeo.osr import SpatialReference
from pyproj.crs import CRS
osr_crs = SpatialReference()
osr_crs.ImportFromEPSG(4326)
if osgeo.version_info.major < 3:
proj_crs = CRS.from_wkt(osr_crs.ExportToWkt())
else:
proj_crs = CRS.from_wkt(osr_crs.ExportToWkt(["FORMAT=WKT2_2018"]))
Converting from `pyproj.crs.CRS` to `osgeo.osr.SpatialReference`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. warning:: WKT2 is only supported in GDAL 3+
.. code-block:: python
import osgeo
from osgeo.osr import SpatialReference
from pyproj.crs import CRS
from pyproj.enums import WktVersion
proj_crs = CRS.from_epsg(4326)
osr_crs = SpatialReference()
if osgeo.version_info.major < 3:
osr_crs.ImportFromWkt(proj_crs.to_wkt(WktVersion.WKT1_GDAL))
else:
osr_crs.ImportFromWkt(proj_crs.to_wkt())
rasterio
--------
https://github.com/mapbox/rasterio
Converting from `rasterio.crs.CRS` to `pyproj.crs.CRS`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you have `rasterio >= 1.0.14`, then you can pass in the `rasterio.crs.CRS`
directly::
import rasterio
import rasterio.crs
from pyproj.crs import CRS
with rasterio.Env(OSR_WKT_FORMAT="WKT2_2018"):
rio_crs = rasterio.crs.CRS.from_epsg(4326)
proj_crs = CRS.from_user_input(rio_crs)
Otherwise, you should use the `wkt` property::
import rasterio.crs
from pyproj.crs import CRS
with rasterio.Env(OSR_WKT_FORMAT="WKT2_2018"):
rio_crs = rasterio.crs.CRS.from_epsg(4326)
proj_crs = CRS.from_wkt(rio_crs.wkt)
Converting from `pyproj.crs.CRS` to `rasterio.crs.CRS`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. warning:: WKT2 is only supported in GDAL 3+
If you have rasterio >= 1.0.26 and GDAL 3+, then you can pass in the `pyproj.crs.CRS`
directly::
import rasterio.crs
from pyproj.crs import CRS
proj_crs = CRS.from_epsg(4326)
rio_crs = rasterio.crs.CRS.from_user_input(proj_crs)
If you want to be compatible across GDAL/rasterio versions, you can do::
from packaging import version
import rasterio
import rasterio.crs
from pyproj.crs import CRS
from pyproj.enums import WktVersion
proj_crs = CRS.from_epsg(4326)
if version.parse(rasterio.__gdal_version__) < version.parse("3.0.0")
rio_crs = rasterio.crs.CRS.from_wkt(proj_crs.to_wkt(WktVersion.WKT1_GDAL))
else:
rio_crs = rasterio.crs.CRS.from_wkt(proj_crs.to_wkt())
fiona
------
https://github.com/Toblerity/Fiona
Converting from `fiona` CRS to `pyproj.crs.CRS`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Fiona currently stores the CRS as a PROJ string dictionary in the `crs`
attribute. As such, it is best to use the `crs_wkt` attribute.
It is also useful to know that plans exist to add CRS class.
Related GitHub issue `here `__.
Example::
import fiona
from pyproj.crs import CRS
with fiona.Env(OSR_WKT_FORMAT="WKT2_2018"), fiona.open(...) as fds:
proj_crs = CRS.from_wkt(fds.crs_wkt)
Converting from `pyproj.crs.CRS` for `fiona`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. warning:: WKT2 is only supported in GDAL 3+
If you want to be compatible across GDAL versions, you can do::
from packaging import version
import fiona
from pyproj.crs import CRS
proj_crs = CRS.from_epsg(4326)
if version.parse(fiona.__gdal_version__) < version.parse("3.0.0"):
fio_crs = proj_crs.to_wkt(WktVersion.WKT1_GDAL)
else:
# GDAL 3+ can use WKT2
fio_crs = dc_crs.to_wkt()
# with fiona.open(..., "w", crs_wkt=fio_crs) as fds:
# ...
geopandas
---------
https://github.com/geopandas/geopandas
Also see the `geopandas guide for upgrading to use pyproj CRS class `__
Preparing `pyproj.crs.CRS` for `geopandas`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
import fiona
import geopandas
from pyproj.crs import CRS
from pyproj.enums import WktVersion
proj_crs = CRS.from_epsg(4326)
if version.parse(geopandas.__version__) >= version.parse("0.7.0"):
# geopandas uses pyproj.crs.CRS
geo_crs = proj_crs
elif version.parse(geopandas.__version__) >= version.parse("0.6.0"):
# this version of geopandas uses always_xy=True so WKT version is safe
if version.parse(fiona.__gdal_version__) < version.parse("3.0.0"):
geo_crs = proj_crs.to_wkt(WktVersion.WKT1_GDAL)
else:
# GDAL 3+ can use WKT2
geo_crs = dc_crs.to_wkt()
else:
geo_crs = dc_crs.to_proj4()
`geopandas` to `pyproj.crs.CRS`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:meth:`pyproj.crs.CRS.from_user_input` can handle anything across the `geopandas`
versions. The only gotcha would be if it is `None`.
.. code-block:: python
import geopandas
from pyproj.crs import CRS
gdf = geopandas.read_file(...)
proj_crs = CRS.from_user_input(gdf.crs)
cartopy
-------
https://github.com/SciTools/cartopy
.. note:: These examples require cartopy 0.20+
Preparing `pyproj.crs.CRS` for `cartopy.crs.CRS`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. warning:: This only works for CRS created with WKT2,
PROJ JSON, or a spatial reference ID (i.e. EPSG)
with the area of use defined. Otherwise,
the x_limits and y_limits will not work.
.. code-block:: python
import cartopy.crs as ccrs
from pyproj.crs import CRS
# geographic
proj_crs = CRS.from_epsg(4326)
cart_crs = ccrs.CRS(proj_crs)
# projected
proj_crs = CRS.from_epsg(6933)
cart_crs = ccrs.Projection(proj_crs)
Preparing `cartopy.crs.CRS` for `pyproj.crs.CRS`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. note:: `cartopy.crs.CRS` inherits from `pyproj.crs.CRS`,
so it should behave like a `pyproj.crs.CRS`.
.. code-block:: python
from cartopy.crs import PlateCarree
from pyproj.crs import CRS
cart_crs = PlateCarree()
proj_crs = CRS.from_user_input(cart_crs)
pycrs
-----
https://github.com/karimbahgat/PyCRS
.. warning:: Currently does not support WKT2
Preparing `pyproj.crs.CRS` for `pycrs`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
import pycrs
from pyproj.crs import CRS
proj_crs = CRS.from_epsg(4326)
py_crs = pycrs.parse.from_ogc_wkt(proj_crs.to_wkt("WKT1_GDAL"))
Preparing `cartopy.crs.CRS` for `pyproj.crs.CRS`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
import pycrs
from pyproj.crs import CRS
py_crs = pycrs.parse.from_epsg_code(4326)
proj_crs = CRS.from_wkt(py_crs.to_ogc_wkt())
pyproj-3.3.0/docs/examples.rst 0000664 0000000 0000000 00000036525 14145330145 0016353 0 ustar 00root root 0000000 0000000 .. _examples:
Getting Started
===============
There are examples of usage within the API documentation and tests. This
section is to demonstrate recommended usage.
Also see: :ref:`gotchas`
Using CRS
---------
For more usage examples and documentation see :class:`pyproj.crs.CRS`.
Initializing CRS
~~~~~~~~~~~~~~~~
The :class:`pyproj.crs.CRS` class can be initialized in many different ways.
Here are some examples of initialization.
.. code:: python
>>> from pyproj import CRS
>>> crs = CRS.from_epsg(4326)
>>> crs = CRS.from_string("epsg:4326")
>>> crs = CRS.from_proj4("+proj=latlon")
>>> crs = CRS.from_user_input(4326)
Converting CRS to a different format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. warning:: You will likely lose important projection
information when converting to a PROJ string from
another format. See: https://proj4.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
.. code:: python
>>> from pyproj import CRS
>>> crs = CRS.from_epsg(4326)
>>> crs.to_epsg()
4326
>>> crs.to_authority()
('EPSG', '4326')
>>> crs = CRS.from_proj4("+proj=omerc +lat_0=-36 +lonc=147 +alpha=-54 +k=1 +x_0=0 +y_0=0 +gamma=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0")
>>> crs
Name: unknown
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- undefined
Coordinate Operation:
- name: Transformation from unknown to WGS84
- method: Position Vector transformation (geog2D domain)
Datum: Unknown based on WGS84 ellipsoid
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
Source CRS: unknown
>>> print(crs.to_wkt(pretty=True))
BOUNDCRS[
SOURCECRS[
PROJCRS["unknown",
BASEGEOGCRS["unknown",
DATUM["Unknown based on WGS84 ellipsoid",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1],
ID["EPSG",7030]]],
...
PARAMETER["Z-axis rotation",0,
ID["EPSG",8610]],
PARAMETER["Scale difference",1,
ID["EPSG",8611]]]]
>>> from pyproj.enums import WktVersion
>>> print(crs.to_wkt(WktVersion.WKT1_GDAL, pretty=True))
PROJCS["unknown",
GEOGCS["unknown",
DATUM["Unknown_based_on_WGS84_ellipsoid",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]]],
PROJECTION["Hotine_Oblique_Mercator_Azimuth_Center"],
PARAMETER["latitude_of_center",-36],
PARAMETER["longitude_of_center",147],
PARAMETER["azimuth",-54],
PARAMETER["rectified_grid_angle",0],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH]]
>>> from pprint import pprint
>>> pprint(crs.to_cf())
{'azimuth_of_central_line': -54,
'crs_wkt': 'BOUNDCRS[SOURCECRS[PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["Unknown '
...
'difference",1,ID["EPSG",8611]]]]',
'false_easting': 0.0,
'false_northing': 0.0,
'grid_mapping_name': 'oblique_mercator',
'horizontal_datum_name': 'Unknown based on WGS84 ellipsoid',
'inverse_flattening': 298.257223563,
'latitude_of_projection_origin': -36.0,
'longitude_of_prime_meridian': 0.0,
'longitude_of_projection_origin': 147.0,
'prime_meridian_name': 'Greenwich',
'reference_ellipsoid_name': 'WGS 84',
'scale_factor_at_projection_origin': 1.0,
'semi_major_axis': 6378137.0,
'semi_minor_axis': 6356752.314245179,
'towgs84': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}
Extracting attributes from CRS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are many attributes you can pull from the :class:`pyproj.crs.CRS`.
This is just a small subset of what is available.
.. code:: python
>>> crs = CRS("urn:ogc:def:crs,crs:EPSG::2393,crs:EPSG::5717")
>>> crs
Name: KKJ / Finland Uniform Coordinate System + N60 height
Axis Info [cartesian|vertical]:
- X[north]: Northing (metre)
- Y[east]: Easting (metre)
- H[up]: Gravity-related height (metre)
Area of Use:
- undefined
Datum: Kartastokoordinaattijarjestelma (1966)
- Ellipsoid: International 1924
- Prime Meridian: Greenwich
Sub CRS:
- KKJ / Finland Uniform Coordinate System
- N60 height
>>> crs.sub_crs_list
[
Name: KKJ / Finland Uniform Coordinate System
Axis Info [cartesian]:
- X[north]: Northing (metre)
- Y[east]: Easting (metre)
Area of Use:
- name: Finland - 25.5°E to 28.5°E onshore. Also all country.
- bounds: (19.24, 59.75, 31.59, 70.09)
Coordinate Operation:
- name: Finland Uniform Coordinate System
- method: Transverse Mercator
Datum: Kartastokoordinaattijarjestelma (1966)
- Ellipsoid: International 1924
- Prime Meridian: Greenwich
,
Name: N60 height
Axis Info [vertical]:
- H[up]: Gravity-related height (metre)
Area of Use:
- name: Finland - onshore.
- bounds: (19.24, 59.75, 31.59, 70.09)
Datum: Helsinki 1960
- Ellipsoid: undefined
- Prime Meridian: undefined
]
>>> cop = crs.sub_crs_list[0].coordinate_operation
>>> print(cop.to_wkt(pretty=True))
CONVERSION["Finland Uniform Coordinate System",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",27,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",3500000,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]]
>>> cop.method_code
'9807'
>>> cop.method_name
'Transverse Mercator'
>>> cop.params
[Param(name=Latitude of natural origin, auth_name=EPSG, code=8801, value=0.0, unit_name=degree, unit_auth_name=, unit_code=, unit_category=angular),
...
Param(name=False northing, auth_name=EPSG, code=8807, value=0.0, unit_name=metre, unit_auth_name=, unit_code=, unit_category=linear)]
Find UTM CRS by Latitude and Longitude
---------------------------------------
.. note:: For more database methods see: :ref:`database`.
.. code-block:: python
from pyproj import CRS
from pyproj.aoi import AreaOfInterest
from pyproj.database import query_utm_crs_info
utm_crs_list = query_utm_crs_info(
datum_name="WGS 84",
area_of_interest=AreaOfInterest(
west_lon_degree=-93.581543,
south_lat_degree=42.032974,
east_lon_degree=-93.581543,
north_lat_degree=42.032974,
),
)
utm_crs = CRS.from_epsg(utm_crs_list[0].code)
Transformations from CRS to CRS
-------------------------------
Step 1: Inspect CRS definition to ensure proper area of use and axis order
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For more options available for inspection, usage examples,
and documentation see :class:`pyproj.crs.CRS`.
.. code:: python
>>> from pyproj import CRS
>>> crs_4326 = CRS.from_epsg(4326)
>>> crs_4326
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
>>> crs_26917 = CRS.from_epsg(26917)
>>> crs_26917
Name: NAD83 / UTM zone 17N
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: North America - 84°W to 78°W and NAD83 by country
- bounds: (-84.0, 23.81, -78.0, 84.0)
Coordinate Operation:
- name: UTM zone 17N
- method: Transverse Mercator
Datum: North American Datum 1983
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
Note that `crs_4326` has the latitude (north) axis first and the `crs_26917`
has the easting axis first. This means that in the transformation, we will need
to input the data with latitude first and longitude second. Also, note that the
second projection is a UTM projection with bounds (-84.0, 23.81, -78.0, 84.0) which
are in the form (min_x, min_y, max_x, max_y), so the transformation input/output should
be within those bounds for best results.
Step 2: Create Transformer to convert from CRS to CRS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The :class:`pyproj.transformer.Transformer` can be initialized with anything supported
by :meth:`pyproj.crs.CRS.from_user_input`. There are a couple of examples added
here for demonstration. For more usage examples and documentation,
see :class:`pyproj.transformer.Transformer`.
.. code:: python
>>> from pyproj import Transformer
>>> transformer = Transformer.from_crs(crs_4326, crs_26917)
>>> transformer = Transformer.from_crs(4326, 26917)
>>> transformer = Transformer.from_crs("EPSG:4326", "EPSG:26917")
>>> transformer
Inverse of NAD83 to WGS 84 (1) + UTM zone 17N
>>> transformer.transform(50, -80)
(571666.4475041276, 5539109.815175673)
If you prefer to always have the axis order in the x,y or lon,lat order,
you can use the `always_xy` option when creating the transformer.
.. code:: python
>>> from pyproj import Transformer
>>> transformer = Transformer.from_crs("EPSG:4326", "EPSG:26917", always_xy=True)
>>> transformer.transform(-80, 50)
(571666.4475041276, 5539109.815175673)
Converting between geographic and projection coordinates within one datum
-------------------------------------------------------------------------
Step 1: Retrieve the geodetic CRS based on original CRS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: python
>>> from pyproj import CRS
>>> crs = CRS.from_epsg(3857)
>>> crs
Name: WGS 84 / Pseudo-Mercator
Axis Info [cartesian]:
- X[east]: Easting (metre)
- Y[north]: Northing (metre)
Area of Use:
- name: World - 85°S to 85°N
- bounds: (-180.0, -85.06, 180.0, 85.06)
Coordinate Operation:
- name: Popular Visualisation Pseudo-Mercator
- method: Popular Visualisation Pseudo Mercator
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
>>> crs.geodetic_crs
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
Step 2: Create Transformer to convert from geodetic CRS to CRS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: python
>>> proj = Transformer.from_crs(crs.geodetic_crs, crs)
>>> proj
Popular Visualisation Pseudo-Mercator
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
>>> proj.transform(12, 15)
(1669792.3618991035, 1345708.4084091093)
4D Transformations with Time
----------------------------
.. note:: If you are doing a transformation with a CRS that is time based,
it is recommended to include the time in the transformaton operation.
.. code:: python
>>> transformer = Transformer.from_crs(7789, 8401)
>>> transformer
ITRF2014 to ETRF2014 (1)
>>> transformer.transform(xx=3496737.2679, yy=743254.4507, zz=5264462.9620, tt=2019.0)
(3496737.757717311, 743253.9940103051, 5264462.701132784, 2019.0)
Geodesic calculations
---------------------
This is useful if you need to calculate the distance between two
points or the area of a geometry on Earth's surface.
For more examples of usage and documentation, see :class:`pyproj.Geod`.
Creating Geod class
~~~~~~~~~~~~~~~~~~~
This example demonstrates creating a :class:`pyproj.Geod` using an
ellipsoid name as well as deriving one using a :class:`pyproj.crs.CRS`.
.. code:: python
>>> from pyproj import CRS, Geod
>>> geod_clrk = Geod(ellps='clrk66') # Use Clarke 1866 ellipsoid.
>>> geod_clrk
Geod(ellps='clrk66')
>>> geod_wgs84 = CRS("epsg:4326").get_geod()
>>> geod_wgs84
Geod('+a=6378137 +f=0.0033528106647475126')
Geodesic line length
~~~~~~~~~~~~~~~~~~~~
Calculate the geodesic length of a line (See: :meth:`pyproj.Geod.line_length`):
.. code:: python
>>> from pyproj import Geod
>>> lats = [-72.9, -71.9, -74.9, -74.3, -77.5, -77.4, -71.7, -65.9, -65.7,
... -66.6, -66.9, -69.8, -70.0, -71.0, -77.3, -77.9, -74.7]
>>> lons = [-74, -102, -102, -131, -163, 163, 172, 140, 113,
... 88, 59, 25, -4, -14, -33, -46, -61]
>>> geod = Geod(ellps="WGS84")
>>> total_length = geod.line_length(lons, lats)
>>> f"{total_length:.3f}"
'14259605.611'
Calculate the geodesic length of a shapely geometry (See: :meth:`pyproj.Geod.geometry_length`):
.. code:: python
>>> from pyproj import Geod
>>> from shapely.geometry import Point, LineString
>>> line_string = LineString([Point(1, 2), Point(3, 4)]))
>>> geod = Geod(ellps="WGS84")
>>> total_length = geod.geometry_length(line_string)
>>> f"{total_length:.3f}"
'313588.397'
Geodesic area
~~~~~~~~~~~~~
Calculate the geodesic area and perimeter of a polygon (See: :meth:`pyproj.Geod.polygon_area_perimeter`):
.. code:: python
>>> from pyproj import Geod
>>> geod = Geod('+a=6378137 +f=0.0033528106647475126')
>>> lats = [-72.9, -71.9, -74.9, -74.3, -77.5, -77.4, -71.7, -65.9, -65.7,
... -66.6, -66.9, -69.8, -70.0, -71.0, -77.3, -77.9, -74.7]
>>> lons = [-74, -102, -102, -131, -163, 163, 172, 140, 113,
... 88, 59, 25, -4, -14, -33, -46, -61]
>>> poly_area, poly_perimeter = geod.polygon_area_perimeter(lons, lats)
>>> f"{poly_area:.3f} {poly_perimeter:.3f}"
'13376856682207.406 14710425.407'
Calculate the geodesic area and perimeter of a shapely polygon (See: :meth:`pyproj.Geod.geometry_area_perimeter`):
.. code:: python
>>> from pyproj import Geod
>>> from shapely.geometry import LineString, Point, Polygon
>>> geod = Geod('+a=6378137 +f=0.0033528106647475126')
>>> poly_area, poly_perimeter = geod.geometry_area_perimeter(
Polygon(
LineString([Point(1, 1), Point(1, 10), Point(10, 10), Point(10, 1)]),
holes=[LineString([Point(1, 2), Point(3, 4), Point(5, 2)])],
)
)
>>> f"{poly_area:.3f} {poly_perimeter:.3f}"
'-944373881400.339 3979008.036'
pyproj-3.3.0/docs/gotchas.rst 0000664 0000000 0000000 00000022365 14145330145 0016162 0 ustar 00root root 0000000 0000000 .. _gotchas:
Gotchas/FAQ
===========
This is a page for some suggestions, gotchas, and FAQs.
Also see:
- :ref:`examples`
- :ref:`PROJ FAQ `
What are the best formats to store the CRS information?
--------------------------------------------------------
In general, `Well-Known Text (WKT) `__
or `Spatial Reference ID
(SRID) `__, such as EPSG
codes, are the preferred formats to describe a CRS.
.. note:: WKT2 is preferred over WKT1.
PROJ strings can be lossy for storing CRS information.
If you can avoid it, it is best to not use them.
Additionally, PROJ strings will likely not be supported
in future major version of PROJ for storing CRS information.
More info: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
Axis order changes in PROJ 6+
-----------------------------
- https://proj.org/faq.html#why-is-the-axis-ordering-in-proj-not-consistent
- See warning at the top of :ref:`transformer`
- Examples of how to handle it: :ref:`examples`
- :ref:`min_confidence`
`+init=:` should be replaced with `:`
-----------------------------------------------------------------------
The `+init=:` syntax is deprecated and will be removed
in future versions of PROJ. Also, if you use the `+init` syntax,
you may have problems initializing projections when the other syntax works.
.. code-block:: python
>>> from pyproj import CRS
>>> CRS("ESRI:54009")
Name: World_Mollweide
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Coordinate Operation:
- name: World_Mollweide
- method: Mollweide
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
>>> CRS("+init=ESRI:54009")
...
pyproj.exceptions.CRSError: Invalid projection: +init=ESRI:54009 +type=crs: (Internal Proj Error: proj_create: cannot expand +init=ESRI:54009 +type=crs)
Proj (Not a generic latitude/longitude to projection converter)
---------------------------------------------------------------
:class:`pyproj.Proj` is limited to converting between geographic and
projection coordinates within one datum. If you have coordinates in latitude
and longitude, and you want to convert it to your projection, it is recommended
to use the :class:`pyproj.transformer.Transformer` as it takes into account datum
shifts.
You likely want to start from `EPSG:4326` (WGS84) for coordinates as
latitude and longitude.
.. code-block:: python
>>> from pyproj import CRS
>>> crs_4326 = CRS("WGS84")
>>> crs_4326
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
Then, use the :class:`pyproj.transformer.Transformer` to transform from latitude
and longitude to your projection as you might have a projection with a different
datum.
.. code-block:: python
>>> crs_proj = CRS("EPSG:28992")
>>> crs_proj
Name: Amersfoort / RD New
Axis Info [cartesian]:
- X[east]: Easting (metre)
- Y[north]: Northing (metre)
Area of Use:
- name: Netherlands - onshore.
- bounds: (3.2, 50.75, 7.22, 53.7)
Coordinate Operation:
- name: RD New
- method: Oblique Stereographic
Datum: Amersfoort
- Ellipsoid: Bessel 1841
- Prime Meridian: Greenwich
>>> crs_proj.datum == crs_4326.datum
False
>>> from pyproj import Transformer
>>> transformer = Transformer.from_crs(crs_4326, crs_proj)
>>> transformer.transform(52.067567, 5.068913)
(133175.3690698233, 453300.86739169655)
If you use :class:`pyproj.Proj`, it will use the geodetic CRS with
from the projected CRS with the same datum to do the transformation,
which may not be what you want.
.. code-block:: python
>>> from pyproj import Proj
>>> Proj('epsg:28992')(5.068913, 52.067567)
(133148.22970574044, 453192.24450392975)
>>> transg = Transformer.from_crs(crs_proj.geodetic_crs, crs_proj)
>>> transg.transform(52.067567, 5.068913)
(133148.22970574044, 453192.24450392975)
.. _min_confidence:
Why does the EPSG code return when using `EPSG:xxxx` and not with `+init=EPSG:xxxx`?
------------------------------------------------------------------------------------
From: https://gis.stackexchange.com/a/326919/144357
The reason that the EPSG code does not appear with the CRS initialized with
the `init=` syntax is that the CRS are different.
.. code-block:: python
>>> from pyproj import CRS
>>> crs_deprecated = CRS(init="epsg:4544")
>>> crs = CRS("epsg:4544")
>>> crs == crs_deprecated
False
Upon further inspection of the `Axis Info` section, you can see that the difference
is in the **axis order**.
.. code-block:: python
>>> crs_deprecated
Name: CGCS2000 / 3-degree Gauss-Kruger CM 105E
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: China - 103.5°E to 106.5°E
- bounds: (103.5, 22.5, 106.5, 42.21)
Coordinate Operation:
- name: Gauss-Kruger CM 105E
- method: Transverse Mercator
Datum: China 2000
- Ellipsoid: CGCS2000
- Prime Meridian: Greenwich
>>> crs
Name: CGCS2000 / 3-degree Gauss-Kruger CM 105E
Axis Info [cartesian]:
- X[north]: Northing (metre)
- Y[east]: Easting (metre)
Area of Use:
- name: China - 103.5°E to 106.5°E
- bounds: (103.5, 22.5, 106.5, 42.21)
Coordinate Operation:
- name: Gauss-Kruger CM 105E
- method: Transverse Mercator
Datum: China 2000
- Ellipsoid: CGCS2000
- Prime Meridian: Greenwich
The reason the `min_confidence` parameter in
:meth:`pyproj.crs.CRS.to_epsg` and :meth:`pyproj.crs.CRS.to_authority`
exists is because you can initialize a CRS in several different methods and
some of them do not always coorespond to an EPSG or authortiy code, but it
can be close enough.
For example, if you have a WKT/PROJ string and you use it to create the CRS instance,
in most cases you want to be sure that the EPSG code given by to_epsg will give you a
CRS instance similar to the one created by the WKT/PROJ string.
However, if an EPSG code does not exist that matches you WKT/PROJ string with
a `min_confidence` you don't want to get that EPSG code back as it will make
you think that the WKT/PROJ string and the EPSG code are one and the same when
they are not.
However, if you are only wanting to get the EPSG code that is closest
to the PROJ/WKT string, then you can reduce your min_confidence to a
threshold you are comfortable with.
Here is an example of that:
.. code-block:: python
>>> crs_deprecated = CRS("+init=epsg:4326")
>>> crs_deprecated.to_epsg(100)
>>> crs_deprecated.to_epsg(70)
>>> crs_deprecated.to_epsg(20)
4326
>>> crs_latlon = CRS("+proj=latlon")
>>> crs_latlon.to_epsg(100)
>>> crs_latlon.to_epsg(70)
4326
>>> crs_epsg = CRS.from_epsg(4326)
>>> crs_epsg.to_epsg(100)
4326
>>> crs_wkt = CRS(crs_epsg.to_wkt())
>>> crs_wkt.to_epsg(100)
4326
>>> crs_wkt == crs_epsg
True
>>> crs_epsg == crs_latlon
False
>>> crs_epsg == crs_deprecated
False
Internal PROJ Error ... SQLite error on SELECT
----------------------------------------------
The PROJ database is based on the EPSG database. With each release,
there is a good chance that there are database updates. If you have multiple
versions of PROJ installed on your systems and the search path for
the data directory becomes mixed up, you may see an error message like:
`SQLite error on SELECT`. This is likely due to a version of PROJ
attempting to use an incompatible database.
Debugging tips:
- To get data directory being used: :func:`pyproj.datadir.get_data_dir`
- The order for searching for the data directory can be found in
the docstrings of :func:`pyproj.datadir.get_data_dir`
- To change the data directory: :func:`pyproj.datadir.set_data_dir`
.. _upgrade_transformer:
Upgrading to pyproj 2 from pyproj 1
-----------------------------------
We recommended using the :class:`pyproj.transformer.Transformer` and
:class:`pyproj.crs.CRS` in place of the :class:`pyproj.Proj` and
:meth:`pyproj.transformer.transform`.
Also see:
- :ref:`examples`
- :ref:`optimize_transformations`
.. warning:: :meth:`pyproj.transformer.transform` and :meth:`pyproj.transformer.itransform`
are deprecated.
pyproj 1 style:
>>> from functools import partial
>>> from pyproj import Proj, transform
>>> proj_4326 = Proj(init="epsg:4326")
>>> proj_3857 = Proj(init="epsg:3857")
>>> transformer = partial(transform, proj_4326, proj_3857)
>>> transformer(12, 12)
pyproj 2 style:
>>> from pyproj import Transformer
>>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857")
>>> transformer.transform(12, 12)
pyproj-3.3.0/docs/history.rst 0000664 0000000 0000000 00000054040 14145330145 0016226 0 ustar 00root root 0000000 0000000 Change Log
==========
3.3.0
-------
- WHL: Wheels contain PROJ 8.2.0
- DEP: Minimum supported Python version 3.8 (issue #930)
- DEP: Minimum PROJ version 8.0 (issue #940)
- BUG: Prepend "Derived" to CRS type name if CRS is derived (issue #932)
- BUG: Improved handling of inf values in :meth:`pyproj.transformer.Transformer.transform_bounds` (pull #961)
- BUG: CRS CF conversions mismatch of PROJ parameters in rotated pole (issue #948)
- ENH: Add support for transforming bounds at the poles in :meth:`pyproj.transformer.Transformer.transform_bounds` (pull #962)
- ENH: Added :attr:`pyproj.transformer.Transformer.source_crs` & :attr:`pyproj.transformer.Transformer.target_crs` (pull #976)
- ENH: Added :class:`pyproj.crs.coordinate_operation.PoleRotationNetCDFCFConversion` (issue #948)
- ENH: Added :func:`pyproj.database.get_database_metadata` (issue #990)
- ENH: Added PROJ database metadata to :func:`pyproj.show_versions` (issue #990)
3.2.1
------
- REF: declare specific python types in cython (pull #928)
- REF: Use cython string decoding (pull #929)
- BUG: Return multiple authorities with :attr:`pyproj.crs.CRS.list_authority` (pull #943)
- BUG: CRS CF conversions ensure lon_0 = north_pole_grid_longitude + 180 (issue #927)
- BUG: CRS CF conversions ensure Pole rotation (netCDF CF convention) conversion works (issue #927)
3.2.0
------
- WHL: Wheels contain PROJ 8.1.1
- DOC: Add new pyproj logo (issue #700)
- REF: Handle deprecation of proj_context_set_autoclose_database (issue #866)
- REF: Make CRS methods inheritable (issue #847)
- ENH: Added :attr:`pyproj.crs.CRS.is_derived` (pull #902)
- ENH: Added :attr:`pyproj.crs.GeocentricCRS` (pull #903)
- ENH: Added :attr:`pyproj.crs.CRS.list_authority` (issue #918)
- ENH: Added `inplace` kwarg to :meth:`pyproj.transformer.Transformer.transform` (issue #906)
- PERF: Disable unnecessary copy in dtype conversion for buffer (pull #904)
- DOC: Improve FAQ text about CRS formats (issue #789)
- BUG: Add PyPy cython array implementation (issue #854)
- BUG: Fix spelling for
:class:`pyproj.crs.coordinate_operation.AzimuthalEquidistantConversion`
and :class:`pyproj.crs.coordinate_operation.LambertAzimuthalEqualAreaConversion` (issue #882)
- BUG: Make datum name match exact in :func:`pyproj.database.query_utm_crs_info` (pull #887)
- BUG: Update :class:`pyproj.enums.GeodIntermediateFlag` for future Python compatibility (issue #855)
- BUG: Hide unnecessary PROJ ERROR from proj_crs_get_coordoperation (issue #873)
- BUG: Fix pickling for CRS builder classes (issue #897)
- CLN: Remove `ignore_axis_order` kwarg from :meth:`pyproj.crs.CRS.is_exact_same` as it was added by accident (pull #904)
- CLN: remove numeric/numarrays support (pull #908)
- LNT: Add pylint & address issues (pull #909)
- DEP: Remove distutils dependency (pull #917)
3.1.0
-----
* WHL: Wheels contain PROJ 8.0.1
* DEP: Minimum supported Python version 3.7 (issue #790)
* REF: Multithread safe CRS, Proj, & Transformer (issue #782)
* BUG: Disallow NaN values with AreaOfInterest & BBox (issue #788)
* ENH: Pretty format PROJ string support (issue #764)
* ENH: Added :meth:`pyproj.transformer.Transformer.to_proj4` (pull #798)
* ENH: Added authority, accuracy, and allow_ballpark kwargs to :meth:`pyproj.transformer.Transformer.from_crs` (issue #754)
* ENH: Added support for "AUTH:CODE" input to :meth:`pyproj.transformer.Transformer.from_pipeline` (issue #755)
* ENH: Added :meth:`pyproj.crs.CRS.to_3d` (pull #808)
* ENH: Added :meth:`pyproj.transformer.Transformer.transform_bounds` (issue #809)
* ENH: Added :attr:`pyproj.crs.CRS.is_compound` (pull #823)
* ENH: Added `initial_idx` and `terminal_index` kwargs to :meth:`pyproj.Geod.npts` (pull #841)
* ENH: Added :meth:`pyproj.Geod.inv_intermediate` & :meth:`pyproj.Geod.fwd_intermediate` (pull #841)
* REF: Skip transformations if `noop` & deprecate `skip_equivalent` (pull #824)
3.0.1
-----
* WHL: Wheels contain PROJ 7.2.1
* Use `proj_context_errno_string` in PROJ 8+ due to deprecation (issue #760)
* BUG: Allow transformations with empty arrays (issue #766)
* BUG: support numpy objects in CRS.from_cf (issue #773)
3.0.0
-----
* Minimum supported Python version 3.6 (issue #499)
* Minimum PROJ version 7.2 (issues #599 & #689)
* WHL: Removed datumgrids from wheels because not needed with RFC 4 (pull #628)
* WHL: Wheels contain PROJ 7.2
* ENH: Added :ref:`network_api` (#675, #691, #695)
* ENH: Added ability to use global context (issue #661)
* ENH: Added transformation grid sync API/CLI (issue #572)
* ENH: Support obects with '__array__' method (pandas.Series, xarray.DataArray, dask.array.Array) (issue #573)
* ENH: Added :func:`pyproj.datadir.get_user_data_dir` (pull #636)
* ENH: Added :attr:`pyproj.transformer.Transformer.is_network_enabled` (issue #629)
* ENH: Added :meth:`pyproj.transformer.TransformerGroup.download_grids` (pull #643)
* ENH: Use 'proj_get_units_from_database' in :func:`pyproj.database.get_units_map` & cleanup :func:`pyproj.database.get_codes` (issue #619)
* ENH: Added support for radians for Proj & Transformer.from_pipeline & use less gil (issue #612)
* ENH: Datum.from_name default to check all datum types (issue #606)
* ENH: Use from_user_input in __eq__ when comparing CRS sub-classes (i.e. PrimeMeridian, Datum, Ellipsoid, etc.) (issue #606)
* ENH: Add support for coordinate systems with CRS using CF conventions (issue #536)
* ENH: Use `proj_is_equivalent_to_with_ctx` in the place of `proj_is_equivalent_to` internally (issue #666)
* BUG: Add support for identifying engineering/parametric/temporal datums (issue #670)
* ENH: Add support for temporal CRS CF coordinate system (issue #672)
* ENH: Added support for debugging internal PROJ (pull #696)
* ENH: Added pathlib support for data directory methods (pull #702)
* ENH: Added :func:`pyproj.database.query_crs_info` (pull #703)
* ENH: Added :func:`pyproj.database.query_utm_crs_info` (pull #712)
* REF: Refactor Proj to inherit from Transformer (issue #624)
* REF: Added `pyproj.database`, `pyproj.aoi`, and `pyproj.list` modules (pull #703)
* BUG: Fix handling of polygon holes when calculating area in Geod (pull #686)
2.6.1
~~~~~
* WHL: Wheels contain PROJ version is 7.0.1
* BUG: Allow `*_name` to be added in CRS.to_cf (issue #585)
* BUG: Fix building prime meridian in :meth:`pyproj.crs.CRS.from_cf` (pull #588)
* BUG: Fix check for numpy bool True kwarg (pull #590)
* DOC: Update pyproj.Proj docstrings for clarity (issue #584)
* Added `pyproj.__proj_version__`
* BUG: Fix :meth:`pyproj.Proj.get_factors` (issue #600)
* BUG: fix unequal (!=) with non-CRS type (pull #596)
2.6.0
~~~~~
* ENH: Added :meth:`pyproj.Proj.get_factors` (issue #503)
* ENH: Added type hints (issue #369)
* BUG: Don't use CRS classes for defaults in CRS child class init signatures (issue #554)
* ENH: Updated :attr:`pyproj.crs.CRS.axis_info` to pull all relevant axis information from CRS (issue #557)
* ENH: Added :meth:`pyproj.transformer.Transform.__eq__` (issue #559)
* ENH: Added :attr:`pyproj.crs.CRS.utm_zone` (issue #561)
* BUG: Modify CRS dict test to accommodate numpy bool types. (issue #564)
* BUG: Fix pipeline transformations to match cct (issue #565)
* BUG: Don't silently ignore kwargs when projparams are specified (Proj & CRS) (issue #565)
2.5.0
~~~~~
* WHL: Wheels contain PROJ version is 6.3.1
* Remove deprecated PyObject_AsWriteBuffer (issue #495)
* ENH: Added :meth:`pyproj.crs.CRS.equals` with `ignore_axis_order` kwarg (issue #493)
* ENH: Added :meth:`pyproj.crs.CoordinateSystem.from_json`, :meth:`pyproj.crs.CoordinateSystem.from_json_dict`, and :meth:`pyproj.crs.CoordinateSystem.from_string` (pull #501)
* ENH: Added :class:`pyproj.crs.CoordinateSystem` to `pyproj.crs` namespace (pull #501)
* ENH: Added :meth:`pyproj.crs.CoordinateSystem.from_user_input`, :meth:`pyproj.crs.CoordinateOperation.from_user_input`, :meth:`pyproj.crs.Datum.from_user_input`, :meth:`pyproj.crs.PrimeMeridian.from_user_input`, :meth:`pyproj.crs.Ellipsoid.from_user_input` (pull #502)
* ENH: Added :meth:`pyproj.crs.CoordinateSystem.from_name`, :meth:`pyproj.crs.CoordinateOperation.from_name`, :meth:`pyproj.crs.Datum.from_name`, :meth:`pyproj.crs.PrimeMeridian.from_name`, :meth:`pyproj.crs.Ellipsoid.from_name` (pull #505)
* BUG: Fix getting :attr:`pyproj.crs.Ellipsoid.semi_minor_metre` when not computed (issue #457)
* ENH: Added support for custom CRS (issue #389)
* ENH: Added enumeration for WKT2_2019 (issue #526)
* ENH: Update from_cf/to_cf to use WKT instead of PROJ strings for internal management (issue #515)
2.4.2
~~~~~
* Elevate +init= warning to FutureWarning (pull #486)
* Add UserWarning to :meth:`pyproj.crs.CRS.to_proj4` (pull #486)
* BUG: Fix for 32-bit i686 platforms (issue #481)
* Return 'inf' in Proj instead of 1.e30 (pull #491)
2.4.1
~~~~~
* WHL: Wheels contain PROJ version is 6.2.1 (issue #456)
* WHL: Wheels for Linux x86_64 use manylinux2010 (pyproj4/pyproj-wheels/pull/18)
* BUG: Fix setting lat_ts for mercator projection in :meth:`pyproj.crs.CRS.from_cf` and :meth:`pyproj.crs.CRS.to_cf` (issue #461)
* BUG: latlon -> longlat in `CRS.from_cf()` for o_proj so behavior consistent in PROJ 6.2.0 and 6.2.1 (pull #472)
* ENH: Add repr for `pyproj.crs.CoordinateOperation` and for `pyproj.transformer.TransformerGroup` (pull #464)
2.4.0
~~~~~
* Minimum PROJ version is 6.2.0 (issue #411)
* Removed global pyproj context (issue #418)
* Added support for PROJ JSON in `pyproj.crs` objects and `pyproj.Transformer` (pull #432)
* Moved doctests code out of `pyproj.__init__` (issue #417)
* Added version information to `python -m pyproj` (pull #429)
* Added `scope` & `remarks` to `pyproj.crs` objects and `pyproj.Transformer` (issue #441)
* Added `operations` to `pyproj.crs.CoordinateOperation` objects and `pyproj.Transformer` (issue #441)
* Added :func:`pyproj.get_authorities` and :func:`pyproj.get_codes` (issue #440)
* Release gil in core cython/PROJ code (issue #386)
* BUG: Added checks for unititialized `pyproj.crs` objects to prevent core dumping (issue #433)
* BUG: Added fix for get_transform_crs when checking type (pull #439)
* DOC: Build docs with python3 (pull #428)
2.3.1
~~~~~
* Added cleanup for internal PROJ errors (issue #413)
* Delay checking for pyproj data directory until importing pyproj (issue #415)
* Address issue where PROJ core dumps on proj_create with +init= when global context does not have data directory set (issue #415 & issue #368)
2.3.0
~~~~~
* Minimum supported Python version 3.5 (issue #331)
* New `pyproj.geod.Geod` additions:
* Added support for calculating geodesic area (:meth:`pyproj.Geod.polygon_area_perimeter`)
and added interface to calculate total length of a line
(:meth:`pyproj.Geod.line_length` & :meth:`pyproj.Geod.line_lengths`) (issue #210).
* Added support for calculating geodesic area and line lengths with shapely geometries
(:meth:`pyproj.Geod.geometry_area_perimeter` & :meth:`pyproj.Geod.geometry_length`)
(pull #366)
* New `pyproj.transformer` additions:
* Added :class:`pyproj.transformer.TransformerGroup` to make all transformations available (issue #381)
* Added option for `area_of_interest` for :meth:`pyproj.transformer.Transformer.from_crs`,
:meth:`pyproj.transformer.Transformer.from_proj` and :class:`pyproj.transformer.TransformerGroup`
* Added :attr:`pyproj.transformer.Transformer.area_of_use` (issue #385)
* Added :attr:`pyproj.crs.CoordinateOperation.area_of_use` (issue #385)
* Updated to only have one PJ_CONTEXT per pyproj session (issue #374)
* Always return latlon with Proj (issue #356)
* Remove aenum dependency (issue #339)
* Removed deprecated functions `Proj.proj_version`, `CRS.is_valid`, and `CRS.to_geodetic()` (pull #371)
* Search on `sys.prefix` for the PROJ data directory (issue #387)
2.2.2
~~~~~
* Update wheels to PROJ 6.1.1
* Add deprecation warning when using +init= syntax (pull #358)
* Added :meth:`pyproj.crs.is_proj` (pull #359)
* Fixed case in :meth:`pyproj.crs.CRS.to_dict` with :meth:`pyproj.crs.CRS.to_proj4` returning None (pull #359)
* Keep `no_defs` in input PROJ string as it does not hurt/help anything in current code (pull #359)
* Made public properties on C classes readonly (pull #359)
* Update data dir exception handling to prevent ignoring errors (pull #361)
* :meth:`pyproj.crs.CRS.to_cf` export transverse mercator parameters for UTM zones (pull #362)
2.2.1
~~~~~
* Added :meth:`pyproj.show_versions` (issue #334)
* Added fix for whitepace around '=' in PROJ strings (issue #345)
* Update version check in `setup.py` (issue #323)
* Add "stable" doc site pointing to latest release (issue #347, pull #348)
* Depreate `Proj.proj_version` (pull #337)
* Test fixes (pull #333, pull #335)
2.2.0
~~~~~
* Minimum PROJ version is now 6.1.0
* `pyproj.crs` updates:
* Updated CRS repr (issue #264)
* Add Datum, CoordinateSystem, CoordinateOperation clases (issue #262)
* Added :meth:`pyproj.crs.CRS.to_cf` and :meth:`pyproj.crs.CRS.from_cf` for
converting to/from Climate and Forcast (CF) 1.8 grid mappings (pull #244)
* Added :meth:`pyproj.crs.CRS.to_dict` (issue #226)
* Added :meth:`pyproj.crs.CRS.to_authority` (pull #294)
* Added :attr:`pyproj.crs.CRS.is_vertical` and :attr:`pyproj.crs.CRS.is_engineering` (issue #316)
* Added :attr:`pyproj.crs.CRS.target_crs` (pull #328)
* Provide option to "pretty print" WKT in :attr:`pyproj.crs.CRS.to_wkt` (issue #258)
* Add support for Bound and Compound CRS for :attr:`pyproj.crs.CRS.is_geographic`, :attr:`pyproj.crs.CRS.is_projected` (issue #274)
* Add support for Bound CRS for :attr:`pyproj.crs.CRS.is_geocentric` (issue #374)
* Add support for comparison with CRS a non-crs type supported by :meth:`pyproj.crs.CRS.from_user_input` (issue #312)
* Added support for ITRF, compound EPSG, and urn projection strings in CRS (pull #289)
* Better handle Compound CRS (issue #265)
* Disallow creation of non-CRS object (eg pipeline) in CRS class (issue #267)
* Added check in :meth:`pyproj.crs.CRS.to_epsg` for when `proj_list` is null (issue #257)
* Fix comparing classes of non-instance types (issue #310)
* `pyroj.transformer` updates:
* Added `always_xy` option to Transformer so the transform method will
always accept as input and return as output coordinates using the
traditional GIS order, that is longitude, latitudecfor geographic
CRS and easting, northing for most projected CRS (issue #225)
* Provide `direction` option in :meth:`pyproj.transformer.Transformer.transform` (issue #266)
* Add check for valid initialization of Transformer and ensure it is a transformer (issue #321)
* Added :meth:`pyproj.transformer.Transformer.to_wkt` as well as attributes related to `PJ_PROJ_INFO` (pull #322)
* Undo deprecation of :meth:`pyproj.transformer.Transformer.from_crs` (issue #275)
* Fix false positive errors raised in transformer (issue #249)
* Fix :class:`pyproj.Proj` initialization from DerivedGeographicCRS (issue #270)
* Add interface to get the projection/ellps/prime_meridian/units lists (issue #251)
* Docs/Build/Test fixes (pull #278, pull #245, pull #248, pull #247, issue #253, pull #252)
2.1.3
~~~~~
* Added support for time transformations (issue #208)
* Fixed projection equivalence testing for transformations (pull #231).
* Switch to pytest for testing (pull #230)
* Various testing fixes (pull #223, #222, #221, #220)
* Convert PROJ error messages from bytes to strings (pull #219)
* Fix data dir path separator to be (;) for windows and (:) for linux (pull #234)
2.1.2
~~~~~
* Updated to use the CRS definition for Proj instances in transforms (issue #207)
* Add option to skip transformation operation if input and output projections are equivalent
and always skip if the input and output projections are exact (issue #128)
* Update setup.py method for checking PROJ version (pull #211)
* Add internal proj error log messages to exceptions (pull #215)
2.1.1
~~~~~
* Restore behavior of 1.9.6 when illegal projection transformation requested
(return ``inf`` instead of raising an exception, issue #202). kwarg ``errcheck``
added to :func:`pyproj.transformer.transform` and :func:`pyproj.transformer.itransform`
(default ``False``). When ``errcheck=True`` an exception is raised.
2.1.0
~~~~~
* Added :class:`pyproj.transformer.Transformer` to make repetitive transformations more efficient (issue #187)
* Added fix for using local datumgrids with transform (issue #191)
* Added :meth:`pyproj.transformer.Transformer.from_pipeline` to support pipeline transformations.
* Added fix for conversion between radians/degrees for transformations (issues #192 & #195)
2.0.2
~~~~~
* add filter for boolean values in dict2string so "no_rot=True" works (issue #183).
* make sure .pxd files included in source tarball.
* add radians flag back in for transform/itransform (issue #185).
2.0.1
~~~~~
* Ensure data path set properly for TransProj (pull request #179, addressed
issue #176).
2.0.0
~~~~~
* Update to PROJ version 6.0.0 & removed support for older PROJ versions.
* Added pyproj.CRS class.
* Updated pyproj.Proj & pyproj.transform to accept any input from CRS.from_user_input.
* Removed internal PROJ source code.
* Changed default for preserve_units to be True in pyproj.Proj class initialization.
* Modified logic for searching for the PROJ data directory to not conflict with older versions of PROJ.
* Added pyproject.toml.
1.9.6
~~~~~
* fix segfault when inverse projection not defined (issue #43, pull request
#44).
* supports python 3.7
1.9.5.1
~~~~~~~
* fix for issue #42 (compilation error with microsoft visual studio).
1.9.5
~~~~~
* update proj4 source to latest github master (commit 953cc00fd87425395cabe37641cda905c4b587c1).
* port of basemap fix for input arrays in fortran order
* restore inverse Hammer patch that was lost when proj4 source code was updated.
1.9.4 (git tag v1.9.4rel)
~~~~~~~~~~~~~~~~~~~~~~~~~
* migrate to github from googlecode.
* update proj4 source code from svn r2595 (version 4.9.0RC2).
* include runtime_library_dirs in setup-proj.py.
* added to_latlong method (issue 51).
* fix back azimuth when lon1 and lon2 are identical.
1.9.3 (svn revision 327)
~~~~~~~~~~~~~~~~~~~~~~~~
* Geod now uses C code adapted from geographiclib now included in proj4 source,
instead of pure python code directly from geographiclib.
* make radians=True work with Geod.npts (issue 47).
* allow PROJ_DIR env var to control location of proj data (issue 40).
1.9.2 (svn revision 301)
~~~~~~~~~~~~~~~~~~~~~~~~
* updated proj4 src to 4.8.0 - includes two new map projections (natearth and
isea).
1.9.1 (svn revision 285)
~~~~~~~~~~~~~~~~~~~~~~~~
* restore compatibility with python 2.4/2.5, which was broken by the addition
of the geographiclib geodesic module (issue 36).
1.9.0 (svn revision 282)
~~~~~~~~~~~~~~~~~~~~~~~~
* use pure python geographiclib for geodesic computation codes instead of proj4.
* don't use global variable pj_errno for return codes, use pj_ctx_get_errno instead.
* use new projCtx structure for thread safety in proj lib.
* update C source and data from proj4 svn (r2140).
* add pj_list and pj_ellps module level variables (a dict mapping short names to longer descriptions, e.g. pyproj.pj_list['aea'] = 'Albers Equal Area').
1.8.9 (svn revision 222)
~~~~~~~~~~~~~~~~~~~~~~~~
* Python 3 now supported.
* allow 'EPSG' init (as well as 'epsg'). This only worked on case-insensitive
filesystems previously. Fixes issue 6.
* added inverse to Hammer projection.
* updated proj.4/src/pj_mutex.c from proj4 svn to fix a threading issue on windows
(issue 25). Windows binary installers updated (version 1.8.8-1), courtesy
Christoph Gohlke.
* if inputs are NaNs, return huge number (1.e30).
1.8.8 (svn revision 196)
~~~~~~~~~~~~~~~~~~~~~~~~
* add extra datum shift files, added test/test_datum.py (fixes issue 22).
datum shifts now work correctly in transform function.
1.8.7 (svn revision 175)
~~~~~~~~~~~~~~~~~~~~~~~~
* reverted pj_init.c to old version (from proj4 4.6.1) because version in
4.7.0 includes caching code that can cause segfaults in pyproj (issue 19).
* added 'preserve_units' keyword to Proj.__init__ to suppress conversion
to meters.
1.8.6 (svn revision 169)
~~~~~~~~~~~~~~~~~~~~~~~~
* now works with ms vs2008, vs2003 (fixed missing isnan).
* updated to proj 4.7.0 (fixes a problem coexisting with pyqt).
* allow Geod instance to be initialized using a proj4 string
1.8.5 (svn revision 155)
~~~~~~~~~~~~~~~~~~~~~~~~
* allow Proj instance to be initialized using a proj4 string
(instead of just a dict or kwargs).
1.8.4 (svn revision 151)
~~~~~~~~~~~~~~~~~~~~~~~~
* updated proj4 sources to version 4.6.0
1.8.3 (svn revision 146)
~~~~~~~~~~~~~~~~~~~~~~~~
* fixed bug in Geod class that caused erroneous error message
"undefined inverse geodesic (may be an antipodal point)".
* fix __reduce__ method of Geod class so instances can be pickled.
* make sure points outside projection limb are set to 1.e30 on inverse
transform (if errcheck=False).
* fixed small setup.py bug.
* generate C source with Cython 0.9.6.6 (pycompat.h no longer needed).
1.8.2
~~~~~
* added 'srs' (spatial reference system) instance variable to Proj.
* instead of returning HUGE_VAL (usually 'inf') when projection not defined
and errcheck=False, return 1.e30.
* added Geod class for geodesic (i.e. Great Circle) computations.
Includes doctests (which can be run with pyproj.test()).
* proj.4 source code now included, thus removing proj.4 lib
dependency. Version 4.5.0 is included, with a patch to
create an API for geodesic computations.
* python 2.4 compatibility patch (suggested by Andrew Straw)
from M. v. Loewis:
http://mail.python.org/pipermail/python-dev/2006-March/062561.html
1.8.1
~~~~~
* if given tuples, returns tuples (instead of lists).
* test for numpy arrays first.
* Fixed error in docstring example.
* README.html contains html docstrings generated by pydoc.
* Renamed pyproj.so to _pyproj.so, created a new python module
called pyproj.py. Moved as code as possible from _pyproj.so to
pyproj.py.
* docstring examples now executed by doctest when 'pyproj.test()' is run.
* added test to _pyproj.c which defines Py_ssize_t for python < 2.5.
This is necessary when pyrex 0.9.5 is used.
1.8.0
~~~~~
* Better error handling Proj.__init__.
* Added optional keyword 'errcheck' to __call__ method.
* If True, an exception is raised if the transformation is invalid.
1.7.3
~~~~~
* python 2.5 support.
pyproj-3.3.0/docs/index.rst 0000664 0000000 0000000 00000001635 14145330145 0015636 0 ustar 00root root 0000000 0000000 pyproj Documentation
====================
Python interface to `PROJ `_ (cartographic projections and coordinate transformations library).
GitHub Repository: https://github.com/pyproj4/pyproj
.. note:: Minimum supported PROJ version is 8.0
.. note:: Minimum supported Python version is 3.8
.. note:: pyproj 3 wheels do not include transformation grids.
For migration assistance see: :ref:`transformation_grids`
.. note:: pyproj 3+ no longer supports manylinux1 wheels.
pip>=19.0 is required to install manylinux2010 wheels.
.. toctree::
:maxdepth: 1
:caption: Contents:
installation
examples
transformation_grids
gotchas
api/index
cli
advanced_examples
build_crs
build_crs_cf
crs_compatibility
optimize_transformations
history
past_versions
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
pyproj-3.3.0/docs/installation.rst 0000664 0000000 0000000 00000012254 14145330145 0017227 0 ustar 00root root 0000000 0000000 .. highlight:: shell
============
Installation
============
The easiest methods for installing pyproj are:
1. Use pip to install the binary wheels on `PyPI `__:
.. code-block:: bash
pip install pyproj
.. note:: pyproj 3+ no longer supports manylinux1 wheels.
pip>=19.0 is required to install manylinux2010 wheels.
.. note:: pyproj 3+ wheels do not include transformation grids.
For migration assistance see: :ref:`transformation_grids`
- The MacOS and Linux wheels are powered by `multibuild by Matthew Brett `__
- The Windows wheels are built by `Christoph Gohlke `__
2. Use `conda `__ with the `conda-forge `__ channel:
.. code-block:: bash
conda config --prepend channels conda-forge
conda config --set channel_priority strict
conda create -n pyproj_env pyproj
conda activate pyproj_env
.. note::
"... we recommend always installing your packages inside a
new environment instead of the base environment from
anaconda/miniconda. Using envs make it easier to
debug problems with packages and ensure the stability
of your root env."
-- https://conda-forge.org/docs/user/tipsandtricks.html
.. warning::
Avoid using `pip install` with a conda environment. If you encounter
a python package that isn't in conda-forge, consider submitting a
recipe: https://github.com/conda-forge/staged-recipes/
- `pypoj` is maintaned by the `pyproj-feedstock maintainers `__
- `PROJ` is maintaned by the `proj.4-feedstock maintainers `__
If these installation methods do not meet your needs, the section below provides further instructions
for getting setup.
Transformation Grids
=====================
See: :ref:`transformation_grids`
Installing from source
======================
Version compatibility matrix:
============ ============
pyproj PROJ
============ ============
<= 1.9.6 <= 5.2
2.0-2.1 6.0+
2.2-2.3 6.1-7
2.4-2.6 6.2-7
3.0.0 7.2
3.0.1+ 7.2+
3.3.0+ 8.0+
============ ============
Setup PROJ
------------
PROJ is required when building from source.
:ref:`PROJ Installation Instructions `
You can also download PROJ from:
- https://download.osgeo.org/proj
- https://github.com/OSGeo/PROJ
pyproj Build Environment Variables
-----------------------------------
.. envvar:: PROJ_VERSION
.. versionadded:: 3.0
This sets the version of PROJ when building pyproj. This
enables installing pyproj when the PROJ executables are not
present but the header files exist.
.. envvar:: PROJ_DIR
This is the path to the base directory for PROJ.
Examples of how to set the PROJ_DIR environment variable:
Windows::
set PROJ_DIR=C:\OSGeo4W\
Linux::
export PROJ_DIR=/usr/local
.. envvar:: PROJ_LIBDIR
This is the path to the directory containing the PROJ libraries.
If not set, it searches the `lib` and `lib64` directories inside
the PROJ directory.
.. envvar:: PROJ_INCDIR
This is the path to the PROJ include directory. If not set, it assumes
it is the `includes` directory inside the PROJ directory.
.. envvar:: PROJ_WHEEL
This is a boolean value used when building a wheel. When true
it includes the contents of the `pyproj/proj_dir/proj/share`
directory if present.
.. envvar:: PYPROJ_FULL_COVERAGE
Boolean that sets the compiler directive for cython to include
the test coverage.
Setup pyproj
------------
In the setup.py, the order for searching for PROJ is:
1. The :envvar:`PROJ_DIR` environment variable
2. The internal PROJ directory (pyproj/proj_dir)
3. The `proj` executable in sys.prefix
4. The `proj` executable on the PATH
For best results, set the :envvar:`PROJ_DIR` environment variable to
point to location of PROJ installation before running setup.py.
If you have a previous version of PROJ installed alongside the current
version of PROJ, the best way to avoid conflicts is to:
1. Remove the previous PROJ from `PATH` & unset the `PROJ_LIB` environment variable (temporarily)
2. Install PROJ to the internal PROJ directory (pyproj/proj_dir)
3. Set the environment variable :envvar:`PROJ_DIR` to point to the internal PROJ directory
4. Set the environment variable :envvar:`PROJ_WHEEL` to true
5. Build pyproj
Install pyproj
~~~~~~~~~~~~~~
.. note:: `Cython `_ or pip>=10.0.1 is required for the installation.
.. note:: You may need to run pip with administrative privileges (e.g. `sudo pip`) or
perform a user only installation (e.g. `pip install --user`).
From pypi:
^^^^^^^^^^
.. code-block:: bash
pip install pyproj --no-binary pyproj
From GitHub with `pip`:
^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: bash
pip install git+https://github.com/pyproj4/pyproj.git
From cloned GitHub repo for development:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: bash
pip install -e .
pyproj-3.3.0/docs/make.bat 0000664 0000000 0000000 00000001400 14145330145 0015370 0 ustar 00root root 0000000 0000000 @ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=python -msphinx
)
set SOURCEDIR=.
set BUILDDIR=_build
set SPHINXPROJ=pyproj
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The Sphinx module was not found. Make sure you have Sphinx installed,
echo.then set the SPHINXBUILD environment variable to point to the full
echo.path of the 'sphinx-build' executable. Alternatively you may add the
echo.Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd
pyproj-3.3.0/docs/media/ 0000775 0000000 0000000 00000000000 14145330145 0015047 5 ustar 00root root 0000000 0000000 pyproj-3.3.0/docs/media/icon.png 0000664 0000000 0000000 00000001551 14145330145 0016507 0 ustar 00root root 0000000 0000000 PNG
IHDR a sBIT|d pHYs I tEXtSoftware www.inkscape.org< tEXtAuthor Sylvain Beorchia>g tEXtCreation Time 2019/10/01V XtEXtCopyright CC0 Public Domain Dedication http://creativecommons.org/publicdomain/zero/1.0/ ;IDAT8Kq?Q&!,^St_ڨ?N*I
"
B4hsJH/mEfXBvyi~;;4ّg=ykf#\[.rE?\cu+ޜֺfL:FeUJK:)W[Xf
l?,Nz_ CVjg53i
+$@?||
WM
Џ"]C[FHF KK}fj *6f(
,yl}2uUr e=F`,3U1rqOG"˘(7Yus&Fy
#kS\?ے6vyVnZf#R+$Py*n<< ZɄwGpNy
ihDu[hzj^G /kUPj0Y8=kK34١gw
ޠU IENDB` pyproj-3.3.0/docs/media/icon.svg 0000664 0000000 0000000 00000007324 14145330145 0016526 0 ustar 00root root 0000000 0000000
pyproj-3.3.0/docs/media/logo.png 0000664 0000000 0000000 00000036643 14145330145 0016531 0 ustar 00root root 0000000 0000000 PNG
IHDR -t sBIT|d pHYs + tEXtSoftware www.inkscape.org< tEXtAuthor Sylvain Beorchia>g tEXtCreation Time 2019/10/01V XtEXtCopyright CC0 Public Domain Dedication http://creativecommons.org/publicdomain/zero/1.0/ IDATxyxT{f&a]6wVK"Q*PW)Ak[Z[j$eVp-E6w6s# If{9Is^Åι/ B!B!B!B!B!B!B!B!B!B!B!B!B! @!5x٘Z:~
)I?!0^
r T:Myt|qO!0EtS]xj?02B1=$~ @`*u+.ʟBa n4eHt;
J4 'BW
aK@ThR$B!"z%c]^'PD#ɟBiwiO!3/$4)O!a]:F4E !abuoh$B!Ugq&J !!5 t
uzz1GVBRO # BonO:OԬ#ҹ S.-5`l*mlU5u!
OF?!@;(&uԜe0 Qk# L5 5P^9nCBO?!MΐͩX"\\@h_VwV? {jшL?!MBgfWpؾ.ӏf<Kwmb Kh䴯BF+?>Trx(3dOu76no [1
sRɹ%վ)IB4*ny.ʫiY,g#'Cۦ=-p3W30=Q]/A&C^
!h:ZTU#hq]'~ GuvkKcf-'`BBB!QP4'C\j:7QxkA,xRFe`+4e^ʝ'M$B!KC+@Em!ֻ]]҄SbOл@ݛnw{h$BѠ4zV|vnۘ@,K#D"݄B4$C$~ pɟzOvÉ0.{hJQ!ɟB㪠hV1apܺDo^8oc٥}kPpɷ !]4LE,`9hMnkE3\3?ź$[9tʟBTo&~ -? xH FT7/hvH? +QA> AxZ
\"h`:Gr\~7Y\R2 zBay+|n8OF>)&h\xULo x$lъ74(R'RW:<Ȗm{:&$E34@KӱAϣ][w%&N9EuD%50K?3놝B!
u~:@x݇`dVtm` V1YJT"tc r*`PQ
I TJd3sW5ׂ$*R_2R[9:?pW$2dzdYѻ+4g-*0}\t$~DT.|=E]4[`:횘k%]z ;5SKDhVU Pj @- H
5?#G >Rީ(OC+y4Hup}1u^@H]Hl5úCY@S 0mqzD(;UP"x2qݨL SK뾿mAf!J@k R
_3 @v;>TLf٘SFRT'&"ZN){l=,Ħg:?]u:2=7
#r+f