[Git][debian-gis-team/tirex][master] 3 commits: Update watch file for GitHub URL changes.

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



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


Commits:
42ab26a5 by Felix Delattre at 2021-08-17T16:39:14+00:00
Update watch file for GitHub URL changes.

- - - - -
1577aa44 by Felix Delattre at 2021-08-17T16:39:42+00:00
New upstream version 0.6.4
- - - - -
00e4f66b by Felix Delattre at 2021-08-17T16:39:42+00:00
Update upstream source from tag 'upstream/0.6.4'

Update to upstream version '0.6.4'
with Debian dir 7c1dcecd0b631ef4322293ed0deb92f562b9c74a
- - - - -


6 changed files:

- backend-mapnik/metatilehandler.cc
- backend-mapnik/metatilehandler.h
- backend-mapnik/renderd.cc
- backend-mapnik/renderrequest.h
- bin/tirex-status
- debian/watch


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/watch
=====================================
@@ -4,4 +4,4 @@ dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,\
 uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/;s/\-/\./g,\
 filenamemangle=s/(?:.*?)?(?:rel|v|tirex)?[\-\_]?(\d\S+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/tirex-$1.$2/ \
 https://github.com/openstreetmap/tirex/releases \
-(?:.*?/archive/(?:.*?/)?)?(?:rel|v|tirex)?[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+(?:.*?/archive/(?:.*?/)?)?(?:rel|v|tirex)?[\-\_]?(\d\S+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))



View it on GitLab: https://salsa.debian.org/debian-gis-team/tirex/-/compare/11ab3809c20f38d3c15f1e50c1ef045ceb8d44e3...00e4f66ba1fa33630dca36a7e65a487c0d13a23e

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/tirex/-/compare/11ab3809c20f38d3c15f1e50c1ef045ceb8d44e3...00e4f66ba1fa33630dca36a7e65a487c0d13a23e
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/7a4c7f0b/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list