iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.1k stars 298 forks source link

[loader] Vector tiles support #182

Closed vpicavet closed 5 years ago

vpicavet commented 8 years ago

iTowns should support vector tiles at some point.

Vector tiles are an efficient vector format for rendering of 2D data. Vector tile services start to be available, and server-side components do exist.

Implementing vector tiles support suppose having Clamping available first ( #181 ).

We could use the following services for testing purposes : 

zarov commented 6 years ago

I'm currently working on integrating vector tiles, and I identified a few step ahead:

First I'm concentrating on solving one way, and then the others (that should be smooth).

Below are a list of PR related to this work (will be updated):

zarov commented 6 years ago

Let's lay a solid basis, with the aim to easily iterate later on this subject (for example when expanding style possibilities). Here's a more detailed point of view I got.

Tile loading

Vector tiles are accessible through TMS, WMTS, WMS and WFS. Currently, no provider can fetch pbf files. A method needs to be added for this, that could be used like OGCWebServiceHelper.getColorTextureByUrl for example.

Question: do we add all the methods related to vector tiles in a new file, like VectorTile_Provider.js ? I don't think it's a good idea to create a new single provider, as it would be a pain to add support for all protocols in it. I was thinking more of adding a VectorTileHelper.js, featuring some public methods:

Those methods could be used in each Provider, using the supportedFormats array: a new entry with application/x-protobuf;type=mapbox-vector needs to specify the calling of a method above.

Tile styling

The style argument in Feature2Texture.createTextureFromFeature could be improved:

The same reasoning can be applied to Feature2Mesh, but more limited.

Let's discuss it further !

peppsac commented 6 years ago

We should start rethinking other Providers / Drivers as well. For instance WMTS_Provider does different things for elevation and color textures while it's completely unrelated to the WMTS protocol.

An option is to reorganize providers: ImageryProvider, ElevationProvider, VectorProvider for instance. They would then use some protocol aware code (WMTSProtocolHandler ? TMSProtocoHandler?) that would simply build the correct url and fetch the result.

And maybe VectorProvider isn't even useful, since it'll provide textures or meshes. You could declare an imagery layer using the xyz protocol and a vector-tiles data source.

Then ImageryProvider would do:

return tmsProtocolHandler.fetch(params).then(tile => VectorTile.toImageryTexture(tile) 

For a layer using a raster data source ImageryProvider would do:

return tmsProtocolHandler.fetch(params).then(tile => Raster.toImageryTexture(tile) 
return tmsProtocolHandler.fetch(params).then(tile => Raster.toElevationTexture(tile) 

WDYT?

mbredif commented 6 years ago

Please allow me to jump in, as this discussion is very much related to recent experience with students having a really hard time to customize itowns with new datasources, new data formats or new portraying styles (without even talking about interaction) and facing monolithic providers that they have a hard time to customize.

We definitely need this discussion and clarification of the roles of providers/protocolhandlers, loaders/drivers and feature_transformer/stylizers. Current providers are basically responsible for orchestrating the whole transformation from datasources/servers to Three.js objects, so it is very cumbersome to mix and match different protocols, formats and styles.

This discussion has multiple facets, my proposition, definitely up to discussion, would be that :

autra commented 6 years ago

I quite agree with you @mbredif on the role of providers. For the rest, no opinion yet :-)

could enable the the coding of each provider and loader as independant npm packages

Note that this is already possible with providers, at least. Also, if you import iTowns with a module bundler, you can already customize a lot of things (but I do agree that this process still requires too much inner knowledge of iTowns :-/ ).

peppsac commented 6 years ago

@mbredif I agree - it's more or less what I wrote in my comment, but yours is way clearer :)

zarov commented 5 years ago

Solved in multiple PRs