Skip to content

Commit

Permalink
Merge pull request #81 from sbrunner/auto-mapcache
Browse files Browse the repository at this point in the history
Don't generate mapcache configuration for layers that shouldn't be in
  • Loading branch information
sbrunner committed Mar 21, 2013
2 parents 04ef26c + d272b0f commit ecededa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 81 deletions.
3 changes: 2 additions & 1 deletion tilecloud_chain/controller.py
Expand Up @@ -744,7 +744,8 @@ def _generate_mapcache_config(gene, options):
mapcache_config_template,
layers=gene.layers,
grids=gene.grids,
mapcache=gene.config['mapcache']
mapcache=gene.config['mapcache'],
min=min
)

f = open(gene.config['mapcache']['config_file'], 'w')
Expand Down
12 changes: 9 additions & 3 deletions tilecloud_chain/mapcache_config_template.py
Expand Up @@ -17,7 +17,10 @@
<origin>top-left</origin>
</grid>
{% endfor %}
{% for layername, layer in layers.items() %}{% if layer['type'] != 'mapnikh' %}
{% for layername, layer in layers.items() %}{%
if layer['type'] != 'mapnik' and (
'min_resolution_seed' not in layer or
min(layer['grid_ref']['resolutions']) < layer['min_resolution_seed']) %}
<source name="{{layername}}" type="wms">
<getmap>
<params>
Expand All @@ -31,7 +34,10 @@
</http>
</source>
{% endif %}{% endfor %}
{% for layername, layer in layers.items() %}
{% for layername, layer in layers.items() %}{%
if layer['type'] != 'mapnik' and (
'min_resolution_seed' not in layer or
min(layer['grid_ref']['resolutions']) < layer['min_resolution_seed']) %}
<tileset name="{{layername}}">
<source>{{layername}}</source>
<cache>default</cache>
Expand All @@ -47,7 +53,7 @@
endfor %}
</dimensions>
</tileset>
{% endfor %}
{% endif %}{% endfor %}
<format name="image/png" type="PNG">
<compression>fast</compression>
Expand Down
77 changes: 0 additions & 77 deletions tilecloud_chain/tests/test_controller.py
Expand Up @@ -1057,32 +1057,6 @@ def test_mapcache(self):
</http>
</source>
<source name="mapnik_grid" type="wms">
<getmap>
<params>
<FORMAT>application/utfgrid</FORMAT>
<LAYERS></LAYERS>
<TRANSPARENT>FALSE</TRANSPARENT>
</params>
</getmap>
<http>
<url>http://localhost/mapserv</url>
</http>
</source>
<source name="mapnik_grid_drop" type="wms">
<getmap>
<params>
<FORMAT>application/utfgrid</FORMAT>
<LAYERS></LAYERS>
<TRANSPARENT>FALSE</TRANSPARENT>
</params>
</getmap>
<http>
<url>http://localhost/mapserv</url>
</http>
</source>
<source name="line" type="wms">
<getmap>
<params>
Expand Down Expand Up @@ -1122,19 +1096,6 @@ def test_mapcache(self):
</http>
</source>
<source name="mapnik" type="wms">
<getmap>
<params>
<FORMAT>image/png</FORMAT>
<LAYERS></LAYERS>
<TRANSPARENT>TRUE</TRANSPARENT>
</params>
</getmap>
<http>
<url>http://localhost/mapserv</url>
</http>
</source>
<tileset name="point_hash_no_meta">
<source>point_hash_no_meta</source>
Expand Down Expand Up @@ -1202,30 +1163,6 @@ def test_mapcache(self):
</dimensions>
</tileset>
<tileset name="mapnik_grid">
<source>mapnik_grid</source>
<cache>default</cache>
<grid>swissgrid_5</grid>
<format>application/utfgrid</format>
<expires>3600</expires> <!-- 1 hour -->
<auto_expire>13800</auto_expire> <!-- 4 hours -->
<dimensions>
<dimension type="values" name="DATE" default="2012">2012</dimension>
</dimensions>
</tileset>
<tileset name="mapnik_grid_drop">
<source>mapnik_grid_drop</source>
<cache>default</cache>
<grid>swissgrid_5</grid>
<format>application/utfgrid</format>
<expires>3600</expires> <!-- 1 hour -->
<auto_expire>13800</auto_expire> <!-- 4 hours -->
<dimensions>
<dimension type="values" name="DATE" default="2012">2012</dimension>
</dimensions>
</tileset>
<tileset name="line">
<source>line</source>
<cache>default</cache>
Expand Down Expand Up @@ -1268,20 +1205,6 @@ def test_mapcache(self):
</dimensions>
</tileset>
<tileset name="mapnik">
<source>mapnik</source>
<cache>default</cache>
<grid>swissgrid_5</grid>
<metatile>8 8</metatile>
<metabuffer>0</metabuffer>
<format>image/png</format>
<expires>3600</expires> <!-- 1 hour -->
<auto_expire>13800</auto_expire> <!-- 4 hours -->
<dimensions>
<dimension type="values" name="DATE" default="2012">2012</dimension>
</dimensions>
</tileset>
<format name="image/png" type="PNG">
<compression>fast</compression>
Expand Down

0 comments on commit ecededa

Please sign in to comment.