ガイド変更履歴HERE SDK API references
ガイド

屋内地図コンポーネントを使用する

屋内地図はNavigateライセンスでのみ使用できます。

HERE Indoor Mapでは、地図に民間施設を読み込み、表示して操作する機能を提供しています。HERE Indoor Map の詳細については、「HERE Indoor Map ガイド」を参照してください。

施設の所有者で、HERE SDK で HERE Indoor Map を活用することに興味がある場合は、

[email protected]

現在、HERE SDK では民間施設のみをサポートしているため、施設データはアプリにのみ表示されます。デフォルトでは、地図に施設は表示されません。各施設には、HERE SDK 資格情報に関連付けられた一意の施設 ID が割り当てられます。

VenueEngine を初期化する

HERE Indoor Map API の使用を開始する前に、VenueEngine インスタンスを作成して起動する必要があります。これは地図の初期化後に実行できますが、VenueEngine を作成する最適なタイミングは地図にシーンが読み込まれた後です。

private void loadMapScene() {
    // Completion handler when loading a map scene.
    private func onLoadScene(mapError: MapError?) {
        guard mapError == nil else {
            print("Error: Map scene not loaded, \(String(describing: mapError))")
            return
        }

        // Hide extruded buildings layer, so it will not overlaps with venues.
        mapView.mapScene.disableFeatures([MapFeatures.extrudedBuildings])

        // Create a venue engine object. Once the initialization is done, a completion handler
        // will be called.
        do {
            try venueEngine = VenueEngine { [weak self] in self?.onVenueEngineInit() }
        } catch {
            print("SDK Engine not instantiated: \(error)")
        }
    }
}

VenueEngine が初期化されると、完了ハンドラーが呼び出されます。この時点から、VenueServiceVenueMap の両方にアクセスできるようになります。VenueService は施設の読み込みに使用され、VenueMap は地図上の施設を制御します。完了ハンドラー内で必要なデリゲートをすべて追加してから、VenueEngine を起動する必要があります。HRN プラットフォーム マップ カタログは VenueEngine を起動してから設定する必要があります。

HRN の設定は必須ではありません。ユーザーが HRN を設定しない場合、デフォルトのコレクション HRN が自動的に選択されます。ユーザーが他のコレクションを使用したい場合は、それぞれの HRN を設定できます。HRN値が欠落しているか無効であることを示すエラーログが生成されます。プロジェクトの有効なHRN文字列を受け取る方法の詳細については、「HERE Indoor Mapガイド」を参照してください。

private func onVenueEngineInit() {
    // Get VenueService and VenueMap objects.
    let venueMap = venueEngine.venueMap
    let venueService = venueEngine.venueService

    // Add needed delegates.
    venueService.addServiceDelegate(self)
    venueService.addVenueDelegate(self)
    venueMap.addVenueSelectionDelegate(self)

    //Lets user download topologies for current session.
    venueService.loadTopologies()

    // Start VenueEngine. Once authentication is done, the authentication completion handler
    // will be triggered. Afterwards VenueEngine will start VenueService. Once VenueService
    // is initialized, VenueServiceListener.onInitializationCompleted method will be called.
    venueEngine.start(callback: {
        error, data in if let error = error {
            print("Failed to authenticate, reason: " + error.localizedDescription)
        }
    })

    if (hrn != "") {
        // Set platform catalog HRN
        venueService.setHrn(hrn: hrn)
    }
}

VenueEngineが起動されると、現在の資格情報を使用して認証が行われ、次にVenueServiceが起動されます。VenueService が初期化されると、VenueServiceDelegate.onInitializationCompleted() メソッドが呼び出されます。

// Delegate for the VenueService event.
extension ViewController: VenueServiceDelegate {
    func onInitializationCompleted(result: VenueServiceInitStatus) {
        if (result == .onlineSuccess) {
            print("Venue Service initialize successfully.")
        } else {
            print("Venue Service failed to initialize!")
        }
    }

    func onVenueServiceStopped() {
        print("Venue Service has stopped.")
    }
}

トークンを使用して VenueEngine を起動する

有効な HERE Indoor Platform プロジェクト トークンを使用して VenueEngine を起動できます。HERE プラットフォームのプロジェクト管理とプロジェクト ワークフローの詳細については、HERE プラットフォームのプロジェクト管理に関するページを参照してください。

private func onVenueEngineInit() {
    // Get VenueService and VenueMap objects.
    let venueMap = venueEngine.venueMap
    let venueService = venueEngine.venueService

    // Add needed delegates.
    venueService.addServiceDelegate(self)
    venueService.addVenueDelegate(self)
    venueMap.addVenueSelectionDelegate(self)

    // Start VenueEngine by replacing TOKEN_GOES_HERE with token you have in String data type.
    // Afterwards VenueEngine will start VenueService. Once VenueService
    // is initialized, VenueServiceListener.onInitializationCompleted method will be called.
    venueEngine.start(token:"TOKEN_GOES_HERE")
}

Indoor Mapサンプルアプリを試す

施設でのマップタップイベントの使用法を示す完全な例は、GitHubにある「IndoorMap」サンプルアプリで入手できます。


EN 日本語

HERE documentation

Find answers to your product and technical questions

Documentation

What's new

Videos

EN 日本語

HERE ドキュメント

製品や技術に関する質問の答えを見つけましょう。より多くの内容と最新の情報については、英語版をご覧ください。

ドキュメント

ダイナミックマップ

動的コンテンツ関連のAPIをアプリやサービスに活用して、ドライバーが安全・快適かつ予定どおりに目的地へ到着できるよう支援します。

地図とデータ

世界中を走行する多数のマッピング車両から得られる最新の位置情報データを活用し、精度の高い地図やカスタムレイヤーを構築できます。

最新情報

動画

(function () { const input = document.querySelector('input[data-typeahead]'); if (!input) return; // Prevent the form from submitting/navigating input.closest('form')?.addEventListener('submit', e => e.preventDefault()); input.addEventListener('input', function () { const q = this.value.trim().toLowerCase(); document.querySelectorAll('.nav-group-name').forEach(group => { let anyVisible = false; group.querySelectorAll('.nav-group-task').forEach(task => { const text = task.textContent.trim().toLowerCase(); const show = !q || text.includes(q); task.style.display = show ? '' : 'none'; if (show) anyVisible = true; }); // Hide the whole group header if nothing matches group.style.display = anyVisible || !q ? '' : 'none'; }); }); })(); (function () { function onTokenClick(event) { var link = event.target.closest('.sdk-for-ios .item .token'); if (!link) return; event.preventDefault(); console.log('token clicked', link.textContent.trim()); var item = link.closest('.item'); if (!item) return; var content = item.querySelector('.height-container'); if (!content) { console.log('no .height-container found for item', item); return; } var isHidden = window.getComputedStyle(content).display === 'none'; content.style.display = isHidden ? 'block' : 'none'; link.classList.toggle('token-open', isHidden); var href = link.getAttribute('href'); if (href) { if (history.pushState) history.pushState({}, '', href); else location.hash = href; } } function openHashTarget() { var hash = window.location.hash.slice(1); if (!hash) return; var anchor = document.querySelector('.sdk-for-ios a[name="' + hash + '"]'); if (!anchor) return; var item = anchor.closest('.item'); if (!item) return; var link = item.querySelector('.token'); var content = item.querySelector('.height-container'); if (!link || !content) return; content.style.display = 'block'; link.classList.add('token-open'); } function init() { console.log('HERE SDK accordion init'); openHashTarget(); } document.removeEventListener('click', onTokenClick); document.addEventListener('click', onTokenClick); if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } window.addEventListener('hashchange', openHashTarget); window.addEventListener('pageLoad', init); })();