Newer
Older
www-root / coverage / busstopM.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. var mvtSource0 = new L.TileLayer.MVTSource({
  32. url: "./tiles/tileBus0/{z}/{x}/{y}.pbf",
  33. style: function (feature) {
  34. var style = {};
  35. style.color = 'rgba(255,0,0,1)';
  36. style.radius = 5;
  37. style.selected = {
  38. radius: 6
  39. };
  40. return style;
  41. }
  42. });
  43. map.addLayer(mvtSource0);
  44.  
  45. var mvtSource1 = new L.TileLayer.MVTSource({
  46. url: "./tiles/tileBus1/{z}/{x}/{y}.pbf",
  47. style: function (feature) {
  48. var style = {};
  49. style.color = 'rgba(255,200,0,1)';
  50. style.radius = 5;
  51. style.selected = {
  52. radius: 6
  53. };
  54. return style;
  55. }
  56. });
  57. map.addLayer(mvtSource1);
  58.  
  59. var mvtSource2 = new L.TileLayer.MVTSource({
  60. url: "./tiles/tileBus2/{z}/{x}/{y}.pbf",
  61. style: function (feature) {
  62. var style = {};
  63. style.color = 'rgba(0,255,0,1)';
  64. style.radius = 5;
  65. style.selected = {
  66. radius: 6
  67. };
  68. return style;
  69. }
  70. });
  71. map.addLayer(mvtSource2);
  72.  
  73. var strokestyle = new ol.style.Style({
  74. stroke: new ol.style.Stroke({
  75. color: 'rgba(53, 175, 109, 0.7)',
  76. width: 4
  77. })
  78. });
  79.  
  80. const mapillary = new ol.layer.VectorTile({
  81. source: new ol.source.VectorTile({
  82. attributions: '© Mapillary',
  83. format: new ol.format.MVT(),
  84. tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}),
  85. tilePixelRatio: 16,
  86. opacity: 0.7,
  87. url: 'https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt'
  88. }),
  89. title: "Mapillary",
  90. visible: true,
  91. style: strokestyle
  92. });
  93.  
  94. const map = new ol.Map({
  95. target: "map",
  96. controls: ol.control.defaults().extend([new ol.control.ScaleLine()]),
  97. view: view,
  98. layers: [ort, mvtSource2, mvtSource1, mvtSource0, mapillary]
  99. });