[mapserver-commits] r12484 - in trunk/mapserver/mapcache: . src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:30:49 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:30:49 -0700 (Fri, 26 Aug 2011)
New Revision: 12484

Modified:
   trunk/mapserver/mapcache/geocache.xml
   trunk/mapserver/mapcache/src/cache_sqlite.c
   trunk/mapserver/mapcache/src/configuration_xml.c
Log:


Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml	2011-08-26 11:30:44 UTC (rev 12483)
+++ trunk/mapserver/mapcache/geocache.xml	2011-08-26 11:30:49 UTC (rev 12484)
@@ -395,6 +395,10 @@
       <hitstats>false</hitstats>
    </cache>
 
+   <cache name="mbtiles" type="mbtiles">
+      <dbname_template>/home/tbonfort/Documents/MapBox/tiles/natural-earth-1.mbtiles</dbname_template>
+   </cache>
+
    <!-- format
 
         a format is an image algorithm used for compressing images
@@ -705,6 +709,12 @@
       <metatile>5 5</metatile>
       <metabuffer>30</metabuffer>
    </tileset>
+   <tileset name="natural-earth-1">
+      <source>osm</source>
+      <cache>mbtiles</cache>
+      <format>PNG</format>
+      <grid>g</grid>
+   </tileset>
    <tileset name="osm">
       <metadata>
          <title>osm mapserver served map of midi-pyrénées</title>

Modified: trunk/mapserver/mapcache/src/cache_sqlite.c
===================================================================
--- trunk/mapserver/mapcache/src/cache_sqlite.c	2011-08-26 11:30:44 UTC (rev 12483)
+++ trunk/mapserver/mapcache/src/cache_sqlite.c	2011-08-26 11:30:49 UTC (rev 12484)
@@ -282,13 +282,16 @@
    if ((cur_node = ezxml_child(node,"base")) != NULL) {
       dcache->dbname_template = apr_pstrcat(ctx->pool,cur_node->txt,"/{tileset}#{grid}.db",NULL);
    }
+   if ((cur_node = ezxml_child(node,"dbname_template")) != NULL) {
+      dcache->dbname_template = apr_pstrdup(ctx->pool,cur_node->txt);
+   }
    if ((cur_node = ezxml_child(node,"hitstats")) != NULL) {
       if(!strcasecmp(cur_node->txt,"true")) {
          dcache->hitstats = 1;
       }
    }
    if(!dcache->dbname_template) {
-      ctx->set_error(ctx,500,"sqlite cache \"%s\" is missing <base> directory",cache->name);
+      ctx->set_error(ctx,500,"sqlite cache \"%s\" is missing <dbname_template> entry",cache->name);
       return;
    }
 }

Modified: trunk/mapserver/mapcache/src/configuration_xml.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration_xml.c	2011-08-26 11:30:44 UTC (rev 12483)
+++ trunk/mapserver/mapcache/src/configuration_xml.c	2011-08-26 11:30:49 UTC (rev 12484)
@@ -402,6 +402,13 @@
       ctx->set_error(ctx,400, "failed to add cache \"%s\": sqlite support is not available on this build",name);
       return;
 #endif
+   } else if(!strcmp(type,"mbtiles")) {
+#ifdef USE_SQLITE
+      cache = geocache_cache_mbtiles_create(ctx);
+#else
+      ctx->set_error(ctx,400, "failed to add cache \"%s\": sqlite support is not available on this build",name);
+      return;
+#endif
    } else if(!strcmp(type,"memcache")) {
 #ifdef USE_MEMCACHE
       cache = geocache_cache_memcache_create(ctx);



More information about the mapserver-commits mailing list