1

I'm trying to get this map on my openlayers map

When I just add the layer in the code below, I do get the tiles, correctly referenced, but very blurry.

var url = "http://services.geodataonline.no/arcgis/rest/services/Geocache_UTM33_EUREF89/GeocacheBasis/MapServer";
layer = new ol.layer.Tile({
  source: new ol.source.TileArcGISRest({
    url: url
  })
});

The ArcGISRest seems to request tiles from the wrong zoom level. Is there a way to get tiles of a higher zoom level?

I've tried to switch to ol.source.XYZ too (see below for the source definition), then it does show good quality tiles, but I can't get it to use the right projection (changing the projection option actually doesn't change the map).

source: new ol.source.XYZ({
  attributions: ["Kartverket, Geovekst og Kommuner - Geodata AS"],
  url: url + "/tile/{z}/{y}/{x}",
  projection: ol.proj.get("EPSG:25833"),
})

Here's the layers meta-information: http://services.geodataonline.no/arcgis/rest/services/Geocache_UTM33_EUREF89/GeocacheBasis/MapServer

Could someone help me with either the projection issue in the source.XYZ layer, or the quality issue in the TileArcGISRest layer?

2

After a lot of searching, I came up with a solution on my own. My problem was twofold:

First, I didn't load proj4js and the projection definition I needed. That's why changing the projection didn't alter the the map view at all.

When I had the projection, I could solve it by setting the map projection to EPSG:25833 with the TileArcGISRest tile source. Setting the map projection caused better tiles to be loaded.

I still didn't succeed in setting the correct parameters for the XYZ source, but that's not needed anymore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.