In this part, we will see how to display the WMS image coming from the authority responsible for geology maps in France, the BRGM (equivalent to USGS to simplify):
Let's copy the usual template into the sandbox directory but do not forget to include, in this case, the reference to Proj4js JavaScript library before the
ol3.js
file.Go within the
<script>
tag and declare the additional projection for local projection, in this case, Lambert 93, an official projection for France:proj4.defs("EPSG:2154","+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
Declare the extent and the projection reusing your knowledge about declaring custom projection:
var extent = [-378305.81, 6093283.21, 1212610.74, 7186901.68];
var projection = ol.proj.get('EPSG:2154');
projection.setExtent(extent);Declare an array with one layer using a source providing a WMS-projected...