milutinke
milutinke

Reputation: 411

Cant get (can't find proper url) for Tile's layer on Geoserver using Cesium

First of all, I am working recently with OpenLayers and Cesium.

I set up my Geoserver on:

localhost:8200/geoserver

On my geoserver I have workspace with name:

SrbijaAdmGranice

And layer into that workspace with name:

SRB_AdministrativneGranice_Level2_3909

What is the problem, when i try to add WMS layer - WebMapServiceImageryProvider with this code:

var viewer = new Cesium.Viewer('cesiumContainer');

// Add a WMS imagery layer
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
    url : 'http://localhost:8200/geoserver/wms',
    layers : 'SrbijaAdmGranice:SRB_AdministrativneGranice_Level2_3909',
    parameters : {
    transparent : true,
    format : 'image/png'
    }
}));

I get good result - picture bellow: Result Picture

What is the problem.

The problem is, that i went to Tile Layers in my Geoserver, nad SEED tiles in a proper gridset. When go to Tile Layers I get my layer with possible grid set. When i go to preview i get this link:

http://localhost:8200/geoserver/gwc/demo/SrbijaAdmGranice:SRB_AdministrativneGranice_Level2_3909?gridSet=EPSG:4326&format=image/png

And this result: Result Picture

Problem is, when I want to add WebMapTileServiceImageryProvider I get the result in the console that can't obtaint Tile.

This is code that i used:

imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
    url : 'http://localhost:8200/geoserver/gwc/service/wms?',
    layer : 'SrbijaAdmGranice:SRB_AdministrativneGranice_Level2_3909',
    style : 'default',
    format : 'image/jpeg',
    tileMatrixSetID : '4326', // is this a GridSet Atribute? 
    maximumLevel: 19,
    credit : new Cesium.Credit('U. S. Geological Survey')
    })
);

My question is - What is a proper URL value to get this right? And other parameters as well.

I tried every possible combination.

Please help.

Upvotes: 2

Views: 2156

Answers (1)

milutinke
milutinke

Reputation: 411

I found the solution for this. In fact, does not require any complications. I see some examples on openlayers 3 for tile maps. The whole story is just in one parameter tiled : true, gridset = 'proper grid set' in parameters object

var imageryLayers = viewer.imageryLayers; imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({ url : 'http://localhost:8200/geoserver/SrbijaAdmGranice/wms', layers : 'SrbijaAdmGranice:SRB_AdministrativneGranice_Level2_3909', parameters : { transparent : true, format : 'image/png', tiled : true, gridSet : 'Serbia 3909' } }));

Upvotes: 2

Related Questions