jquery - creating an EPSG:28992 map using openlayers3 -


i trying create openlayers3 map using custom wmts layer on eps:28992 setting. have used openlayers 2 before, not succeding in this.

i have tried adding eps layer proj, not seem anything, there error: uncaught typeerror: cannot read property '0' of null. , none of tiles requested.

var projection = ol.proj.get('epsg:28992'); var projectionextent = projection.getextent(); var resolutions = [3440.640, 1720.320, 860.160, 430.080, 215.040, 107.520, 53.760, 26.880, 13.440, 6.720, 3.360, 1.680, 0.840, 0.420, 0.210]; var matrixids = new array(26);    (var i=0; i<26; ++i) {     matrixids[i] = "epsg:28992:" + i; }  var attribution = new ol.attribution({   html: 'tiles &copy; <a href="http://services.arcgisonline.com/arcgis/rest/' +       'services/demographics/usa_population_density/mapserver/">arcgis</a>' });  lonlat = result.center.split(',');   var map = new ol.map({       view: new ol.view({         center: [lonlat[0],lonlat[1]],         zoom: result.zoom     }),      layers: [          new ol.layer.tile({           opacity: 0.7,           source: new ol.source.wmts({             attributions: [attribution],             url: "http://geodata.nationaalgeoregister.nl/wmts/",             name: "basis registratie topografie",             layer: "brtachtergrondkaart",             matrixset: "epsg:28992",             format: 'image/png',             projection: projection,             tilegrid: new ol.tilegrid.wmts({               origin: ol.extent.gettopleft(projectionextent),               resolutions: resolutions,               matrixids: matrixids             }),             style: 'default'           })         })     ],     target: target }); 

the resolution en matrixids worked in openlayers2 directly copied them, think missing small any1 have idea?

p.s. added epsg:28992 proj4.js following line:

proj4.defs("epsg:28992","+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs"); 

regards casper

the problem here ol.proj.projection#getextent() return null projections configured proj4js. don't need proj4js map work, you'll need correct origin tile grid. easiest way configure wmts layer request capabilities (http://geodata.nationaalgeoregister.nl/wmts/?request=getcapabilities) , use ol.format.wmtscapabilities , ol.source.wmts.optionsfromcapabilities create options ol.source.wmts instance. can configure layer manually. looking @ getcapabilities response, see correct origin [-285401.92 903402.0].


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -