WFS to Vector Tiles

I think I'd probably look to download the data into Postgres using ogr2ogr then look at TileStashe for serving the vector tiles.

Docs for ogr2ogr WFS driver: http://www.gdal.org/drv_wfs.html

@underdark wrote about using ogr2ogr: http://anitagraser.com/2012/09/26/wfs-to-postgis-in-3-steps/

There are some pointers for configuring TileStashe here: https://github.com/mapzen/vector-datasource/wiki/Mapzen-Vector-Tile-Service#how-it-works


I haven't tried @walkermatt's approach with TileStache, but Chubbs SpatialServer (aka PGRestAPI) was very easy to deploy.

WFS to PostGIS

Assuming you have PostGIS installed and a GIS-enabled database, this is completely trivial:

ogr2ogr -f PostgreSQL PG:"user=ubuntu password=... dbname=gis" \ 
  "WFS:http://example.org/ows?version=2.0.0&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=mylayer"

(EDIT: Well, almost completely trivial. If the WFS source has a limit on the number of features it will return, you need to page:

ogr2ogr --config OGR_WFS_PAGING_ALLOWED ON --config OGR_WFS_PAGE_SIZE 10000 ....

)

PostGIS to Vector Tiles

Installing PGRestAPI is straightforward, especially if you're using a server that already has Mapnik, PostGIS installed.

You modify settings.js to point to your database, but you don't need to specify individual tables. Instead, you can specify tables that should not be made public.

PGRestAPI has a great web interface that lets you quickly verify that it's working, and browse to the right endpoint:

enter image description here

enter image description here

It includes the Mapbox vector tiles plugin to Leaflet (developed by the same group) so you can see your vector tiles in the browser:

enter image description here