2017-01-10 24 views
2

在这些日子里,我沉迷于一个大问题 - 如何通过Geoserver获得矢量图块?我一直在寻找很多文档和博客,并且有一些有用的资源来解决这个问题,如果一步一步的操作非常简单: http://suite.opengeo.org/docs/latest/dataadmin/vectortiles/index.html;如何通过Geoserver获取矢量图块?

但这些操作后,我仍然没有得到成功,我不知道到konw的原因,如果你有一些想法,请与我分享,谢谢你的那种〜

PS:有一些消息从控制台,也许它是有用的: 关于gwc种子:

10一月10:27:45 INFO [seed.SeedTask] - GWC播种机层次4 - 完成(重新)播种层cn:道路后192个瓷砖和2秒。

10一月10:27:45 INFO [seed.SeedTask] - GWC Seeder Thread-3完成(重新)播种层cn:80个瓦片和2秒后的道路。

10一月10时27分45秒INFO [seed.GWCTask] - 线程组完成SEED2.578秒

后的任务,我没有足够的声誉,所以我的邮件复制到这里,而不是发送的图片,对不起

// ***************************************** ********************************

我已经添加矢量瓷砖插件,

并且在请求瓷砖时出现一些错误:

http://localhost:8080/geoserver/gwc/service/tms/1.0.0/cite:[email protected]%[email protected]/11/1673/891.geojson 404(未找到)

//代码即可获得矢量瓦片

var vectorTile = new ol.layer.VectorTile({ 

     //get source 
     source: new ol.source.VectorTile({ 
      format:new ol.format.GeoJSON(), 
      tileGrid: ol.tilegrid.createXYZ({ 
       maxZoom:14 
      }), 
      tilePixelRatio:1, 
      url:'/geoserver/gwc/service/tms/1.0.0/'+layerName 
       +'@EPSG%[email protected]/{z}/{x}/{y}.geojson' 
     }), 
     style:initStyle 
    }); 

    map.addLayer(vectorTile); 

每一瓦片的标头GET请求

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Encodin: gzip, deflate 
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3 
Cookie: JSESSIONID=9679B11893A04A0ACE21D49D93AB7CDC 
Host: localhost:8080 
Referer: http://localhost:8080/23DPlatform/index.jsp 
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0 

部首响应

Content-Disposition :inline; filename=geoserver-dispatch.text 
Content-Encoding: gzip 
Content-Type: text/plain 
Date: Tue, 10 Jan 2017 13:01:09 GMT 
Server: Apache-Coyote/1.1 
Transfer-Encoding:chunked 

// ******************************************** *******************

也许你可以阅读这个问题,也有一些类似的

Ionic/Leaflet - Can't get Tiles 404 Not Found (from cache)

+0

请添加设置的更多细节,你添加了矢量瓷砖插件吗?当您请求瓷砖时,您在日志中看到什么错误?注意:上面的行是INFOrmative而不是ERRORs, –

+0

@iant是的,当然。我已经添加了矢量瓷砖插件,并有源:http://ares.boundlessgeo.com/geoserver/master/ext-latest/ 当我要求瓷砖时有一些错误: ol.js: 428 GET http:// localhost:8080/geoserver/gwc/service/tms/1.0.0/cite:DLZXX_2011_PL_10000 @ EPSG%3A4326 @ geojson/11/1673/892.geojson 404(Not Found) – ZijianLiu

+0

请编辑问题这个信息 –

回答

3

我已经通过geoserver和openLayers3获得了矢量图块。

1)中的GeoServer矢量砖(GeoWebcache)的动态创建,所以你 不需要点击GeoWebcache管理页面上播种按钮;

2)数据的投影是一个非常重要的参数,OL3中的默认投影是EPSG:3857。所以你需要确保投影(图层,源代码,tilegrid)相同;

PS:我写下来的过程中我的博客:

http://www.cnblogs.com/escage/p/6387529.html

对不起,这是中国的博客,如果您对这些话题的任何疑问,可以 用电子邮件联系我:

ericliun [email protected]