wmts layer in Openlayers from Geoserver

المشرف العام

Administrator
طاقم الإدارة
I have some layers in Geoserver(latest stable) that came from PostGIS data (they belong to a store with PostGIS type and gets data from a PostGIS database)

In those layers there are only WMS settings, not WMTS

I went to Caching Defaults in Geoserver, the WMTS Service is already enabled.

So I went to my Openlayers and try this, so I can get a PostGIS-based layer, from Geoserver to the map.

var projection = ol.proj.get('EPSG:3857');var textent = ol.proj.transformExtent([2297128.5, 4618333, 2459120.25, 4763120], 'EPSG:900913', 'EPSG:3857');var projectionExtent = projection.getExtent();var size = ol.extent.getWidth(projectionExtent) / 256;var resolutions = new Array(14);var matrixIds = new Array(14);for (var z = 0; z < 14; ++z) { // generate resolutions and matrixIds arrays for this WMTS resolutions[z] = size / Math.pow(2, z); matrixIds[z] = z;} var ait = new ol.layer.Tile({ opacity: 0.7, extent: textent, source: new ol.source.WMTS({ url: 'http://localhost:8080/geoserver/mymap/wmts?', layer: 'mymap:planet_osm_polygon, mymap:planet_osm_line, mymap:planet_osm_roads, mymap:planet_osm_point', matrixSet: 'EPSG:3857', format: 'image/png', projection: projection, tileGrid: new ol.tilegrid.WMTS({ origin: ol.extent.getTopLeft(projectionExtent), resolutions: resolutions, matrixIds: matrixIds }), style: 'default' }) })planet_osm_polygon, planet_osm_line, planet_osm_roads and planet_osm_point are composing the final layer. In simple WMS settings would beparams: {'LAYERS': 'mymap:planet_osm_polygon, mymap:planet_osm_line, mymap:planet_osm_roads, mymap:planet_osm_point'.... but, in the WMTS case I dont know how I should set them, so that why I set them in layer

This does not work, I get

GET http://localhost:8080/geoserver/mym...mage/png&TileMatrix=9&TileCol=286&TileRow=196 404 (Not Found)

What am I missing? Am I using the wrong settings or Geoserver does not support WMTS for PostGIS-based layers?

Thanks



أكثر...
 
أعلى