HERE Maps API for Javascript を使用すると、 Fleet Telematics の高度なデータセットの主題図レイヤーをマップに簡単に重ねることができます。 Fleet Telematics の高度なデータセット レイヤーを使用すると、郵便番号、国勢調査データ、道路クラス、交差点表示などの追加データを提供することで、地図の操作性を向上できます。 利用可能な主題図レイヤの詳細については、 Fleet Telematics の API リファレンス のレイヤのドキュメントを参照してください。
'PSTLCB_MP' レイヤーを担当するタイルプロバイダに TAP イベントリスナーを登録しています。
// create tile provider and layer that displays postcode area centroidsvar centroidsProvider =newH.service.extension.platformData.TileProvider(service,{layer:'PSTLCB_MP',level:12},{resultType:H.service.extension.platformData.TileProvider.ResultType.MARKER});var centroids =newH.map.layer.MarkerTileLayer(centroidsProvider);
map.addLayer(centroids);// add events listener, that outputs data provided by the Platform Data Extenstion and// associated with the H.map.Marker
centroidsProvider.addEventListener('tap',function(ev){var markerData = ev.target.getData();
console.log(markerData.getCell('POSTAL_CODE'), markerData.getCell('ISO_COUNTRY_CODE'))});
イベントリスナーは、 event 引数で使用可能なデータを処理し、使用可能なリンク ID のセットと照合します。 一致するものがある場合、コードはマップ オブジェクトをマップに追加します。
/**
* Assuming that "map" and "platform" are already initialized, and there is
* a processed routing response that includes a polyline and an array of 'linkids'
* that represent legs of the route.
*/var service = platform.getPlatformDataService();// search the charging stations by the bounding box
service.searchByBoundingBox(['EVCHARGING_POI'],['POI_ID'], polyline.getBoundingBox(),(rows)=>{
rows.forEach((row)=>{
map.addObject(newH.map.Marker(// read marker position from the data row
row.getCell('WKT').getGeometries()[0]));})},(e)=>{console.log(e)});