-
Notifications
You must be signed in to change notification settings - Fork 219
DOC: Add transformation grid documentation page #628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.. _data_directory: | ||
|
||
Data Directory | ||
============== | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
.. _transformation_grids: | ||
|
||
Transformation Grids | ||
===================== | ||
|
||
Transformation grids are necessary when you are performing datum transformations. | ||
|
||
More information about the data available is located under the PROJ | ||
`resource files <https://proj.org/resource_files.html#transformation-grids>`__ | ||
documentation. | ||
|
||
`pyproj` API for managing the :ref:`data_directory` | ||
|
||
.. warning:: pyproj 2 includes datumgrid 1.8 in the wheels. pyproj 3 will not include any datum grids. | ||
|
||
|
||
Downloading data | ||
---------------- | ||
|
||
PROJ 7+ | ||
^^^^^^^^ | ||
|
||
PROJ 7.0 has introduced, per | ||
`PROJ RFC 4: Remote access to grids and GeoTIFF grids <https://proj.org/community/rfc/rfc-4.html#rfc4>`__, | ||
the capability to work with grid files that are not installed on the local machine where PROJ is executed. | ||
|
||
Available methods for download include: | ||
|
||
- `Mirroing the data <https://proj.org/usage/network.html#mirroring>`__: | ||
|
||
.. code-block:: bash | ||
|
||
aws s3 sync s3://cdn.proj.org $(python -c "import pyproj; print(pyproj.datadir.get_data_dir())") | ||
|
||
.. code-block:: bash | ||
|
||
wget --mirror https://cdn.proj.org/ -P $(python -c "import pyproj; print(pyproj.datadir.get_data_dir())") | ||
|
||
- The `projsync <https://proj.org/apps/projsync.html>`__ command line program. | ||
|
||
- Enabling `PROJ network <https://proj.org/usage/network.html>`__ capabilities. | ||
|
||
- Use `conda <https://conda.io/en/latest/>`__ with the `conda-forge <https://conda-forge.org/>`__ channel: | ||
|
||
.. code-block:: bash | ||
|
||
conda install -c conda-forge proj-data | ||
|
||
|
||
PROJ <= 6 | ||
^^^^^^^^^^ | ||
|
||
Available methods for download include: | ||
|
||
- Download stable from https://download.osgeo.org/proj or latest from https://github.com/OSGeo/proj-datumgrid | ||
|
||
- Use `conda <https://conda.io/en/latest/>`__ with the `conda-forge <https://conda-forge.org/>`__ channel: | ||
|
||
.. code-block:: bash | ||
|
||
conda install -c conda-forge proj-datumgrid-europe proj-datumgrid-north-america proj-datumgrid-oceania proj-datumgrid-world | ||
|
||
|
||
What grids to download? | ||
----------------------- | ||
|
||
- Only using the :obj:`pyproj.crs.CRS` or :obj:`pyproj.Geod` classes? Then no grids are needed. | ||
|
||
- Have a machine that can hold and extra 500 MB - 1 GB of data? Then downloading all grids shouldn't be an issue. | ||
|
||
- Have a machine with limited space, a great network connection, and PROJ 7+? Look into `PROJ network <https://proj.org/usage/network.html>`__ capabilities. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With PROJ 7, it will also download the subset of grids you need (and cache those) automatically? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default it isn't enabled. You need to enable it. However, if you installed it via conda-forge it is enabled by default. |
||
- Have a machine with limited space and want to pre-download files? | ||
|
||
The :class:`pyproj.transformer.TransformerGroup` can assist finding the grids you need to download. | ||
|
||
.. 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 | ||
<TransformerGroup: best_available=False> | ||
- 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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not "necessary" (transformations also work if the grids are not available?), but make the transformation more accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true. I guess it depends on your definition of necessary.