From d4c5ef3ebbdc160ba425d5073faddd8713da4ad2 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sun, 10 May 2020 22:30:03 +0200 Subject: [PATCH] Renamed PROJ.4 to PROJ. --- .../gis/db/backends/postgis/operations.py | 6 +++--- .../gis/db/backends/spatialite/operations.py | 4 ++-- django/contrib/gis/gdal/geometries.py | 2 +- django/contrib/gis/gdal/prototypes/srs.py | 2 +- django/contrib/gis/gdal/srs.py | 6 +++--- django/contrib/gis/geos/geometry.py | 2 +- docs/ref/contrib/gis/gdal.txt | 12 ++++++------ docs/ref/contrib/gis/geos.txt | 11 +++++------ docs/ref/contrib/gis/install/geolibs.txt | 16 ++++++++-------- docs/ref/contrib/gis/install/index.txt | 6 +++--- docs/ref/contrib/gis/install/spatialite.txt | 2 +- docs/ref/contrib/gis/layermapping.txt | 2 +- docs/ref/contrib/gis/tutorial.txt | 4 ++-- docs/releases/3.2.txt | 3 ++- tests/gis_tests/gdal_tests/test_srs.py | 2 +- tests/gis_tests/test_spatialrefsys.py | 16 ++++++++-------- 16 files changed, 48 insertions(+), 48 deletions(-) diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index b59393909b..f81f5da152 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -314,7 +314,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): return self._get_postgis_func('postgis_lib_version') 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') def postgis_version(self): @@ -335,7 +335,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): 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. """ proj_regex = re.compile(r'(\d+)\.(\d+)\.(\d+)') @@ -344,7 +344,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): if m: return tuple(map(int, m.groups())) 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): if agg_name == 'Extent3D': diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py index 4d4d84aa6d..332403162c 100644 --- a/django/contrib/gis/db/backends/spatialite/operations.py +++ b/django/contrib/gis/db/backends/spatialite/operations.py @@ -159,8 +159,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): "Return the version of GEOS used by SpatiaLite as a string." return self._get_spatialite_func('geos_version()') - def proj4_version(self): - "Return the version of the PROJ.4 library used by SpatiaLite." + def proj_version(self): + """Return the version of the PROJ library used by SpatiaLite.""" return self._get_spatialite_func('proj4_version()') def lwgeom_version(self): diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index 8ec5683b9c..0aa1161243 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -383,7 +383,7 @@ class OGRGeometry(GDALBase): """ Transform this geometry to a different spatial reference system. 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 set, return a transformed clone of this geometry. """ diff --git a/django/contrib/gis/gdal/prototypes/srs.py b/django/contrib/gis/gdal/prototypes/srs.py index 5d6a65c4fe..5d080d8588 100644 --- a/django/contrib/gis/gdal/prototypes/srs.py +++ b/django/contrib/gis/gdal/prototypes/srs.py @@ -57,7 +57,7 @@ identify_epsg = void_output(lgdal.OSRAutoIdentifyEPSG, [c_void_p]) linear_units = units_func(lgdal.OSRGetLinearUnits) 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_proj = string_output(std_call('OSRExportToProj4'), [c_void_p, POINTER(c_char_p)], decoding='ascii') to_pretty_wkt = string_output( diff --git a/django/contrib/gis/gdal/srs.py b/django/contrib/gis/gdal/srs.py index d2e781e381..fd6509600c 100644 --- a/django/contrib/gis/gdal/srs.py +++ b/django/contrib/gis/gdal/srs.py @@ -53,7 +53,7 @@ class SpatialReference(GDALBase): """ Create a GDAL OSR Spatial Reference object from the given input. 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'). """ if not isinstance(axis_order, (type(None), AxisOrder)): @@ -296,7 +296,7 @@ class SpatialReference(GDALBase): capi.from_epsg(self.ptr, epsg) 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) def import_user_input(self, user_input): @@ -324,7 +324,7 @@ class SpatialReference(GDALBase): @property 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())) @property diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index 8fb0117b3e..e8702db251 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -447,7 +447,7 @@ class GEOSGeometryBase(GEOSBase): """ Requires GDAL. Transform the geometry according to the given 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 geometry and return a transformed clone instead. """ diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt index f022c89040..857d8d02f5 100644 --- a/docs/ref/contrib/gis/gdal.txt +++ b/docs/ref/contrib/gis/gdal.txt @@ -628,7 +628,7 @@ coordinate transformation:: Transforms this geometry to a different spatial reference system. May take a :class:`CoordTransform` object, a :class:`SpatialReference` object, or 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. 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) * EPSG code (integer or string) - * PROJ.4 string + * PROJ string * A shorthand string for well-known standards (``'WGS84'``, ``'WGS72'``, ``'NAD27'``, ``'NAD83'``) @@ -890,8 +890,8 @@ Coordinate System Objects >>> wgs84 = SpatialReference('WGS84') # shorthand string >>> wgs84 = SpatialReference(4326) # EPSG code >>> wgs84 = SpatialReference('EPSG:4326') # EPSG string - >>> proj4 = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ' - >>> wgs84 = SpatialReference(proj4) # PROJ.4 string + >>> proj = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ' + >>> wgs84 = SpatialReference(proj) # PROJ string >>> wgs84 = SpatialReference("""GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, @@ -967,7 +967,7 @@ Coordinate System Objects .. method:: import_proj(proj) - Import spatial reference from PROJ.4 string. + Import spatial reference from PROJ string. .. method:: import_user_input(user_input) @@ -1050,7 +1050,7 @@ Coordinate System Objects .. attribute:: proj - Returns the PROJ.4 representation for this spatial reference. + Returns the PROJ representation for this spatial reference. .. attribute:: proj4 diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt index 74de7b255c..446fb38108 100644 --- a/docs/ref/contrib/gis/geos.txt +++ b/docs/ref/contrib/gis/geos.txt @@ -642,12 +642,11 @@ Other Properties & Methods Transforms the geometry according to the given coordinate transformation parameter (``ct``), which may be an integer SRID, spatial reference WKT - string, a PROJ.4 string, a - :class:`~django.contrib.gis.gdal.SpatialReference` object, or a - :class:`~django.contrib.gis.gdal.CoordTransform` object. By default, the - geometry is transformed in-place and nothing is returned. However if the - ``clone`` keyword is set, then the geometry is not modified and a - transformed clone of the geometry is returned instead. + string, a PROJ string, a :class:`~django.contrib.gis.gdal.SpatialReference` + object, or a :class:`~django.contrib.gis.gdal.CoordTransform` object. By + default, the geometry is transformed in-place and nothing is returned. + However if the ``clone`` keyword is set, then the geometry is not modified + and a transformed clone of the geometry is returned instead. .. note:: diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt index 650577ac9d..1ba1ba0673 100644 --- a/docs/ref/contrib/gis/install/geolibs.txt +++ b/docs/ref/contrib/gis/install/geolibs.txt @@ -9,7 +9,7 @@ geospatial libraries: Program Description Required Supported Versions ======================== ==================================== ================================ =================================== :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:`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 @@ -45,7 +45,7 @@ totally fine with GeoDjango. Your mileage may vary. independently of Django. In other words, no database or settings file 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://www.gaia-gis.it/gaia-sins/ @@ -146,13 +146,13 @@ See also :ref:`My logs are filled with GEOS-related errors `_ requires the ``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 diff --git a/docs/ref/contrib/gis/install/index.txt b/docs/ref/contrib/gis/install/index.txt index b6621f518c..df536f2937 100644 --- a/docs/ref/contrib/gis/install/index.txt +++ b/docs/ref/contrib/gis/install/index.txt @@ -58,10 +58,10 @@ supported versions, and any notes for each of the supported database backends: ================== ============================== ================== ========================================= 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 `. 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 @@ -446,7 +446,7 @@ __ http://www.stickpeople.com/projects/python/win-psycopg/ 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. Select :menuselection:`Express Web-GIS Install` and click next. In the 'Select Packages' list, ensure that GDAL is selected; MapServer and Apache are also diff --git a/docs/ref/contrib/gis/install/spatialite.txt b/docs/ref/contrib/gis/install/spatialite.txt index 9386168ce3..a5a489eb3d 100644 --- a/docs/ref/contrib/gis/install/spatialite.txt +++ b/docs/ref/contrib/gis/install/spatialite.txt @@ -26,7 +26,7 @@ __ https://www.gaia-gis.it/gaia-sins/ Installing from source ====================== -:doc:`GEOS and PROJ.4` should be installed +:doc:`GEOS and PROJ` should be installed prior to building SpatiaLite. SQLite diff --git a/docs/ref/contrib/gis/layermapping.txt b/docs/ref/contrib/gis/layermapping.txt index 9d9fee988f..cbce2aff59 100644 --- a/docs/ref/contrib/gis/layermapping.txt +++ b/docs/ref/contrib/gis/layermapping.txt @@ -114,7 +114,7 @@ Keyword Arguments ``source_srs`` Use this to specify the source SRS manually (for 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` objects are accepted. diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt index 233ac1e8e7..d69f5a7c7c 100644 --- a/docs/ref/contrib/gis/tutorial.txt +++ b/docs/ref/contrib/gis/tutorial.txt @@ -372,7 +372,7 @@ system associated with it. If it does, the ``srs`` attribute will return a SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]] - >>> srs.proj4 # PROJ.4 representation + >>> srs.proj # PROJ representation '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ' 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` (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 ` for more details). If you meet this requirement, then substitute the ``OSMGeoAdmin`` option class diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 3950a70e72..0e0bb4b3bd 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -227,7 +227,8 @@ backends. Miscellaneous ------------- -* ... +* The undocumented ``SpatiaLiteOperations.proj4_version()`` method is renamed + to ``proj_version()``. .. _deprecated-features-3.2: diff --git a/tests/gis_tests/gdal_tests/test_srs.py b/tests/gis_tests/gdal_tests/test_srs.py index 27974c8b80..1dfa05b1d0 100644 --- a/tests/gis_tests/gdal_tests/test_srs.py +++ b/tests/gis_tests/gdal_tests/test_srs.py @@ -181,7 +181,7 @@ class SpatialRefTest(SimpleTestCase): ) def test04_proj(self): - "Test PROJ.4 import and export." + """PROJ import and export.""" proj_parts = [ '+proj=longlat', '+ellps=WGS84', '+towgs84=0,0,0,0,0,0,0', '+datum=WGS84', '+no_defs' ] diff --git a/tests/gis_tests/test_spatialrefsys.py b/tests/gis_tests/test_spatialrefsys.py index 6c5a1b9218..e4638baa31 100644 --- a/tests/gis_tests/test_spatialrefsys.py +++ b/tests/gis_tests/test_spatialrefsys.py @@ -11,7 +11,7 @@ test_srs = ({ # Only the beginning, because there are differences depending on installed libs 'srtext': 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84"', # +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', 'geographic': True, 'projected': False, 'spatialite': True, # From proj's "cs2cs -le" and Wikipedia (semi-minor only) @@ -37,9 +37,9 @@ test_srs = ({ 'PROJCS["NAD83 / Texas South Central",GEOGCS["NAD83",' '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? |' - 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 ?', + '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'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0 )?\+units=m \+no_defs ?', 'spheroid': 'GRS 1980', 'name': 'NAD83 / Texas South Central', 'geographic': False, 'projected': True, 'spatialite': False, # From proj's "cs2cs -le" and Wikipedia (semi-minor only) @@ -74,10 +74,10 @@ class SpatialRefSysTest(TestCase): 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: 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): """ @@ -90,14 +90,14 @@ class SpatialRefSysTest(TestCase): self.assertEqual(sd['projected'], sr.projected) 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 self.assertTrue(sr.name.startswith(sd['name'])) # Testing the SpatialReference object directly. if postgis or spatialite: srs = sr.srs - self.assertRegex(srs.proj4, sd['proj4_re']) + self.assertRegex(srs.proj, sd['proj_re']) self.assertTrue(srs.wkt.startswith(sd['srtext'])) def test_ellipsoid(self):