7

Is there, by some miracle, an existing piece of software which is able to convert a (3rd party, GeoServer) WFS feed into vector tiles? In a utopian world, this would happen on the fly, but a download/carve/serve model would be ok.

If not, is there some set of libraries or tools which might be cobbled together to achieve this?

  • Could it be something like using GDAL WFS driver gdal.org/drv_wfs.html through ogr2ogr gdal.org/ogr2ogr.html with the -clipsrc parameter? – user30184 Feb 27 '15 at 7:04
  • For on the fly conversion you could configure GeoServer with WPS extension to read WFS as input and your users could read data through WPS process "clip" docs.geoserver.org/stable/en/user/extensions/wps/…. – user30184 Feb 27 '15 at 7:18
  • Yeah, there's two steps missing though - to generate vector tiles you need the logic for mapping zoom levels, X and Y onto lat/long bounding boxes, and you also need to simplify geometry. Is there any OGC support for those? – Steve Bennett Feb 27 '15 at 7:24
  • With some imagination, perhaps. Using GeoServer as an example, simplification and scale dependent contents on a map are familiar concepts. What is missing is a plain vector format for WMS output to be stored into tile cache. SVG and KML are already supported but not optimal. If you install GeoServer the following request will still give you sort of a vector tile http://localhost:8080/geoserver/wms?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&WIDTH=459&HEIGHT=351&LAYERS=tiger%3Atiger_roads&TRANSPARENT=TRUE&FORMAT=image%2Fsvg+xml&BBOX=-73.9751,40.75108,-73.9535,40.7676&SRS=EPSG:4326&STYLES= – user30184 Feb 27 '15 at 9:58
  • Is there a (published - de jure rather than de facto) standard for vector tiles yet? Not saying there should be to use them, just interested. – BradHards Feb 27 '15 at 21:52
6

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

5

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

  • A few things I found out along the way: Installing "GDAL" (with apt-get or brew e.g.) also installs ogr2ogr in your path. To make the provided one-liner work, I had to add host=localhost port=5432 to the PG-string. Also worth mentioning: this will create a new Table with the name of the wfs layer in your postgres db. – AdamAL Mar 29 '18 at 20:23
1

One way would be to serve the layer from GeoServer in GeoJSON format, and on the client side digest the layer with Mapbox-GL.js, then let MapboxGL convert & render the layer as a vector tile. This is not a recommended approach for very layer vector layers, but I have had success with layers with under 10 million vertices.

Check out: https://www.mapbox.com/mapbox-gl-js/api/#GeoJSONSource

  • Hrm... I wouldn't really consider it using "vector tiles" if you're downloading the entire layer into the browser, but I guess for some limited situations this could be useful. – Steve Bennett Jan 31 '16 at 23:54
1

GeoServer has nowadays a vector tiles extension http://docs.geoserver.org/latest/en/user/extensions/vectortiles/index.html. Publishing happens through GeoWebCache. You can make a cascaded WFS layer from the 3rd party WFS feature type with GeoServer http://docs.geoserver.org/stable/en/user/data/cascaded/wfs.html and push out vector tiles from your own GeoServer on-the-fly.

-2

Is there something known, not using any PostGIS or Mapnik or self-hosted stuff ?

I mean, WFS has bbox capabilities, can render GeoJSON or GML, both are "vector feature encoding formats", somehow.

There shouln't be any complexity (among processing time), to convert that to vector tiles.

  • I don't think that this is an answer, but rather "thinking out loud". Maybe you can try out your approach yourself and see if it works? – Stefan Jun 29 '18 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.