Skip to content

Commit

Permalink
Enable configurable maxNativeZoom for datasets with tile zoom > 8 (#11)
Browse files Browse the repository at this point in the history
* Enable billingual mapping via german version

* changes for configurable native zoom
  • Loading branch information
shitong01 authored and pymonger committed Sep 26, 2019
1 parent 5206166 commit acd161e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
21 changes: 19 additions & 2 deletions tosca/templates/facetview.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@
return "#" + myid.replace( /(:|\.|\[|\])/g, "\\$1" );
}

function get_tile_max_zoom(tile_zoom, ind) {
if (tile_zoom.length==0){
max_zoom = 8;
}
else{
max_zoom = parseInt(tile_zoom[ind]);
}
return max_zoom;
}

function set_left_margin() {
return ($(window).width() - $(this).width())/2;
}
Expand Down Expand Up @@ -306,6 +316,7 @@
location_field: 'location',
json_fields: [
'metadata.user_tags',
'metadata.tile_max_zoom',
'metadata.tile_layers',
'images'
],
Expand Down Expand Up @@ -516,6 +527,7 @@
"post": "';\n" +
"var tiles = false;\n" +
"var tile_layers = [];\n" +
"var tile_max_zoom= [];\n" +
"var prodUrl = null;\n"
},
{
Expand Down Expand Up @@ -579,6 +591,11 @@
"field": "metadata.tile_layers",
"post": ";\n"
},
{
"pre": "tile_max_zoom = ",
"field": "metadata.tile_max_zoom",
"post": ";\n"
},
{
"pre": " prodUrl = '",
"field": "urls",
Expand All @@ -591,7 +608,7 @@
" opacity: 1,\n" +
" minZoom: 0,\n" +
" maxZoom: 18,\n" +
" maxNativeZoom: 8,\n" +
" maxNativeZoom: get_tile_max_zoom(tile_max_zoom, i),\n" +
" reuseTiles: true,\n" +
" tms: true,\n" +
" noWrap: true,\n" +
Expand All @@ -603,7 +620,7 @@
" opacity: .6,\n" +
" minZoom: 0,\n" +
" maxZoom: 18,\n" +
" maxNativeZoom: 8,\n" +
" maxNativeZoom: get_tile_max_zoom(tile_max_zoom, i),\n" +
" reuseTiles: true,\n" +
" tms: true,\n" +
" noWrap: true,\n" +
Expand Down
20 changes: 18 additions & 2 deletions tosca/templates/js/mainAppView.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ function jq( myid ) {
return "#" + myid.replace( /(:|\.|\[|\])/g, "\\$1" );
}

function get_tile_max_zoom(tile_zoom, ind) {
if (tile_zoom.length==0){
max_zoom = 8;
}
else{
max_zoom = parseInt(tile_zoom[ind]);
}
return max_zoom;
}

define(
[
Expand Down Expand Up @@ -226,6 +235,7 @@ function(defineComponent,compose,FacetViewMenu,backMap,thumbView){
location_field: 'location',
json_fields: [
'metadata.user_tags',
'metadata.tile_max_zoom',
'metadata.tile_layers',
'images'
],
Expand Down Expand Up @@ -638,6 +648,7 @@ function(defineComponent,compose,FacetViewMenu,backMap,thumbView){
"post": "';\n" +
"var tiles = false;\n" +
"var tile_layers = [];\n" +
"var tile_max_zoom= [];\n" +
"var prodUrl = null;\n"
},
{
Expand Down Expand Up @@ -704,6 +715,11 @@ function(defineComponent,compose,FacetViewMenu,backMap,thumbView){
"field": "metadata.tile_layers",
"post": ";\n"
},
{
"pre": "tile_max_zoom = ",
"field": "metadata.tile_max_zoom",
"post": ";\n"
},
{
"pre": " prodUrl = '",
"field": "urls",
Expand All @@ -716,7 +732,7 @@ function(defineComponent,compose,FacetViewMenu,backMap,thumbView){
" opacity: 1,\n" +
" minZoom: 0,\n" +
" maxZoom: 18,\n" +
" maxNativeZoom: 8,\n" +
" maxNativeZoom: get_tile_max_zoom(tile_max_zoom, i),\n" +
" reuseTiles: true,\n" +
" tms: true,\n" +
" noWrap: true,\n" +
Expand All @@ -728,7 +744,7 @@ function(defineComponent,compose,FacetViewMenu,backMap,thumbView){
" opacity: .6,\n" +
" minZoom: 0,\n" +
" maxZoom: 18,\n" +
" maxNativeZoom: 8,\n" +
" maxNativeZoom: get_tile_max_zoom(tile_max_zoom, i),\n" +
" reuseTiles: true,\n" +
" tms: true,\n" +
" noWrap: true,\n" +
Expand Down

0 comments on commit acd161e

Please sign in to comment.