3
votes

During these days, I am obsessed by a big problem —— how to get the vector tile by Geoserver? I have looking for many docs and blogs, and there are some useful resource for the problem, the operation is very easy if step by step: http://suite.opengeo.org/docs/latest/dataadmin/vectortiles/index.html;

But after these operations, I still don't get success, i wonder to konw the reason, if you have some idea, please sharing with me, thanks for your kind~

ps:there is some message from console,maybe it's useful: about gwc seeding:

10 一月 10:27:45 INFO [seed.SeedTask] - GWC Seeder Thread-4 completed (re)seeding layer cn:roads after 192 tiles and 2 seconds.

10 一月 10:27:45 INFO [seed.SeedTask] - GWC Seeder Thread-3 completed (re)seeding layer cn:roads after 80 tiles and 2 seconds.

10 一月 10:27:45 INFO [seed.GWCTask] - Thread group finished SEED task after 2.578 seconds

I don't have enough reputation, so I copy the message to here instead of sending a image, sorry

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

I have already added the vector-tiles plugin,

and there are some errors when I request the tiles:

http://localhost:8080/geoserver/gwc/service/tms/1.0.0/cite:DLZXX_2011_PL_10000@EPSG%3A4326@geojson/11/1673/891.geojson 404 (Not Found)

//the code to get vector tiles

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);

Header of each Tile GET request

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

Header of response

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

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

Maybe you can read this question, there are some similar

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

1
please add more details of your set up, did you add the vector-tiles plugin? what error do you see in the logs when you request tiles? Note: the above lines are INFOrmative not ERRORs,Ian Turton
@iant yes, sure. i have already added the vector-tiles plugin, and there is the source:ares.boundlessgeo.com/geoserver/master/ext-latest there are some errors when i request the tiles: ol.js:428 GET localhost:8080/geoserver/gwc/service/tms/1.0.0/… 404 (Not Found)ZijianLiu
please edit the question with this informationIan Turton
sorry, this is my first time to ask question on stackoverflow, I have edited the questionZijianLiu

1 Answers

4
votes

I have already got the vector tiles by geoserver and openLayers3.

1)The vector tiles in geoserver(GeoWebcache) are created dynamically, so you don't need to click the seeding button on GeoWebcache admin page;

2)The projection of your data is a very important param, the default projection in OL3 is EPSG:3857. so you need to make sure the projections(layer,source,tilegrid) are same;

PS:I had written down the process on my blog:

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

sorry, it's Chinese blog, if you have any question about these topic, you can contact me with email:

[email protected]