- 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()})
]
推薦閱讀
- 深度強(qiáng)化學(xué)習(xí)算法與實(shí)踐:基于PyTorch的實(shí)現(xiàn)
- Java設(shè)計(jì)模式及實(shí)踐
- 快速念咒:MySQL入門指南與進(jìn)階實(shí)戰(zhàn)
- 用戶體驗(yàn)增長:數(shù)字化·智能化·綠色化
- R Data Analysis Cookbook(Second Edition)
- 深入分布式緩存:從原理到實(shí)踐
- 編寫高質(zhì)量代碼:改善Objective-C程序的61個(gè)建議
- PrimeFaces Blueprints
- 計(jì)算語言學(xué)導(dǎo)論
- Python Linux系統(tǒng)管理與自動化運(yùn)維
- CryENGINE Game Programming with C++,C#,and Lua
- Android項(xiàng)目實(shí)戰(zhàn):博學(xué)谷
- Building Scalable Apps with Redis and Node.js
- Swift編程實(shí)戰(zhàn):iOS應(yīng)用開發(fā)實(shí)例及完整解決方案
- 編譯原理學(xué)習(xí)與實(shí)踐指導(dǎo)