I have a dataset in PostgreSQL that is in EPSG:27700, this is read by GoeServer and converted to .pbf files (using GeoWebCache). I have tile gridsets enabled for ESPG:27700,ESPG:4326,ESPG:900913. I am then rendering the tiles using OpenLayers/Mapbox GL.
When using ol.map I get tiles returned and all is working
var map = new ol.Map({
target: 'map',
view: new ol.View({
Projection: 'EPSG:4326',
center: schladmingWebMercator,
zoom: 18
}),
layers: [new ol.layer.VectorTile({
source: new ol.source.VectorTile({
tilePixelRatio: 1, // oversampling when > 1
tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}),
format: new ol.format.MVT(),
defaultDataProjection: 'EPSG:4326',
url: 'http://someserversomewhere:8080/geoserver/gwc/service/tms/1.0.0/' + layer +
'@EPSG%3A'+projection_epsg_no+'@pbf/{z}/{x}/{-y}.pbf'
})
})]
});
However changing to mapbox.gl.map it no longer returns tiles as the map centre is outside my extents
var map = new mapboxgl.Map({
container: 'map',
minZoom: 15,
maxZoom: 18,
style: customStyleJson,
center: centrepoin,
zoom: 15,
url: 'http://someserversomewhere:8080/geoserver/gwc/service/tms/1.0.0/' + layer +
'@EPSG%3A'+projection_epsg_no+'@pbf/{z}/{x}/{-y}.pbf'
});
I'm certain the projection is incorrect or not converting as required but I'm struggling to understand where in the connection a change needs to be made. Could somebody explain at what point a different projection can be requested (without any permanent transformation of data)? I notice the projection setting to 4326 in ol.map, is this possible in Mapbox GL?