[Git][debian-gis-team/tirex][upstream] New upstream version 0.6.4

ǝɹʇʇɐʃǝ◖ xıʃǝɟ (@xamanu) gitlab at salsa.debian.org
Tue Aug 17 17:40:15 BST 2021



ǝɹʇʇɐʃǝ◖ xıʃǝɟ pushed to branch upstream at Debian GIS Project / tirex


Commits:
1577aa44 by Felix Delattre at 2021-08-17T16:39:42+00:00
New upstream version 0.6.4
- - - - -


9 changed files:

- backend-mapnik/metatilehandler.cc
- backend-mapnik/metatilehandler.h
- backend-mapnik/renderd.cc
- backend-mapnik/renderrequest.h
- bin/tirex-status
- debian/changelog
- debian/tirex-core.tirex-backend-manager.init
- debian/tirex-core.tirex-master.init
- debian/tirex-syncd.init


Changes:

=====================================
backend-mapnik/metatilehandler.cc
=====================================
@@ -35,7 +35,7 @@
 #define MERCATOR_WIDTH 40075016.685578488
 #define MERCATOR_OFFSET 20037508.342789244
 
-MetatileHandler::MetatileHandler(const std::string& tiledir, const std::string& stylefile, unsigned int tilesize, double scalefactor, int buffersize, unsigned int mtrowcol, const std::string& imagetype) :
+MetatileHandler::MetatileHandler(const std::string& tiledir, const std::map<std::string, std::string>& stylefiles, unsigned int tilesize, double scalefactor, int buffersize, unsigned int mtrowcol, const std::string& imagetype) :
     mTileWidth(tilesize),
     mTileHeight(tilesize),
     mMetaTileRows(mtrowcol),
