如何在Open Layers 3中显示TMS图层?

时间:2018-03-15 06:23:16

标签: javascript openlayers-3 geoserver tms

我想在ol3中显示tms图层。

  var layer = 'india:Indian_gdp_119';
  var projection_epsg_no = '4326';
  var map = new ol.Map({
  target: 'map',
  view: new ol.View({
  center: ol.proj.transform([77.39907,28.58920], 'EPSG:4326', 'EPSG:3857'),
      zoom:2    }),
    layers: [new ol.layer.VectorTile({
      style:simpleStyle,
      source: new ol.source.VectorTile({
        tilePixelRatio:1  ,
        tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}),
        format: new ol.format.MVT(),
        url: 'http://localhost/geoserver/gwc/service/tms/1.0.0/' + layer +
            '@EPSG%3A'+projection_epsg_no+'@pbf/{z}/{x}/{-y}.pbf' }) })]});

在geoserver和ol3中,pbf格式不起作用,在geoserver和ol3中得到相同的错误。 错误::

 http://localhost/geoserver/gwc/service/tms/1.0.0/india:Indian_gdp_119@EPSG%3A4326@pbf/2/1/1.pbf 404 (Not Found)

此代码中是否有任何错误。谢谢

0 个答案:

没有答案