こちらの方法を用いて、オリジナル画像でスクロールできる方法を試しています。
https://qiita.com/wakufactory/items/13204ae04f39b7bbeb51
「tileSize:512」と指定すると、タイルの一辺のサイズをデフォルトの256から512に変更できるのですが、
依然として正方形のままです。例えば、サイズを「512×1024」にするにはどうすれば良いでしょうか?
#試したコード
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja-JP"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> leaflet tile sample</title> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> </head> <style> html, body { width: 100%; height: 100%; margin:0 ; } #map { width: 100%; height: 100%; } </style> <script> onload = function() { var map = L.map('map', {center:[-180,120], zoom:1, crs:L.CRS.Simple,}); //100単位で大胆に数値を変えないと動かない var canvasTiles = L.tileLayer.canvas({async:false, continuousWorld:true, tileSize:512, attribution: "地図データ:<a href='http://souzoumap.webcrow.jp/Maps/Maps.HTM' target='_blank'>想像地図研究所</a>"}); canvasTiles.drawTile = function(canvas, tilePoint, zoom) { var w = Math.pow(2,zoom) ; var ctx = canvas.getContext('2d'); ctx.font = "bold 20px 'Arial'"; ctx.fillRect(0,0,511,511) ; //塗りつぶしの範囲 ctx.fillStyle = '#00ff00'; //文字色 ctx.fillText("左上の座標("+tilePoint.x/w+", "+(-1*tilePoint.y/w)+")",10,20) ; ctx.fillText(" 右上の座標("+(tilePoint.x/w+1/w)+", "+(-1*tilePoint.y/w)+")",10,50) ; if(-1*tilePoint.y>=0 && tilePoint.x>=0) //N>=0 かつ E>=0 {ctx.fillText("地図番号:Z"+zoom+"N"+(-1*tilePoint.y)+"E"+tilePoint.x,10,80)} ; //地図番号 if(-1*tilePoint.y<0 && tilePoint.x>=0) //N<0 かつ E>=0 {ctx.fillText("地図番号:Z"+zoom+"S"+tilePoint.y+"E"+tilePoint.x,10,80)} ; //地図番号 } canvasTiles.addTo(map); map.on('click', function(e) { var c = e.latlng; console.log(c.lng/512+"/"+(-c.lat)/512); }); } </script> <body> <div id="map"></div> </body> </html>

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/17 04:55
2018/02/17 04:57
2018/02/17 05:08
2018/02/17 06:29
2018/02/17 07:34
2018/02/17 10:55
2018/02/17 13:14