Code for beginners of web developer, Who wanna work on HTML5 with OpenLayer3
This HTML code shows very basic of map. means It show the map on web-browesr.
HTML file contains the two part of code
- head
- body
Head contains 3 javascript files and 2 css files, 1 css and 2 javascript files (ol.css, ol-debug.js, jquery-2.1.1.min.js) are basic file to add map with html. other files discribe below
Java script, Its main thing to handle the html page. It use some special function to perform any opration on html tag or code.
var stand for variable declairation, here we declaire some globle verible view, mapquest, osm, toner, stamen, map and one local variable layer in change block.
The view variable is responsible to show map on screen with particulre position.
center: ol.proj.fromLonLat([78.9629, 23.3])
It is deaclaire the centre of view. The parameter is an array, the collaction of longitude and laltitude of India.
Zoom by defualt value of view.
map variable contains the control options, canvas view, map variabe and view variable.
The change block is a function to performe selection process of map from list of map(one of the mapquest, osm, toner, stamen) layer variable select the layer of clicked map.
mapquest, osm, toner, stamen these are type of map view. Stalite capture some data from sensor, then it convert into one of these view. every map create by tiles. Tile is a one part of map image.
setVisible function reaturn the bulean value for selected map.
Thanking you
Ravi Rajpurohit