Newer
Older
www-root / coverage / police4M.js
  1. // ===================================================================
  2. var center_lon = 140.241; // 中心の経度(霞ヶ浦)
  3. var center_lat = 36.131; // 中心の緯度(霞ヶ浦)
  4.  
  5. var initZoom = 11; // ズームの初期値
  6. var MinZoom = 6; // ズームの最小値(最も広い範囲)
  7. var MaxZoom = 17; // ズームの最大値(最も狭い範囲)
  8.  
  9. var initPrecision = 8; // 座標表示の小数点以下の桁数の初期値
  10. // *******************************************************************
  11.  
  12. // 表示用の view 変数の定義。
  13. const view = new ol.View({
  14. center: ol.proj.fromLonLat([center_lon, center_lat]),
  15. zoom: initZoom,
  16. maxZoom: MaxZoom,
  17. minZoom: MinZoom
  18. });
  19.  
  20. const ort = new ol.layer.Tile({
  21. source: new ol.source.OSM(),
  22. title: "OpenStreetMap",
  23. visible: true
  24. });
  25. /*
  26. grayOsmLayer.on('postcompose', function(event) {
  27. grayscale(event.context);
  28. });
  29. */
  30.  
  31. const police4z = new ol.layer.VectorTile({
  32. source: new ol.source.VectorTile({
  33. format: new ol.format.MVT(),
  34. url: "./tiles/tilePolice4z/{z}/{x}/{y}.pbf"
  35. }),
  36. title: "Police 0: 未入力",
  37. visible: true,
  38. opacity: 1,
  39. style: function(feature){
  40. return [
  41. new ol.style.Style({
  42. image: new ol.style.Circle({
  43. radius: 8,
  44. fill: new ol.style.Fill({color: "#ff0000"})
  45. })
  46. })
  47. ];
  48. }
  49. });
  50.  
  51. const police4 = new ol.layer.VectorTile({
  52. source: new ol.source.VectorTile({
  53. format: new ol.format.MVT(),
  54. url: "./tiles/tilePolice4/{z}/{x}/{y}.pbf"
  55. }),
  56. title: "Police 1: 入力済み",
  57. visible: true,
  58. opacity: 1,
  59. style: function(feature){
  60. return [
  61. new ol.style.Style({
  62. image: new ol.style.Circle({
  63. radius: 8,
  64. fill: new ol.style.Fill({color: "#00ff00"})
  65. })
  66. })
  67. ];
  68. }
  69. });
  70.  
  71. var strokestyle = new ol.style.Style({
  72. stroke: new ol.style.Stroke({
  73. color: 'rgba(53, 175, 109, 0.7)',
  74. width: 4
  75. })
  76. });
  77.  
  78. const mapillary = new ol.layer.VectorTile({
  79. source: new ol.source.VectorTile({
  80. attributions: '© Mapillary',
  81. format: new ol.format.MVT(),
  82. tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}),
  83. tilePixelRatio: 16,
  84. opacity: 0.7,
  85. url: 'https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt'
  86. }),
  87. title: "Mapillary",
  88. visible: true,
  89. style: strokestyle
  90. });
  91.  
  92. const map = new ol.Map({
  93. target: "map",
  94. controls: ol.control.defaults().extend([new ol.control.ScaleLine()]),
  95. view: view,
  96. layers: [ort, police4, police4z, mapillary]
  97. });