Hi,

find attached a patch for mod_tile.c which will then check for the layer name 
and deliver a transparent tile instead of an oceantile fallback for the maplint 
an caption layer if no tileset file exists.
Currently the maplint overlay is useless in many regions an in zoom < 12 
because it return nontransparent fallback-tiles that completely cover the map 
tiles.

A C guru might want to validate it because my c coding dates back some years ;-)


Cheers,
  Martin.
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger
Index: mod_tah.c
===================================================================
--- mod_tah.c	(revision 11183)
+++ mod_tah.c	(working copy)
@@ -29,6 +29,11 @@
 static char * statictilepath = "/storage/openstreetmap/tah/Tiles/";
 #define OCEANS_DB_FILE "/storage/openstreetmap/tah/Tiles/oceantiles_12.dat"
 
+/* These layer return a transparent tile if no tileset file exists */
+const char * transparent_layers[] = {
+	"maplint",
+	"caption"
+	};
 
 const char land[] =
   "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52"
@@ -264,6 +269,15 @@
 } /* serve_tileset */
 
 
+/* Checks if the layername is handled as transparent layer */
+static int is_transparent_layer( const char * layername) {
+  int i;
+  for( i=0; i < sizeof(transparent_layers)/sizeof(char*); i++)
+    if( strcmp(layername,transparent_layers[i]) == 0)
+      return 1;
+  return 0;
+}
+
 static int serve_oceantile(request_rec *r, request_data* rd) {
   char * fileName;
   apr_status_t res;
@@ -273,7 +287,12 @@
   int bit_off;
   int type;
 
-  if (rd->z < 12) {
+  if (is_transparent_layer(rd->layer)) {
+    ap_set_content_type(r, content_imagepng);
+    ap_set_content_length(r, sizeof(transparent));
+    ap_rwrite(transparent,sizeof(transparent),r);
+    return OK;
+  } else if (rd->z < 12) {
     /* only available for zooms levels >= 12. */
     return HTTP_NOT_FOUND;
   } else {		
_______________________________________________
Tilesathome mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/tilesathome

Reply via email to