Renamed PROJ.4 to PROJ.

This commit is contained in:
Claude Paroz 2020-05-10 22:30:03 +02:00 committed by Mariusz Felisiak
parent fbdb032de2
commit d4c5ef3ebb
16 changed files with 48 additions and 48 deletions

View File

@ -314,7 +314,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
return self._get_postgis_func('postgis_lib_version') return self._get_postgis_func('postgis_lib_version')
def postgis_proj_version(self): def postgis_proj_version(self):
"Return the version of the PROJ.4 library used with PostGIS." """Return the version of the PROJ library used with PostGIS."""
return self._get_postgis_func('postgis_proj_version') return self._get_postgis_func('postgis_proj_version')
def postgis_version(self): def postgis_version(self):
@ -335,7 +335,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
def proj_version_tuple(self): def proj_version_tuple(self):
""" """
Return the version of PROJ.4 used by PostGIS as a tuple of the Return the version of PROJ used by PostGIS as a tuple of the
major, minor, and subminor release numbers. major, minor, and subminor release numbers.
""" """
proj_regex = re.compile(r'(\d+)\.(\d+)\.(\d+)') proj_regex = re.compile(r'(\d+)\.(\d+)\.(\d+)')
@ -344,7 +344,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
if m: if m:
return tuple(map(int, m.groups())) return tuple(map(int, m.groups()))
else: else:
raise Exception('Could not determine PROJ.4 version from PostGIS.') raise Exception('Could not determine PROJ version from PostGIS.')
def spatial_aggregate_name(self, agg_name): def spatial_aggregate_name(self, agg_name):
if agg_name == 'Extent3D': if agg_name == 'Extent3D':

View File

@ -159,8 +159,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
"Return the version of GEOS used by SpatiaLite as a string." "Return the version of GEOS used by SpatiaLite as a string."
return self._get_spatialite_func('geos_version()') return self._get_spatialite_func('geos_version()')
def proj4_version(self): def proj_version(self):
"Return the version of the PROJ.4 library used by SpatiaLite." """Return the version of the PROJ library used by SpatiaLite."""
return self._get_spatialite_func('proj4_version()') return self._get_spatialite_func('proj4_version()')
def lwgeom_version(self): def lwgeom_version(self):

View File

@ -383,7 +383,7 @@ class OGRGeometry(GDALBase):
""" """
Transform this geometry to a different spatial reference system. Transform this geometry to a different spatial reference system.
May take a CoordTransform object, a SpatialReference object, string May take a CoordTransform object, a SpatialReference object, string
WKT or PROJ.4, and/or an integer SRID. By default, return nothing WKT or PROJ, and/or an integer SRID. By default, return nothing
and transform the geometry in-place. However, if the `clone` keyword is and transform the geometry in-place. However, if the `clone` keyword is
set, return a transformed clone of this geometry. set, return a transformed clone of this geometry.
""" """

View File

@ -57,7 +57,7 @@ identify_epsg = void_output(lgdal.OSRAutoIdentifyEPSG, [c_void_p])
linear_units = units_func(lgdal.OSRGetLinearUnits) linear_units = units_func(lgdal.OSRGetLinearUnits)
angular_units = units_func(lgdal.OSRGetAngularUnits) angular_units = units_func(lgdal.OSRGetAngularUnits)
# For exporting to WKT, PROJ.4, "Pretty" WKT, and XML. # For exporting to WKT, PROJ, "Pretty" WKT, and XML.
to_wkt = string_output(std_call('OSRExportToWkt'), [c_void_p, POINTER(c_char_p)], decoding='utf-8') to_wkt = string_output(std_call('OSRExportToWkt'), [c_void_p, POINTER(c_char_p)], decoding='utf-8')
to_proj = string_output(std_call('OSRExportToProj4'), [c_void_p, POINTER(c_char_p)], decoding='ascii') to_proj = string_output(std_call('OSRExportToProj4'), [c_void_p, POINTER(c_char_p)], decoding='ascii')
to_pretty_wkt = string_output( to_pretty_wkt = string_output(

View File

@ -53,7 +53,7 @@ class SpatialReference(GDALBase):
""" """
Create a GDAL OSR Spatial Reference object from the given input. Create a GDAL OSR Spatial Reference object from the given input.
The input may be string of OGC Well Known Text (WKT), an integer The input may be string of OGC Well Known Text (WKT), an integer
EPSG code, a PROJ.4 string, and/or a projection "well known" shorthand EPSG code, a PROJ string, and/or a projection "well known" shorthand
string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83'). string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').
""" """
if not isinstance(axis_order, (type(None), AxisOrder)): if not isinstance(axis_order, (type(None), AxisOrder)):
@ -296,7 +296,7 @@ class SpatialReference(GDALBase):
capi.from_epsg(self.ptr, epsg) capi.from_epsg(self.ptr, epsg)
def import_proj(self, proj): def import_proj(self, proj):
"Import the Spatial Reference from a PROJ.4 string." """Import the Spatial Reference from a PROJ string."""
capi.from_proj(self.ptr, proj) capi.from_proj(self.ptr, proj)
def import_user_input(self, user_input): def import_user_input(self, user_input):
@ -324,7 +324,7 @@ class SpatialReference(GDALBase):
@property @property
def proj(self): def proj(self):
"Return the PROJ.4 representation for this Spatial Reference." """Return the PROJ representation for this Spatial Reference."""
return capi.to_proj(self.ptr, byref(c_char_p())) return capi.to_proj(self.ptr, byref(c_char_p()))
@property @property

View File

@ -447,7 +447,7 @@ class GEOSGeometryBase(GEOSBase):
""" """
Requires GDAL. Transform the geometry according to the given Requires GDAL. Transform the geometry according to the given
transformation object, which may be an integer SRID, and WKT or transformation object, which may be an integer SRID, and WKT or
PROJ.4 string. By default, transform the geometry in-place and return PROJ string. By default, transform the geometry in-place and return
nothing. However if the `clone` keyword is set, don't modify the nothing. However if the `clone` keyword is set, don't modify the
geometry and return a transformed clone instead. geometry and return a transformed clone instead.
""" """

View File

@ -628,7 +628,7 @@ coordinate transformation::
Transforms this geometry to a different spatial reference system. May take Transforms this geometry to a different spatial reference system. May take
a :class:`CoordTransform` object, a :class:`SpatialReference` object, or a :class:`CoordTransform` object, a :class:`SpatialReference` object, or
any other input accepted by :class:`SpatialReference` (including spatial any other input accepted by :class:`SpatialReference` (including spatial
reference WKT and PROJ.4 strings, or an integer SRID). reference WKT and PROJ strings, or an integer SRID).
By default nothing is returned and the geometry is transformed in-place. By default nothing is returned and the geometry is transformed in-place.
However, if the ``clone`` keyword is set to ``True`` then a transformed However, if the ``clone`` keyword is set to ``True`` then a transformed
@ -881,7 +881,7 @@ Coordinate System Objects
* OGC Well Known Text (WKT) (a string) * OGC Well Known Text (WKT) (a string)
* EPSG code (integer or string) * EPSG code (integer or string)
* PROJ.4 string * PROJ string
* A shorthand string for well-known standards (``'WGS84'``, ``'WGS72'``, * A shorthand string for well-known standards (``'WGS84'``, ``'WGS72'``,
``'NAD27'``, ``'NAD83'``) ``'NAD27'``, ``'NAD83'``)
@ -890,8 +890,8 @@ Coordinate System Objects
>>> wgs84 = SpatialReference('WGS84') # shorthand string >>> wgs84 = SpatialReference('WGS84') # shorthand string
>>> wgs84 = SpatialReference(4326) # EPSG code >>> wgs84 = SpatialReference(4326) # EPSG code
>>> wgs84 = SpatialReference('EPSG:4326') # EPSG string >>> wgs84 = SpatialReference('EPSG:4326') # EPSG string
>>> proj4 = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ' >>> proj = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs '
>>> wgs84 = SpatialReference(proj4) # PROJ.4 string >>> wgs84 = SpatialReference(proj) # PROJ string
>>> wgs84 = SpatialReference("""GEOGCS["WGS 84", >>> wgs84 = SpatialReference("""GEOGCS["WGS 84",
DATUM["WGS_1984", DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563, SPHEROID["WGS 84",6378137,298.257223563,
@ -967,7 +967,7 @@ Coordinate System Objects
.. method:: import_proj(proj) .. method:: import_proj(proj)
Import spatial reference from PROJ.4 string. Import spatial reference from PROJ string.
.. method:: import_user_input(user_input) .. method:: import_user_input(user_input)
@ -1050,7 +1050,7 @@ Coordinate System Objects
.. attribute:: proj .. attribute:: proj
Returns the PROJ.4 representation for this spatial reference. Returns the PROJ representation for this spatial reference.
.. attribute:: proj4 .. attribute:: proj4

View File

@ -642,12 +642,11 @@ Other Properties & Methods
Transforms the geometry according to the given coordinate transformation Transforms the geometry according to the given coordinate transformation
parameter (``ct``), which may be an integer SRID, spatial reference WKT parameter (``ct``), which may be an integer SRID, spatial reference WKT
string, a PROJ.4 string, a string, a PROJ string, a :class:`~django.contrib.gis.gdal.SpatialReference`
:class:`~django.contrib.gis.gdal.SpatialReference` object, or a object, or a :class:`~django.contrib.gis.gdal.CoordTransform` object. By
:class:`~django.contrib.gis.gdal.CoordTransform` object. By default, the default, the geometry is transformed in-place and nothing is returned.
geometry is transformed in-place and nothing is returned. However if the However if the ``clone`` keyword is set, then the geometry is not modified
``clone`` keyword is set, then the geometry is not modified and a and a transformed clone of the geometry is returned instead.
transformed clone of the geometry is returned instead.
.. note:: .. note::

View File

@ -9,7 +9,7 @@ geospatial libraries:
Program Description Required Supported Versions Program Description Required Supported Versions
======================== ==================================== ================================ =================================== ======================== ==================================== ================================ ===================================
:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.8, 3.7, 3.6, 3.5 :doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.8, 3.7, 3.6, 3.5
`PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 6.3, 6.2, 6.1, 6.0, 5.x, 4.x `PROJ`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 6.x, 5.x, 4.x
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.1, 3.0, 2.4, 2.3, 2.2, 2.1, 2.0 :doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 3.1, 3.0, 2.4, 2.3, 2.2, 2.1, 2.0
:doc:`GeoIP <../geoip2>` IP-based geolocation library No 2 :doc:`GeoIP <../geoip2>` IP-based geolocation library No 2
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.0, 2.5, 2.4, 2.3, 2.2 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.0, 2.5, 2.4, 2.3, 2.2
@ -45,7 +45,7 @@ totally fine with GeoDjango. Your mileage may vary.
independently of Django. In other words, no database or settings file independently of Django. In other words, no database or settings file
required -- import them as normal from :mod:`django.contrib.gis`. required -- import them as normal from :mod:`django.contrib.gis`.
.. _PROJ.4: https://github.com/OSGeo/proj.4/wiki/ .. _PROJ: https://proj.org/
__ https://postgis.net/ __ https://postgis.net/
__ https://www.gaia-gis.it/gaia-sins/ __ https://www.gaia-gis.it/gaia-sins/
@ -146,13 +146,13 @@ See also :ref:`My logs are filled with GEOS-related errors <geos-exceptions-in-l
.. _proj4: .. _proj4:
PROJ.4 PROJ
------ ----
`PROJ.4`_ is a library for converting geospatial data to different coordinate `PROJ`_ is a library for converting geospatial data to different coordinate
reference systems. reference systems.
First, download the PROJ.4 source code and datum shifting files [#]_:: First, download the PROJ source code and datum shifting files [#]_::
$ wget https://download.osgeo.org/proj/proj-X.Y.Z.tar.gz $ wget https://download.osgeo.org/proj/proj-X.Y.Z.tar.gz
$ wget https://download.osgeo.org/proj/proj-datumgrid-X.Y.tar.gz $ wget https://download.osgeo.org/proj/proj-datumgrid-X.Y.tar.gz
@ -165,7 +165,7 @@ Next, untar the source code archive, and extract the datum shifting files in the
$ tar xzf ../../proj-datumgrid-X.Y.tar.gz $ tar xzf ../../proj-datumgrid-X.Y.tar.gz
$ cd .. $ cd ..
Finally, configure, make and install PROJ.4:: Finally, configure, make and install PROJ::
$ ./configure $ ./configure
$ make $ make
@ -234,7 +234,7 @@ the GDAL library. For example::
.. rubric:: Footnotes .. rubric:: Footnotes
.. [#] The datum shifting files are needed for converting data to and from .. [#] The datum shifting files are needed for converting data to and from
certain projections. certain projections.
For example, the PROJ.4 string for the `Google projection (900913 or 3857) For example, the PROJ string for the `Google projection (900913 or 3857)
<https://spatialreference.org/ref/sr-org/6864/prj/>`_ requires the <https://spatialreference.org/ref/sr-org/6864/prj/>`_ requires the
``null`` grid file only included in the extra datum shifting files. ``null`` grid file only included in the extra datum shifting files.
It is easier to install the shifting files now, then to have debug a It is easier to install the shifting files now, then to have debug a

View File

@ -58,10 +58,10 @@ supported versions, and any notes for each of the supported database backends:
================== ============================== ================== ========================================= ================== ============================== ================== =========================================
Database Library Requirements Supported Versions Notes Database Library Requirements Supported Versions Notes
================== ============================== ================== ========================================= ================== ============================== ================== =========================================
PostgreSQL GEOS, GDAL, PROJ.4, PostGIS 9.5+ Requires PostGIS. PostgreSQL GEOS, GDAL, PROJ, PostGIS 9.5+ Requires PostGIS.
MySQL GEOS, GDAL 5.6.1+ :ref:`Limited functionality <mysql-spatial-limitations>`. MySQL GEOS, GDAL 5.6.1+ :ref:`Limited functionality <mysql-spatial-limitations>`.
Oracle GEOS, GDAL 12.2+ XE not supported. Oracle GEOS, GDAL 12.2+ XE not supported.
SQLite GEOS, GDAL, PROJ.4, SpatiaLite 3.8.3+ Requires SpatiaLite 4.3+ SQLite GEOS, GDAL, PROJ, SpatiaLite 3.8.3+ Requires SpatiaLite 4.3+
================== ============================== ================== ========================================= ================== ============================== ================== =========================================
See also `this comparison matrix`__ on the OSGeo Wiki for See also `this comparison matrix`__ on the OSGeo Wiki for
@ -446,7 +446,7 @@ __ http://www.stickpeople.com/projects/python/win-psycopg/
OSGeo4W OSGeo4W
~~~~~~~ ~~~~~~~
The `OSGeo4W installer`_ helps to install the PROJ.4, GDAL, and GEOS libraries The `OSGeo4W installer`_ helps to install the PROJ, GDAL, and GEOS libraries
required by GeoDjango. First, download the `OSGeo4W installer`_, and run it. required by GeoDjango. First, download the `OSGeo4W installer`_, and run it.
Select :menuselection:`Express Web-GIS Install` and click next. In the 'Select Select :menuselection:`Express Web-GIS Install` and click next. In the 'Select
Packages' list, ensure that GDAL is selected; MapServer and Apache are also Packages' list, ensure that GDAL is selected; MapServer and Apache are also

View File

@ -26,7 +26,7 @@ __ https://www.gaia-gis.it/gaia-sins/
Installing from source Installing from source
====================== ======================
:doc:`GEOS and PROJ.4</ref/contrib/gis/install/geolibs>` should be installed :doc:`GEOS and PROJ</ref/contrib/gis/install/geolibs>` should be installed
prior to building SpatiaLite. prior to building SpatiaLite.
SQLite SQLite

View File

@ -114,7 +114,7 @@ Keyword Arguments
``source_srs`` Use this to specify the source SRS manually (for ``source_srs`` Use this to specify the source SRS manually (for
example, some shapefiles don't come with a ``'.prj'`` example, some shapefiles don't come with a ``'.prj'``
file). An integer SRID, WKT or PROJ.4 strings, and file). An integer SRID, WKT or PROJ strings, and
:class:`django.contrib.gis.gdal.SpatialReference` :class:`django.contrib.gis.gdal.SpatialReference`
objects are accepted. objects are accepted.

View File

@ -372,7 +372,7 @@ system associated with it. If it does, the ``srs`` attribute will return a
SPHEROID["WGS_1984",6378137.0,298.257223563]], SPHEROID["WGS_1984",6378137.0,298.257223563]],
PRIMEM["Greenwich",0.0], PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]] UNIT["Degree",0.0174532925199433]]
>>> srs.proj4 # PROJ.4 representation >>> srs.proj # PROJ representation
'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ' '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs '
This shapefile is in the popular WGS84 spatial reference This shapefile is in the popular WGS84 spatial reference
@ -751,7 +751,7 @@ This provides more context (including street and thoroughfare details) than
available with the :class:`~django.contrib.gis.admin.GeoModelAdmin` available with the :class:`~django.contrib.gis.admin.GeoModelAdmin`
(which uses the `Vector Map Level 0`_ WMS dataset hosted at `OSGeo`_). (which uses the `Vector Map Level 0`_ WMS dataset hosted at `OSGeo`_).
The PROJ.4 datum shifting files must be installed (see the :ref:`PROJ.4 The PROJ datum shifting files must be installed (see the :ref:`PROJ
installation instructions <proj4>` for more details). installation instructions <proj4>` for more details).
If you meet this requirement, then substitute the ``OSMGeoAdmin`` option class If you meet this requirement, then substitute the ``OSMGeoAdmin`` option class

View File

@ -227,7 +227,8 @@ backends.
Miscellaneous Miscellaneous
------------- -------------
* ... * The undocumented ``SpatiaLiteOperations.proj4_version()`` method is renamed
to ``proj_version()``.
.. _deprecated-features-3.2: .. _deprecated-features-3.2:

View File

@ -181,7 +181,7 @@ class SpatialRefTest(SimpleTestCase):
) )
def test04_proj(self): def test04_proj(self):
"Test PROJ.4 import and export." """PROJ import and export."""
proj_parts = [ proj_parts = [
'+proj=longlat', '+ellps=WGS84', '+towgs84=0,0,0,0,0,0,0', '+datum=WGS84', '+no_defs' '+proj=longlat', '+ellps=WGS84', '+towgs84=0,0,0,0,0,0,0', '+datum=WGS84', '+no_defs'
] ]

