I have a little problem, that I do not understand.
My Tiles come from a own mapserver (Mapserver) and everything is fine there. Is a orthophoto of Berlin. But if I invite the WMTS in OpenLayers I get too high tiles for the respective zoom level and the TileRow is negative:
It has to be like this:
My Code in OpenLayers:
var projectionExtent = [368000.0000000000000000, 5798000.0000000000000000, 416000.0000000000000000, 5838000.0000000000000000];
var resolutions = new Array(14);
var resolutions = [700, 280, 140, 70, 28, 14, 7, 2.8, 1.4, 0.7, 0.28, 0.14, 0.07, 0.028];
var matrixIds = new Array(14);
for (var z = 0; z < 14; ++z) {
matrixIds[z] = z;
}
var wmts = new ol.source.WMTS({
attributions: 'Tiles © Mapserver',
url: 'http://10.40.6.199/mapcache/wmts?',
serverType: 'mapserver',
crossOrigin: 'anonymous',
layer: 'wms_test',
matrixSet: 'test',
format: 'image/png',
projection: 'EPSG:3006',
tileGrid: new ol.tilegrid.WMTS({
origins: [[368000, 5977200], [368000, 5869680], [368000, 5869680], [368000, 5851760], [368000, 5841008], [368000, 5841008], [368000, 5839216], [368000, 5838140], [368000, 5838140.8], [368000, 5838140.8], [368000, 5838069.12], [368000, 5838033.28], [368000, 5838015.36], [368000, 5838004.608]],
resolutions: resolutions,
matrixIds: matrixIds,
}),
style: 'default',
});
Mapcache.xml :
<?xml version="1.0" encoding="UTF-8"?>
<mapcache>
<cache name="disk" type="disk">
<base>/mnt/speicher/mapcache</base>
<symlink_blank/>
</cache>
<grid name="test">
<metadata>
<title>test_3006</title>
<WellKnownScaleSet>test-3006</WellKnownScaleSet>
</metadata>
<extent>368000.0000000000000000 5798000.0000000000000000 416000.0000000000000000 5838000.0000000000000000</extent>
<srs>EPSG:3006</srs>
<srsalias>EPSG:3006</srsalias>
<resolutions>700 280 140 70 28 14 7 2.8 1.4 0.7 0.28 0.14 0.07 0.028</resolutions>
<units>m</units>
<size>256 256</size>
</grid>
<source name="luftbild" type="wms">
<http>
<url>http://localhost/cgi-bin/mapserv?</url>
<connection_timeout>300</connection_timeout>
</http>
<getmap>
<params>
<FORMAT>image/png</FORMAT>
<LAYERS>Berlin</LAYERS>
<MAP>/home/oliver/Dokumente/orthophoto_berlin/orthophoto_simple.map</MAP>
<TRANSPARENT>TRUE</TRANSPARENT>
</params>
</getmap>
</source>
<tileset name="wms_test">
<source>luftbild</source>
<cache>disk</cache>
<grid>test</grid>
<format>PNG</format>
<metatile>5 5</metatile>
<metabuffer>10</metabuffer>
<expires>3600</expires>
</tileset>
<default_format>JPEG</default_format>
<service type="wms" enabled="true">
<full_wms>assemble</full_wms>
<resample_mode>bilinear</resample_mode>
<format>PNG</format>
</service>
<service type="wmts" enabled="true"/>
<service type="tms" enabled="true"/>
<service type="kml" enabled="true"/>
<service type="gmaps" enabled="true"/>
<service type="ve" enabled="true"/>
<service type="demo" enabled="true"/>
<errors>report</errors>
<lock_dir>/home/oliver/Dokumente/lockdir</lock_dir>
</mapcache>
Mapfile:
MAP
NAME "ORTHOPHOTO_BERLIN"
EXTENT 368000.0000000000000000 5798000.0000000000000000 416000.0000000000000000 5838000.0000000000000000
UNITS kilometers
SHAPEPATH "/home/oliver/Dokumente/orthophoto_berlin/"
SIZE 1000 1000
IMAGETYPE PNG24
PROJECTION
"init=epsg:3006"
END
WEB
METADATA
ows_title "Orthophoto_Berlin"
ows_enable_request "*"
ows_srs "EPSG:3006"
END
END
LAYER
NAME "berlin"
STATUS ON
TYPE RASTER
DEBUG 10
PROJECTION
"init=epsg:3006"
END
TILEINDEX "kachelindex.shp"
TILEITEM "location"
END
OUTPUTFORMAT
NAME "png"
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END
END
+axis=neu
in the proj4 definition may provide a quick fixproj4.defs("EPSG:3006","+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +axis=neu +no_defs");