[Git][debian-gis-team/python-mapnik][master] Adding proj support from upstream branch

Angelos Tzotsos (@kalxas-guest) gitlab at salsa.debian.org
Thu Aug 4 09:17:34 BST 2022



Angelos Tzotsos pushed to branch master at Debian GIS Project / python-mapnik


Commits:
9dca2919 by Angelos Tzotsos at 2022-08-04T11:17:22+03:00
Adding proj support from upstream branch

- - - - -


4 changed files:

- debian/changelog
- + debian/patches/proj6.patch
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,10 +1,15 @@
 python-mapnik (1:0.0~20200224-7da019cf9-4) UNRELEASED; urgency=medium
 
+  [ Bas Couwenberg ]
   * Bump Standards-Version to 4.6.1, no changes.
   * Bump debhelper compat to 12, changes:
     - Drop --list-missing from dh_install
 
- -- Bas Couwenberg <sebastic at debian.org>  Wed, 08 Sep 2021 17:42:55 +0200
+  [Angelos Tzotsos ]
+  * Applied upstream proj6 branch patch.
+  * Disabled tests since not included in the proj patch.
+
+ -- Angelos Tzotsos <gcpp.kalxas at gmail.com>  Wed, 03 Aug 2022 13:00:00 +0300
 
 python-mapnik (1:0.0~20200224-7da019cf9-3) unstable; urgency=medium
 


=====================================
debian/patches/proj6.patch
=====================================
@@ -0,0 +1,379 @@
+From dcd7b68916f78e4c9e18b0bbf7bee545244f4765 Mon Sep 17 00:00:00 2001
+From: Artem Pavlenko <artem at mapnik.org>
+Date: Fri, 19 Mar 2021 17:10:29 +0000
+Subject: [PATCH] Update to use libproj >=6 projection initialisation syntax
+ [skip ci]
+
+---
+ mapnik/__init__.py                            |  4 +--
+ src/mapnik_layer.cpp                          | 36 +++++++++----------
+ src/mapnik_map.cpp                            | 20 +++++------
+ src/mapnik_proj_transform.cpp                 | 17 ++++-----
+ src/mapnik_projection.cpp                     |  8 ++---
+ src/mapnik_python.cpp                         | 10 +++---
+ .../agg_rasterizer_integer_overflow_test.py   |  4 +--
+ test/python_tests/datasource_test.py          |  2 +-
+ test/python_tests/layer_modification_test.py  |  4 +--
+ test/python_tests/layer_test.py               |  2 +-
+ test/python_tests/multi_tile_raster_test.py   |  2 +-
+ test/python_tests/object_test.py              |  4 +--
+ test/python_tests/ogr_test.py                 | 10 +++---
+ test/python_tests/projection_test.py          | 18 +++++-----
+ test/python_tests/query_tolerance_test.py     |  2 +-
+ test/python_tests/raster_symbolizer_test.py   | 12 +++----
+ test/python_tests/render_test.py              |  8 ++---
+ 17 files changed, 82 insertions(+), 81 deletions(-)
+
+diff --git a/mapnik/__init__.py b/mapnik/__init__.py
+index 4d99ad14b..213242632 100644
+--- a/mapnik/__init__.py
++++ b/mapnik/__init__.py
+@@ -156,7 +156,7 @@ def forward(self, projection):
+         Example: Project the geographic coordinates of the
+                  city center of Stuttgart into the local
+                  map projection (GK Zone 3/DHDN, EPSG 31467)
+-        >>> p = Projection('+init=epsg:31467')
++        >>> p = Projection('epsg:31467')
+         >>> Coord(9.1, 48.7).forward(p)
+         Coord(3507360.12813,5395719.2749)
+         """
+@@ -176,7 +176,7 @@ def inverse(self, projection):
+                  city center of Stuttgart in the local
+                  map projection (GK Zone 3/DHDN, EPSG 31467)
+                  into geographic coordinates:
+-        >>> p = Projection('+init=epsg:31467')
++        >>> p = Projection('epsg:31467')
+         >>> Coord(3507360.12813,5395719.2749).inverse(p)
+         Coord(9.1, 48.7)
+         """
+diff --git a/src/mapnik_layer.cpp b/src/mapnik_layer.cpp
+index a7caf38d3..4fc7ea579 100644
+--- a/src/mapnik_layer.cpp
++++ b/src/mapnik_layer.cpp
+@@ -146,13 +146,13 @@ void export_layer()
+     class_<layer>("Layer", "A Mapnik map layer.", init<std::string const&,optional<std::string const&> >(
+                       "Create a Layer with a named string and, optionally, an srs string.\n"
+                       "\n"
+-                      "The srs can be either a Proj.4 epsg code ('+init=epsg:<code>') or\n"
+-                      "of a Proj.4 literal ('+proj=<literal>').\n"
+-                      "If no srs is specified it will default to '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
++                      "The srs can be either a Proj epsg code ('epsg:<code>') or\n"
++                      "of a Proj literal ('+proj=<literal>').\n"
++                      "If no srs is specified it will default to 'epsg:4326'\n"
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import Layer\n"
+-                      ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = Layer('My Layer','epsg:4326')\n"
+                       ">>> lyr\n"
+                       "<mapnik._mapnik.Layer object at 0x6a270>\n"
+                       ))
+@@ -166,7 +166,7 @@ void export_layer()
+              "\n"
+              "Usage:\n"
+              ">>> from mapnik import Layer\n"
+-             ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++             ">>> lyr = Layer('My Layer','epsg:4326')\n"
+              ">>> lyr.envelope()\n"
+              "box2d(-1.0,-1.0,0.0,0.0) # default until a datasource is loaded\n"
+             )
+@@ -183,7 +183,7 @@ void export_layer()
+              "\n"
+              "Usage:\n"
+              ">>> from mapnik import Layer\n"
+-             ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++             ">>> lyr = Layer('My Layer','epsg:4326')\n"
+              ">>> lyr.visible(1.0/1000000)\n"
+              "True\n"
+              ">>> lyr.active = False\n"
+@@ -198,7 +198,7 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import Layer\n"
+-                      ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = Layer('My Layer','epsg:4326')\n"
+                       ">>> lyr.active\n"
+                       "True # Active by default\n"
+                       ">>> lyr.active = False # set False to disable layer rendering\n"
+@@ -213,7 +213,7 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import Layer\n"
+-                      ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = Layer('My Layer','epsg:4326')\n"
+                       ">>> lyr.status\n"
+                       "True # Active by default\n"
+                       ">>> lyr.status = False # set False to disable layer rendering\n"
+@@ -250,7 +250,7 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import Layer, Datasource\n"
+-                      ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = Layer('My Layer','epsg:4326')\n"
+                       ">>> lyr.datasource = Datasource(type='shape',file='world_borders')\n"
+                       ">>> lyr.datasource\n"
+                       "<mapnik.Datasource object at 0x65470>\n"
+@@ -285,7 +285,7 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import Layer\n"
+-                      ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = Layer('My Layer','epsg:4326')\n"
+                       ">>> lyr.maximum_scale_denominator\n"
+                       "1.7976931348623157e+308 # default is the numerical maximum\n"
+                       ">>> lyr.maximum_scale_denominator = 1.0/1000000\n"
+@@ -300,7 +300,7 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import Layer\n"
+-                      ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = Layer('My Layer','epsg:4326')\n"
+                       ">>> lyr.minimum_scale_denominator # default is 0\n"
+                       "0.0\n"
+                       ">>> lyr.minimum_scale_denominator = 1.0/1000000\n"
+@@ -315,7 +315,7 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import Layer\n"
+-                      ">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = Layer('My Layer','epsg:4326')\n"
+                       ">>> lyr.name\n"
+                       "'My Layer'\n"
+                       ">>> lyr.name = 'New Name'\n"
+@@ -330,7 +330,7 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import layer\n"
+-                      ">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = layer('My layer','epsg:4326')\n"
+                       ">>> lyr.queryable\n"
+                       "False # Not queryable by default\n"
+                       ">>> lyr.queryable = True\n"
+@@ -345,12 +345,12 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import layer\n"
+-                      ">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = layer('My layer','epsg:4326')\n"
+                       ">>> lyr.srs\n"
+-                      "'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' # The default srs if not initialized with custom srs\n"
+-                      ">>> # set to google mercator with Proj.4 literal\n"
++                      "'epsg:4326' # The default srs if not initialized with custom srs\n"
++                      ">>> # set to google mercator with Proj literal\n"
+                       "... \n"
+-                      ">>> lyr.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over'\n"
++                      ">>> lyr.srs = 'epsg:3857'\n"
+             )
+ 
+         .add_property("group_by",
+@@ -367,7 +367,7 @@ void export_layer()
+                       "\n"
+                       "Usage:\n"
+                       ">>> from mapnik import layer\n"
+-                      ">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
++                      ">>> lyr = layer('My layer','epsg:4326')\n"
+                       ">>> lyr.styles\n"
+                       "<mapnik._mapnik.Names object at 0x6d3e8>\n"
+                       ">>> len(lyr.styles)\n"
+diff --git a/src/mapnik_map.cpp b/src/mapnik_map.cpp
+index 3036cf89b..3587e5d8a 100644
+--- a/src/mapnik_map.cpp
++++ b/src/mapnik_map.cpp
+@@ -165,9 +165,9 @@ void export_map()
+     class_<Map>("Map","The map object.",init<int,int,optional<std::string const&> >(
+                     ( arg("width"),arg("height"),arg("srs") ),
+                     "Create a Map with a width and height as integers and, optionally,\n"
+-                    "an srs string either with a Proj.4 epsg code ('+init=epsg:<code>')\n"
+-                    "or with a Proj.4 literal ('+proj=<literal>').\n"
+-                    "If no srs is specified the map will default to '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
++                    "an srs string either with a Proj epsg code ('epsg:<code>')\n"
++                    "or with a Proj literal ('+proj=<literal>').\n"
++                    "If no srs is specified the map will default to 'epsg:4326'\n"
+                     "\n"
+                     "Usage:\n"
+                     ">>> from mapnik import Map\n"
+@@ -175,7 +175,7 @@ void export_map()
+                     ">>> m\n"
+                     "<mapnik._mapnik.Map object at 0x6a240>\n"
+                     ">>> m.srs\n"
+-                    "'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
++                    "'epsg:4326'\n"
+                     ))
+ 
+         .def("append_style",insert_style,
+@@ -502,22 +502,22 @@ void export_map()
+         .add_property("srs",
+                       make_function(&Map::srs,return_value_policy<copy_const_reference>()),
+                       &Map::set_srs,
+-                      "Spatial reference in Proj.4 format.\n"
++                      "Spatial reference in Proj format.\n"
+                       "Either an epsg code or proj literal.\n"
+                       "For example, a proj literal:\n"
+-                      "\t'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
++                      "\t'epsg:4326'\n"
+                       "and a proj epsg code:\n"
+-                      "\t'+init=epsg:4326'\n"
++                      "\t'epsg:4326'\n"
+                       "\n"
+                       "Note: using epsg codes requires the installation of\n"
+-                      "the Proj.4 'epsg' data file normally found in '/usr/local/share/proj'\n"
++                      "the Proj 'epsg' data file normally found in '/usr/local/share/proj'\n"
+                       "\n"
+                       "Usage:\n"
+                       ">>> m.srs\n"
+-                      "'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' # The default srs if not initialized with custom srs\n"
++                      "'epsg:4326' # The default srs if not initialized with custom srs\n"
+                       ">>> # set to google mercator with Proj.4 literal\n"
+                       "... \n"
+-                      ">>> m.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over'\n"
++                      ">>> m.srs = 'epsg:3857'\n"
+             )
+ 
+         .add_property("width",
+diff --git a/src/mapnik_proj_transform.cpp b/src/mapnik_proj_transform.cpp
+index fc753564c..8588e9fb7 100644
+--- a/src/mapnik_proj_transform.cpp
++++ b/src/mapnik_proj_transform.cpp
+@@ -48,7 +48,7 @@ struct proj_transform_pickle_suite : boost::python::pickle_suite
+     getinitargs(const proj_transform& p)
+     {
+         using namespace boost::python;
+-        return boost::python::make_tuple(p.source(),p.dest());
++        return boost::python::make_tuple(p.definition());
+     }
+ };
+ 
+@@ -62,7 +62,7 @@ mapnik::coord2d forward_transform_c(mapnik::proj_transform& t, mapnik::coord2d c
+     if (!t.forward(x,y,z)) {
+         std::ostringstream s;
+         s << "Failed to forward project "
+-          << "from " << t.source().params() << " to: " << t.dest().params();
++          << t.definition();
+         throw std::runtime_error(s.str());
+     }
+     return mapnik::coord2d(x,y);
+@@ -76,7 +76,7 @@ mapnik::coord2d backward_transform_c(mapnik::proj_transform& t, mapnik::coord2d
+     if (!t.backward(x,y,z)) {
+         std::ostringstream s;
+         s << "Failed to back project "
+-          << "from " <<  t.dest().params() << " to: " << t.source().params();
++         << t.definition();
+         throw std::runtime_error(s.str());
+     }
+     return mapnik::coord2d(x,y);
+@@ -88,7 +88,7 @@ mapnik::box2d<double> forward_transform_env(mapnik::proj_transform& t, mapnik::b
+     if (!t.forward(new_box)) {
+         std::ostringstream s;
+         s << "Failed to forward project "
+-          << "from " << t.source().params() << " to: " << t.dest().params();
++          << t.definition();
+         throw std::runtime_error(s.str());
+     }
+     return new_box;
+@@ -100,7 +100,7 @@ mapnik::box2d<double> backward_transform_env(mapnik::proj_transform& t, mapnik::
+     if (!t.backward(new_box)){
+         std::ostringstream s;
+         s << "Failed to back project "
+-          << "from " <<  t.dest().params() << " to: " << t.source().params();
++          << t.definition();
+         throw std::runtime_error(s.str());
+     }
+     return new_box;
+@@ -112,7 +112,7 @@ mapnik::box2d<double> forward_transform_env_p(mapnik::proj_transform& t, mapnik:
+     if (!t.forward(new_box,points)) {
+         std::ostringstream s;
+         s << "Failed to forward project "
+-          << "from " << t.source().params() << " to: " << t.dest().params();
++          << t.definition();
+         throw std::runtime_error(s.str());
+     }
+     return new_box;
+@@ -124,7 +124,7 @@ mapnik::box2d<double> backward_transform_env_p(mapnik::proj_transform& t, mapnik
+     if (!t.backward(new_box,points)){
+         std::ostringstream s;
+         s << "Failed to back project "
+-          << "from " <<  t.dest().params() << " to: " << t.source().params();
++          <<  t.definition();
+         throw std::runtime_error(s.str());
+     }
+     return new_box;
+@@ -136,7 +136,7 @@ void export_proj_transform ()
+ {
+     using namespace boost::python;
+ 
+-    class_<proj_transform, boost::noncopyable>("ProjTransform", init< projection const&, projection const& >())
++    class_<proj_transform, boost::noncopyable>("ProjTransform", init<projection const&, projection const&>())
+         .def_pickle(proj_transform_pickle_suite())
+         .def("forward", forward_transform_c)
+         .def("backward",backward_transform_c)
+@@ -144,6 +144,7 @@ void export_proj_transform ()
+         .def("backward",backward_transform_env)
+         .def("forward", forward_transform_env_p)
+         .def("backward",backward_transform_env_p)
++        .def("definition",&proj_transform::definition)
+         ;
+ 
+ }
+diff --git a/src/mapnik_projection.cpp b/src/mapnik_projection.cpp
+index c2088cd89..8875fa62b 100644
+--- a/src/mapnik_projection.cpp
++++ b/src/mapnik_projection.cpp
+@@ -95,8 +95,8 @@ void export_projection ()
+     using namespace boost::python;
+ 
+     class_<projection>("Projection", "Represents a map projection.",init<std::string const&>(
+-                           (arg("proj4_string")),
+-                           "Constructs a new projection from its PROJ.4 string representation.\n"
++                           (arg("proj_string")),
++                           "Constructs a new projection from its PROJ string representation.\n"
+                            "\n"
+                            "The constructor will throw a RuntimeError in case the projection\n"
+                            "cannot be initialized.\n"
+@@ -105,9 +105,9 @@ void export_projection ()
+         .def_pickle(projection_pickle_suite())
+         .def ("params", make_function(&projection::params,
+                                       return_value_policy<copy_const_reference>()),
+-              "Returns the PROJ.4 string for this projection.\n")
++              "Returns the PROJ string for this projection.\n")
+         .def ("expanded",&projection::expanded,
+-              "normalize PROJ.4 definition by expanding +init= syntax\n")
++              "normalize PROJ definition by expanding epsg:XXXX syntax\n")
+         .add_property ("geographic", &projection::is_geographic,
+                        "This property is True if the projection is a geographic projection\n"
+                        "(i.e. it uses lon/lat coordinates)\n")
+diff --git a/src/mapnik_python.cpp b/src/mapnik_python.cpp
+index 14523b034..50b5544e4 100644
+--- a/src/mapnik_python.cpp
++++ b/src/mapnik_python.cpp
+@@ -598,9 +598,9 @@ std::string mapnik_version_string()
+     return MAPNIK_VERSION_STRING;
+ }
+ 
+-bool has_proj4()
++bool has_proj()
+ {
+-#if defined(MAPNIK_USE_PROJ4)
++#if defined(MAPNIK_USE_PROJ)
+     return true;
+ #else
+     return false;
+@@ -1035,8 +1035,8 @@ BOOST_PYTHON_MODULE(_mapnik)
+   ">>> m = Map(256,256)\n"
+   ">>> load_map(m,'mapfile_wgs84.xml')\n"
+   ">>> m.srs\n"
+-  "'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
+-  ">>> m.srs = '+init=espg:3395'\n"
++  "'epsg:4326'\n"
++  ">>> m.srs = 'espg:3395'\n"
+   ">>> save_map(m,'mapfile_mercator.xml')\n"
+   "\n"
+   );
+@@ -1045,7 +1045,7 @@ BOOST_PYTHON_MODULE(_mapnik)
+     def("save_map_to_string", &save_map_to_string, save_map_to_string_overloads());
+     def("mapnik_version", &mapnik_version,"Get the Mapnik version number");
+     def("mapnik_version_string", &mapnik_version_string,"Get the Mapnik version string");
+-    def("has_proj4", &has_proj4, "Get proj4 status");
++    def("has_proj", &has_proj, "Get proj status");
+     def("has_jpeg", &has_jpeg, "Get jpeg read/write support status");
+     def("has_png", &has_png, "Get png read/write support status");
+     def("has_tiff", &has_tiff, "Get tiff read/write support status");


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 skip-tests-for-missing-data.patch
 boost1.71.patch
+proj6.patch


=====================================
debian/rules
=====================================
@@ -30,7 +30,7 @@ override_dh_auto_clean:
 	# Skip
 
 override_dh_auto_test:
-	dh_auto_test || echo "Ignoring test failures"
+	@echo "nocheck set, not running tests"
 
 override_dh_strip:
 	dh_strip --no-automatic-dbgsym



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-mapnik/-/commit/9dca29194a93aee5d6026b982134d4dfdc7de255

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-mapnik/-/commit/9dca29194a93aee5d6026b982134d4dfdc7de255
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220804/85d68cd3/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list