View File

@ -11,7 +11,7 @@ test_srs = ({
# Only the beginning, because there are differences depending on installed libs # Only the beginning, because there are differences depending on installed libs
'srtext': 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84"', 'srtext': 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84"',
# +ellps=WGS84 has been removed in the 4326 proj string in proj-4.8 # +ellps=WGS84 has been removed in the 4326 proj string in proj-4.8
'proj4_re': r'\+proj=longlat (\+ellps=WGS84 )?(\+datum=WGS84 |\+towgs84=0,0,0,0,0,0,0 )\+no_defs ?', 'proj_re': r'\+proj=longlat (\+ellps=WGS84 )?(\+datum=WGS84 |\+towgs84=0,0,0,0,0,0,0 )\+no_defs ?',
'spheroid': 'WGS 84', 'name': 'WGS 84', 'spheroid': 'WGS 84', 'name': 'WGS 84',
'geographic': True, 'projected': False, 'spatialite': True, 'geographic': True, 'projected': False, 'spatialite': True,
# From proj's "cs2cs -le" and Wikipedia (semi-minor only) # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
@ -37,7 +37,7 @@ test_srs = ({
'PROJCS["NAD83 / Texas South Central",GEOGCS["NAD83",' 'PROJCS["NAD83 / Texas South Central",GEOGCS["NAD83",'
'DATUM["North_American_Datum_1983",SPHEROID["GRS 1980"' 'DATUM["North_American_Datum_1983",SPHEROID["GRS 1980"'
), ),
'proj4_re': r'\+proj=lcc (\+lat_1=30.28333333333333? |\+lat_2=28.38333333333333? |\+lat_0=27.83333333333333? |' 'proj_re': r'\+proj=lcc (\+lat_1=30.28333333333333? |\+lat_2=28.38333333333333? |\+lat_0=27.83333333333333? |'
r'\+lon_0=-99 ){4}\+x_0=600000 \+y_0=4000000 (\+ellps=GRS80 )?' r'\+lon_0=-99 ){4}\+x_0=600000 \+y_0=4000000 (\+ellps=GRS80 )?'
r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0 )?\+units=m \+no_defs ?', r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0 )?\+units=m \+no_defs ?',
'spheroid': 'GRS 1980', 'name': 'NAD83 / Texas South Central', 'spheroid': 'GRS 1980', 'name': 'NAD83 / Texas South Central',
@ -74,10 +74,10 @@ class SpatialRefSysTest(TestCase):
self.assertEqual(sd['auth_srid'], srs.auth_srid) self.assertEqual(sd['auth_srid'], srs.auth_srid)
# No proj.4 and different srtext on oracle backends :( # No PROJ and different srtext on oracle backends :(
if postgis: if postgis:
self.assertTrue(srs.wkt.startswith(sd['srtext'])) self.assertTrue(srs.wkt.startswith(sd['srtext']))
self.assertRegex(srs.proj4text, sd['proj4_re']) self.assertRegex(srs.proj4text, sd['proj_re'])
def test_osr(self): def test_osr(self):
""" """
@ -90,14 +90,14 @@ class SpatialRefSysTest(TestCase):
self.assertEqual(sd['projected'], sr.projected) self.assertEqual(sd['projected'], sr.projected)
if not (spatialite and not sd['spatialite']): if not (spatialite and not sd['spatialite']):
# Can't get 'NAD83 / Texas South Central' from PROJ.4 string # Can't get 'NAD83 / Texas South Central' from PROJ string
# on SpatiaLite # on SpatiaLite
self.assertTrue(sr.name.startswith(sd['name'])) self.assertTrue(sr.name.startswith(sd['name']))
# Testing the SpatialReference object directly. # Testing the SpatialReference object directly.
if postgis or spatialite: if postgis or spatialite:
srs = sr.srs srs = sr.srs
self.assertRegex(srs.proj4, sd['proj4_re']) self.assertRegex(srs.proj, sd['proj_re'])
self.assertTrue(srs.wkt.startswith(sd['srtext'])) self.assertTrue(srs.wkt.startswith(sd['srtext']))
def test_ellipsoid(self): def test_ellipsoid(self):