-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Projection in source of raster #191
Comments
I have no plans to add support for projections in ol-mapbox-style. If you need custom projections, use OpenLayers to set up your layers. |
Hi @ahocevar, proj4.defs(
"EPSG:2163",
"+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs"
);
ol.proj.proj4.register(proj4);
var projection = ol.proj.get("EPSG:2163");
var layer = new ol.layer.VectorTile({
declutter: true,
source: new ol.source.VectorTile({
attributions:
'© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' +
"OpenStreetMap contributors</a>",
format: new ol.format.MVT(),
url:
"https://maps.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?key=" +
openMapTilesKey
})
});
fetch(
"https://maps.tilehosting.com/styles/basic/style.json?key=" + openMapTilesKey
).then(function(response) {
response.json().then(function(style) {
olms.stylefunction(layer, style, "openmaptiles");
new ol.Map({
layers: [layer],
target: "map",
view: new ol.View({
projection: projection,
center: ol.proj.transform([8.23, 46.86], "EPSG:4326", "EPSG:2163"),
zoom: 1
})
});
});
}); Result: Do you have any hints?- What am I doing wrong? |
This is not an ol-mapbox-style issue. I guess the tiles you are requesting from https://maps.tilehosting.com/data/v3/{z}/{x}/{y}.pbf?key= are not in the projection you are referring to as EPSG:2163. And OpenLayers does not reproject vector tiles. |
Mapbox supports no projections, but openlayers does. According to the specification of mapbox style, there is no parameter for a projection. The only possibility for raster would be the schema "tms", which mapbox did not implement properly.
Do you want to bring support for projection? And if so, maybe I can support you there.
The text was updated successfully, but these errors were encountered: