setSectionPopup()により、
ポップアップを駅間(隣り合う2つの駅の間のこと)に置くことができます。
このサンプルでは、JR横浜線の真ん中の駅間にポップアップを設置しています。
var rosen;
function init() {
// 路線図初期化
rosen = new Rosen('map', {
apiKey: "2jr5nchcswemrfjj67jvjaqu", // アクセスキーはサンプル用です。実際にご利用されるときは書き換えてください。
zoom: 17,
consoleViewControl: true,
center: [29122, 25618, 16]
});
var yokohamasen = 123;
// 横浜線の全駅間を取得
rosen.getSectionsByLineCode(yokohamasen).then(function(sections) {
var middle_index = Math.floor(sections.length / 2); // 真ん中
var section = sections[middle_index];
var popup = Rosen.textPopup().setComment("横浜線");
rosen.setSectionPopup(section.code, popup);
});
};
window.addEventListener('load', init);