# Integrate staticly generated low-z tiles and dynamically generated high-z tiles
# provided by Tirex. For this low-z requests are forwarded 1:1 to the file system,
# high-z requests end up with Tirex via a rewrite rule.

<Directory "/data2/k/osm/htdocs/earth">
    Require all granted
</Directory>

Alias "/earth" "/data2/k/osm/htdocs/earth"

# mod_tile assumes file extensions are consisting only of lower-case letters, while we want them to be "o5m"
# we achieve that by rewriting the file extension to one we use internally for this ("ofm")
# However, we must only do that for levels 11 to 17 which are delivered via Tirex, levels 1 to 9 are static
# and delivered differently.

RewriteEngine on
RewriteRule ^(.*/vectorosm/v1/\d\d/\d+/\d+)\.o5m$ /tirex$1.ofm [PT]
RewriteRule ^(.*/vectorosm/dev/\d\d/\d+/\d+)\.o5m$ /tirex$1.ofm [PT]
