首页 文章

如何通过Geoserver获得矢量图块?

提问于
浏览
3

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

但经过这些操作,我仍然没有获得成功,我想知道原因,如果你有一些想法,请与我分享,谢谢你的亲切〜

ps:控制台有一些消息,也许它很有用:关于gwc播种:

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

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

10一月10:27:45 INFO [seed.GWCTask] - 线程组在2.578秒后完成SEED任务

我没有足够的声誉,所以我将消息复制到此处而不是发送图像,抱歉

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

我已经添加了vector-tiles插件,

当我请求瓷砖时有一些错误:

http:// localhost:8080 / geoserver / gwc / service / tms / 1.0.0 / cite:DLZXX_2011_PL_10000 @ EPSG%3A4326 @ geojson / 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%3A4326@geojson/{z}/{x}/{y}.geojson'
        }),
        style:initStyle
    });

    map.addLayer(vectorTile);

每个Tile 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

回应的 Headers

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 - 无法找到Tiles 404(来自缓存)

1 回答

  • 4

    我已经通过geoserver和openLayers3获得了矢量切片 .

    1)geoserver(GeoWebcache)中的矢量切片是 created dynamically ,因此您无需单击GeoWebcache管理页面上的种子按钮;

    2)数据的投影是一个非常重要的参数,OL3中的默认投影是EPSG:3857 . so you need to make sure the projections(layer,source,tilegrid) are same ;

    PS:我在博客上写下了这个过程:

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

    抱歉,这是中文博客,如果您对这些主题有任何疑问,可以通过电子邮件与我联系:

    ericliuneverlost@163.com

相关问题