I´ve generated a map API from the GBIF data portal. It shows points from the country Mali.
I included the API as a WMTS in Openlayers2, but I dont know how to change the xyz accordingly, so that my data shows up properly in my openlayers2?
The implemented WMTS Layer code looks like this:
var wmts = new OpenLayers.Layer.WMTS({
name: "Observations Mali 2000-2010 WMTS Gbif",
url: "http://api.gbif.org/v1/map/density/tile?x=0&y=0&z=0&type=COUNTRY&key=ML&layer=OBS_2000_2010&palette=yellows_reds",
layer: "layer_id",
style: "default",
matrixSet: "matrix_id",
isBaseLayer: false
});
map.addLayer(wmts);
And the webbrowser output (the yellow dots) looks like this so far:
Setting xyz as 0 values just give me a yellow point grid in my map.
Hope someone can give me a solution to my problem showing up the Mali data properly.
Best Answer
Why do you want to use WMTS? The GBIF website is based on Leaflet. The built-in tiles layer are not using WMTS grid at all but the OSM default grid.
Normally with both OpenLayers 2 and 3, you just have to change the URL parameters when tiles are
base_url/z/x/y.png
but the GBIF url do not work the usual way: it requires more changes as the url uses additional parameters.For OpenLayers 2
Use the code below
See a working demo. (Added by editing)
To change parameters in URL, just do in the browser debugger console:
For OpenLayers 3 (it was my first answer...)
You can use the following. I use some parameters so it's possible to change layers or countries instead of only relying on x, y, z
With this, you can later in the console do something like
layer.getSource().setTileUrlFunction(setTileUrlFunction({layers: ['OTH_1990_2000', 'OTH_2000_2010'], countries: ['ML']}))
to change your tiles.