@@ -45,7 +45,35 @@ MetatileHandler::MetatileHandler(const std::string& tiledir, const std::string&
     mScaleFactor(scalefactor),
     mTileDir(tiledir) 
 {
-    load_map(mMap, stylefile);
+    for (unsigned int i=0; i<=MAXZOOM; i++)
+    {
+        mPerZoomMap[i]=NULL;
+    }
+
+    for (auto itr = stylefiles.begin(); itr != stylefiles.end(); itr++)
+    {
+        if (itr->first == "")
+        {
+            load_map(mMap, itr->second);
+            debug("load %s without zoom restrictions", itr->second.c_str());
+        }
+        else if (itr->first.at(0) != '.')
+        {
+            throw std::invalid_argument("malformed mapfile config postfix '" + itr->first + "'");
+        }
+        else
+        {
+            char *endptr;
+            long int num = strtol(itr->first.c_str()+1, &endptr, 10);
+            if (*endptr || (num<0) || (num>MAXZOOM))
+            {
+                throw std::invalid_argument("malformed mapfile config postfix '" + itr->first + "'");
+            }
+            mPerZoomMap[num] = new mapnik::Map; 
+            debug("load %s for zoom %d", itr->second.c_str(), num);
+            load_map(*(mPerZoomMap[num]), itr->second);
+        }
+    }
 
     fourpow[0] = 1;
     twopow[0] = 1;
@@ -99,6 +127,7 @@ const NetworkResponse *MetatileHandler::handleRequest(const NetworkRequest *requ
     rr.south = (twopow[z] - y - mtr) * MERCATOR_WIDTH / twopow[z] - MERCATOR_OFFSET;
     rr.scale_factor = mScaleFactor;
     rr.buffer_size = mBufferSize;
+    rr.zoom = z;
 
     // we specify the bbox in epsg:3857, and we also want our image returned
     // in this projection.
@@ -250,6 +279,7 @@ const RenderResponse *MetatileHandler::render(const RenderRequest *rr)
 {
     debug(">> MetatileHandler::render");
     char init[255];
+    mapnik::Map *map = mPerZoomMap[rr->zoom] ? mPerZoomMap[rr->zoom] : &mMap;
 
     sprintf(init, "+init=epsg:%d", rr->srs);
     // commented out - rely on proper SRS specification in map.xml
@@ -281,21 +311,21 @@ const RenderResponse *MetatileHandler::render(const RenderRequest *rr)
     }
 
     mapnik::box2d<double> bbox(west, south, east, north);
-    mMap.resize(rr->width, rr->height);
-    mMap.zoom_to_box(bbox);
+    map->resize(rr->width, rr->height);
+    map->zoom_to_box(bbox);
     if (rr->buffer_size > -1)
     {
-        mMap.set_buffer_size(rr->buffer_size);
+        map->set_buffer_size(rr->buffer_size);
     }
-    else if (mMap.buffer_size() < 128)
+    else if (map->buffer_size() < 128)
     {
-        mMap.set_buffer_size(128);
+        map->set_buffer_size(128);
     }
 
     debug("width: %d, height:%d", rr->width, rr->height);
     RenderResponse *resp = new RenderResponse();
     resp->image = new mapnik::image_32(rr->width, rr->height);
-    mapnik::agg_renderer<mapnik::image_32> renderer(mMap, *(resp->image), rr->scale_factor, 0u, 0u);
+    mapnik::agg_renderer<mapnik::image_32> renderer(*map, *(resp->image), rr->scale_factor, 0u, 0u);
     try
     {
         renderer.apply();


=====================================
backend-mapnik/metatilehandler.h
=====================================
@@ -45,7 +45,7 @@ class MetatileHandler : public RequestHandler
 {
     public:
 
-    MetatileHandler(const std::string& tiledir, const std::string& stylefile, unsigned int tilesize, double scalefactor, int buffersize, unsigned int mtrowcol, const std::string & imagetype);
+    MetatileHandler(const std::string& tiledir, const std::map<std::string,std::string>& stylefiles, unsigned int tilesize, double scalefactor, int buffersize, unsigned int mtrowcol, const std::string & imagetype);
     ~MetatileHandler();
     const NetworkResponse *handleRequest(const NetworkRequest *request);
     void xyz_to_meta(char *path, size_t len, const char *tile_dir, int x, int y, int z) const;
@@ -67,6 +67,7 @@ class MetatileHandler : public RequestHandler
     double mScaleFactor;
     std::string mTileDir;
     mapnik::Map mMap;
+    mapnik::Map *mPerZoomMap[MAXZOOM+1];
 };
 
 #endif


=====================================
backend-mapnik/renderd.cc
=====================================
@@ -54,7 +54,7 @@ bool RenderDaemon::loadMapnikWrapper(const char *configfile)
 
     char linebuf[255];
     std::string tiledir;
-    std::string mapfile;
+    std::map<std::string, std::string> mapfiles;
     std::string stylename;
     unsigned int tilesize = 256;
     unsigned int mtrowcol = 8;
@@ -85,9 +85,9 @@ bool RenderDaemon::loadMapnikWrapper(const char *configfile)
             {
                 tiledir.assign(eq);
             }
-            else if (!strcmp(line, "mapfile"))
+            else if (!strncmp(line, "mapfile", 7))
             {
-                mapfile.assign(eq);
+                mapfiles.insert(std::pair<std::string, std::string>(line+7, eq));
             }
             else if (!strcmp(line, "scalefactor"))
             {
@@ -137,18 +137,12 @@ bool RenderDaemon::loadMapnikWrapper(const char *configfile)
     }
     fclose(f);
 
-    if (mapfile.empty())
+    if (mapfiles.empty())
     {
         warning("cannot add %s: missing mapfile option", configfile);
         return rv;
     }
 
-    if (access(mapfile.c_str(), R_OK) == -1)
-    {
-        warning("cannot add %s: map file '%s' not accessible", configfile, mapfile.c_str());
-        return rv;
-    }
-
     if (tiledir.empty())
     {
         warning("cannot add %s: missing tiledir option", configfile);
@@ -169,7 +163,7 @@ bool RenderDaemon::loadMapnikWrapper(const char *configfile)
 
     try
     {
-        mHandlerMap[stylename] = new MetatileHandler(tiledir, mapfile, tilesize, 
+        mHandlerMap[stylename] = new MetatileHandler(tiledir, mapfiles, tilesize, 
             scalefactor, buffersize, mtrowcol, imagetype);
         mHandlerMap[stylename]->setStatusReceiver(this);
         debug("added style '%s' from map %s", stylename.c_str(), configfile);


=====================================
backend-mapnik/renderrequest.h
=====================================
@@ -30,6 +30,7 @@ class RenderRequest
         int buffer_size;
         unsigned int srs;
         unsigned int bbox_srs;
+        unsigned int zoom;
 };
 
 #endif


=====================================
bin/tirex-status
=====================================
@@ -373,6 +373,10 @@ Show status only once, default is to show it once per second.
 
 Show a table of rendering times by style and zoom level. Implies --once.
 
+=item B<-n>, B<--numbers>
+
+Show a table of rendering counts by style and zoom level. Implies --once..
+
 =item B<-r>, B<--raw>
 
 Return status in raw JSON format instead of in ANSI coloured human readable


=====================================
debian/changelog
=====================================
@@ -1,7 +1,15 @@
+tirex (0.6.4) focal; urgency=medium
+
+  * allow adding a dot and zoom level after mapfile parameter to override map file for specific zoom levels
+
+ -- Frederik Ramm <frederik.ramm at geofabrik.de>  Fri, 13 Aug 2021 11:55:10 +0200
+
 tirex (0.6.3) bionic; urgency=medium
   
   * modify TMS backend to take template URL parameter
 
+ -- Frederik Ramm <frederik.ramm at geofabrik.de>  Mon, 29 Jun 2020 15:57:07 +0200
+
 tirex (0.6.2) bionic; urgency=medium
   
   * add TMS backend


=====================================
debian/tirex-core.tirex-backend-manager.init
=====================================
@@ -64,7 +64,7 @@ do_stop()
 	#   1 if daemon was already stopped
 	#   2 if daemon could not be stopped
 	#   other if a failure occurred
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE 
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user tirex --pidfile $PIDFILE 
 	RETVAL="$?"
 	[ "$RETVAL" = 2 ] && return 2
 	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
@@ -83,7 +83,7 @@ do_reload() {
 	# restarting (for example, when it is sent a SIGHUP),
 	# then implement that here.
 	#
-	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
+	start-stop-daemon --stop --signal 1 --quiet --user tirex --pidfile $PIDFILE
 	return 0
 }
 


=====================================
debian/tirex-core.tirex-master.init
=====================================
@@ -64,7 +64,7 @@ do_stop()
 	#   1 if daemon was already stopped
 	#   2 if daemon could not be stopped
 	#   other if a failure occurred
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE 
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user tirex --pidfile $PIDFILE 
 	RETVAL="$?"
 	[ "$RETVAL" = 2 ] && return 2
 	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
@@ -83,7 +83,7 @@ do_reload() {
 	# restarting (for example, when it is sent a SIGHUP),
 	# then implement that here.
 	#
-	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE 
+	start-stop-daemon --stop --signal 1 --quiet --user tirex --pidfile $PIDFILE 
 	return 0
 }
 


=====================================
debian/tirex-syncd.init
=====================================
@@ -64,7 +64,7 @@ do_stop()
 	#   1 if daemon was already stopped
 	#   2 if daemon could not be stopped
 	#   other if a failure occurred
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE 
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user tirex --pidfile $PIDFILE 
 	RETVAL="$?"
 	[ "$RETVAL" = 2 ] && return 2
 	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
@@ -83,7 +83,7 @@ do_reload() {
 	# restarting (for example, when it is sent a SIGHUP),
 	# then implement that here.
 	#
-	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE 
+	start-stop-daemon --stop --signal 1 --quiet --user tirex --pidfile $PIDFILE 
 	return 0
 }
 



View it on GitLab: https://salsa.debian.org/debian-gis-team/tirex/-/commit/1577aa440a2d4120f6b5577493790329eae867d4

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/tirex/-/commit/1577aa440a2d4120f6b5577493790329eae867d4
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/20210817/50459890/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list