I am trying to understand some of the vector tile logic and implementation on openlayers (6.3.1). I have 2 layers that simply don't overlay, resulting on the screenshoot below. I have looked into multiple example but they just increase my technical doubts, and confusion here is the system:
- Vector tile server
Tegola server (gospatial/tegola:v0.10.4
) , using default options (tiles at 256
pixel? size source data srid=4326
and SQL SQL:FROM XXX.XXX WHERE geom && !BBOX!
)
Server layer description is here: http://tiles.isric.org/capabilities/wosis.json
- WMS service
WMS service: http://maps.isric.org/mapserv?map=/map/soc.map
- Running example
Full code example in jsfiddle: https://jsfiddle.net/jorgejesus/vt6qndrw/1/
- Code parts:
So for the tegola server I have something like this:
var tegola_layer = new ol.layer.VectorTile({
source: new ol.source.VectorTile({
format: new ol.format.MVT(),
projection: 'EPSG:4326',
url: 'https://tiles.isric.org/maps/wosis/{z}/{x}/{y}.pbf?debug=true',
tileGrid: new ol.tilegrid.WMTS({
tileSize: [256,256],
resolutions:resolutions, //from above check jsfiddle
origin: [-180,90.0],
})
})
})
And for WMS:
var wms_layer = new ol.layer.Tile({
source: new ol.source.TileWMS({
projection: 'EPSG:4326',
url: 'http://maps.isric.org/mapserv?map=/map/soc.map',
params: {
'LAYERS':'soc_0-5cm_mean',
crossOrigin: 'anonymous',
'TILED': true
},
})
})
Finally the OL 6 view:
var map = new ol.Map({
layers: [
tegola_layer,
wms_layer
],
target: 'map',
view: new ol.View({
center: [-76.275329586789, 22.153492567373],
extent: ol.proj.get("EPSG:4326").getExtent(),
zoom: 5,
projection: "EPSG:4326"
})
});
I have the image bellow as final code result, it would be very pleasant for Western Europe to enjoy the warm waters of the Golf of Mexico, but this is not my objective.
Kindly ask for tips and light into what is the problem, I find that vector tile docs very dispersed and I may have some miss understanding on grids.