- Kotlin Blueprints
- Ashish Belagali Hardik Trivedi Akshay Chordiya
- 233字
- 2021-07-02 21:50:16
Rendering the map
The ol is the OpenLayers package that provides the API to play with the maps overlay.
ol.Maps
The core essential component of the ol package is ol.Maps. It is used to render the maps on the target p, which in our case is map-overlay a p tag from index.html where the map will be shown:
// Renders the map on the target p
var map = new ol.Map({target: "map"})
ol.View
This is used to manage or configure the viewing properties of the map such as zoom level, default center position, and the projection of the map:
// To configure center, zoom level and projection of the map
var view = new ol.View({
zoom: 9
});
ol.layer
A layer is a visual representation of data from a source. It is used to show the data on the map that is fetched from remote sources.
It has three basic types of layers:
- ol.layer.Tile: This is for layer sources that provide pre-rendered, tiled images in grids that are organized by zoom levels for specific resolutions
- ol.layer.Image: This is for server rendered images
- ol.layer.Vector: This is for vector data that is rendered client-side
Layers are set when configuring the map object:
layers: [
new ol.layer.Tile(...)
],
ol.source
This is used to set the source of the remote data for the layer:
layers: [
new ol.layer.Tile({source: new ol.source.OSM()})
]
推薦閱讀
- 深度學習經典案例解析:基于MATLAB
- MATLAB實用教程
- 面向對象程序設計(Java版)
- Python機器學習:手把手教你掌握150個精彩案例(微課視頻版)
- Python Data Analysis Cookbook
- Learning Concurrency in Kotlin
- Java零基礎實戰(zhàn)
- Beginning C++ Game Programming
- 計算機應用技能實訓教程
- 從零開始:C語言快速入門教程
- Learning C++ by Creating Games with UE4
- Prezi Cookbook
- 軟件工程實用教程 (第3版)
- PHP程序員面試算法寶典
- 區(qū)塊鏈技術與智能服務應用